[FFmpeg-devel] [PATCH 2/3] lavc/mjpegdec: honor skip_frame option
Michael Niedermayer
michael at niedermayer.cc
Wed Oct 28 12:58:53 CET 2015
On Wed, Oct 28, 2015 at 02:57:14AM +0100, Michael Niedermayer wrote:
> On Tue, Oct 27, 2015 at 11:15:29PM +0100, Matthieu Bouron wrote:
> > On Sun, Oct 18, 2015 at 11:06:50AM +0200, Matthieu Bouron wrote:
> > [...]
> > >
> > > Patch updated, the markers are now properly skipped (which also fixes a
> > > crash).
> >
> > Patch updated. It fixes an issue with mjpeg streams (and in particular with
> > the fate sample ffmpeg-issue-897.avi) due to the EOI marker not handled when
> > skip_frame is set to AVDISCARD_ALL.
> >
> > Matthieu
>
> > mjpegdec.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> > 36d41f1bded2f864394843c6a49d8cc24933688c 0002-lavc-mjpegdec-honor-skip_frame-option.patch
> > From 7325810d812c4182cd42946687a1f4abc04999d1 Mon Sep 17 00:00:00 2001
> > From: Matthieu Bouron <matthieu.bouron at stupeflix.com>
> > Date: Fri, 9 Oct 2015 15:15:15 +0200
> > Subject: [PATCH 2/3] lavc/mjpegdec: honor skip_frame option
> >
> > ---
> > libavcodec/mjpegdec.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> > index 1a86b7b..b4ff83c 100644
> > --- a/libavcodec/mjpegdec.c
> > +++ b/libavcodec/mjpegdec.c
> > @@ -2038,6 +2038,22 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
> > return AVERROR(ENOSYS);
> > }
> >
> > + if (avctx->skip_frame == AVDISCARD_ALL) {
> > + int i, found = 0;
> > + static const int start_codes[] = { SOF0,
> > + SOF1, SOF2, SOF3, SOF48, SOI, EOI };
> > +
> > + for (i = 0; i < FF_ARRAY_ELEMS(start_codes); i++) {
> > + if (start_code == start_codes[i]) {
> > + found = 1;
> > + break;
> > + }
> > + }
> > + if (!found) {
> > + goto skip;
> > + }
i think this would be simpler and shorter if implemented as a
switch(start_code)/case
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151028/ed254fd4/attachment.sig>
More information about the ffmpeg-devel
mailing list