[FFmpeg-devel] [PATCH 02/19] mmvideo: count preamble size in return value.
Paul B Mahol
onemda at gmail.com
Tue Jul 31 17:12:18 CEST 2012
On 7/29/12, Nicolas George <nicolas.george at normalesup.org> wrote:
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavcodec/mmvideo.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>
> MM_PREAMBLE_SIZE is substracted to buf_size almost immediately.
>
>
> diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
> index abba29f..de702ab 100644
> --- a/libavcodec/mmvideo.c
> +++ b/libavcodec/mmvideo.c
> @@ -178,6 +178,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
> {
> const uint8_t *buf = avpkt->data;
> int buf_size = avpkt->size;
> + int buf_size_orig = buf_size;
> MmContext *s = avctx->priv_data;
> int type, res;
>
> @@ -194,7 +195,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
> }
>
> switch(type) {
> - case MM_TYPE_PALETTE : res = mm_decode_pal(s); return buf_size;
> + case MM_TYPE_PALETTE : res = mm_decode_pal(s); return buf_size_orig;
> case MM_TYPE_INTRA : res = mm_decode_intra(s, 0, 0); break;
> case MM_TYPE_INTRA_HH : res = mm_decode_intra(s, 1, 0); break;
> case MM_TYPE_INTRA_HHV : res = mm_decode_intra(s, 1, 1); break;
> @@ -213,7 +214,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
> *data_size = sizeof(AVFrame);
> *(AVFrame*)data = s->frame;
>
> - return buf_size;
> + return buf_size_orig;
> }
>
> static av_cold int mm_decode_end(AVCodecContext *avctx)
On second look you do not need to add new variable, just use avpkt->size.
More information about the ffmpeg-devel
mailing list