diff mbox

[FFmpeg-devel,4/7] avcodec/smvjpegdec: return the packet size instead of 0

Message ID 20161215202113.20807-4-michael@niedermayer.cc
State Accepted
Commit c869e00f881019fa0eaf40874f92e2566b9a0410
Headers show

Commit Message

Michael Niedermayer Dec. 15, 2016, 8:21 p.m. UTC
Most decoders return the amount of data used.
This is more consistent

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/smvjpegdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Dec. 15, 2016, 8:35 p.m. UTC | #1
On 12/15/16, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Most decoders return the amount of data used.
> This is more consistent
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/smvjpegdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
> index e319e5781b..018e135b30 100644
> --- a/libavcodec/smvjpegdec.c
> +++ b/libavcodec/smvjpegdec.c
> @@ -200,9 +200,11 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx,
> void *data, int *data_siz
>              s->picture[1]->linesize[i] = mjpeg_data->linesize[i];
>
>          ret = av_frame_ref(data, s->picture[1]);
> +        if (ret < 0)
> +            return ret;
>      }
>
> -    return ret;
> +    return avpkt->size;
>  }
>
>  static const AVClass smvjpegdec_class = {
> --
> 2.11.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

lgtm
Michael Niedermayer Dec. 15, 2016, 9:28 p.m. UTC | #2
On Thu, Dec 15, 2016 at 09:35:25PM +0100, Paul B Mahol wrote:
> On 12/15/16, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > Most decoders return the amount of data used.
> > This is more consistent
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/smvjpegdec.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
> > index e319e5781b..018e135b30 100644
> > --- a/libavcodec/smvjpegdec.c
> > +++ b/libavcodec/smvjpegdec.c
> > @@ -200,9 +200,11 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx,
> > void *data, int *data_siz
> >              s->picture[1]->linesize[i] = mjpeg_data->linesize[i];
> >
> >          ret = av_frame_ref(data, s->picture[1]);
> > +        if (ret < 0)
> > +            return ret;
> >      }
> >
> > -    return ret;
> > +    return avpkt->size;
> >  }
> >
> >  static const AVClass smvjpegdec_class = {
> > --
> > 2.11.0
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> lgtm

applied

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index e319e5781b..018e135b30 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -200,9 +200,11 @@  static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
             s->picture[1]->linesize[i] = mjpeg_data->linesize[i];
 
         ret = av_frame_ref(data, s->picture[1]);
+        if (ret < 0)
+            return ret;
     }
 
-    return ret;
+    return avpkt->size;
 }
 
 static const AVClass smvjpegdec_class = {