Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-02 07:15:30 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-09-02 15:35:36 +0400
commit1587989518cd61bae3d1b234efd82cd3b11580dd (patch)
tree95d4c4a23106cfe9dca696bcbb4440e3a84f8fad /libavcodec/rawdec.c
parent502fc3b3d4b36015562d19d74f27d0a4ff835c4e (diff)
avcodec/rawdec: Support CODEC_CAP_PARAM_CHANGE
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 305c13e5e4..28792a1688 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -98,19 +98,6 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
memset(context->palette->data, 0, AVPALETTE_SIZE);
}
- if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
- avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
- (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
- context->is_2_4_bpp = 1;
- context->frame_size = avpicture_get_size(avctx->pix_fmt,
- FFALIGN(avctx->width, 16),
- avctx->height);
- } else {
- context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
- context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
- avctx->height);
- }
-
if ((avctx->extradata_size >= 9 &&
!memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) ||
avctx->codec_tag == MKTAG('c','y','u','v') ||
@@ -168,11 +155,25 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
int buf_size = avpkt->size;
int linesize_align = 4;
int res, len;
- int need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp;
+ int need_copy;
AVFrame *frame = data;
AVPicture *picture = data;
+ if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
+ avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
+ (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
+ context->is_2_4_bpp = 1;
+ context->frame_size = avpicture_get_size(avctx->pix_fmt,
+ FFALIGN(avctx->width, 16),
+ avctx->height);
+ } else {
+ context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
+ context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
+ avctx->height);
+ }
+ need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp;
+
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
@@ -368,4 +369,5 @@ AVCodec ff_rawvideo_decoder = {
.close = raw_close_decoder,
.decode = raw_decode,
.priv_class = &rawdec_class,
+ .capabilities = CODEC_CAP_PARAM_CHANGE,
};