[FFmpeg-devel] [PATCH 1/2] avformat/mpegts: Factorize version checking code out
Michael Niedermayer
michaelni at gmx.at
Wed Apr 29 22:34:12 CEST 2015
On Wed, Apr 29, 2015 at 10:30:56PM +0200, Hendrik Leppkes wrote:
> On Wed, Apr 29, 2015 at 10:24 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libavformat/mpegts.c | 22 ++++++++++++++--------
> > 1 file changed, 14 insertions(+), 8 deletions(-)
> >
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index 0e5c2ba..d707cc3 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -580,6 +580,16 @@ typedef struct SectionHeader {
> > uint8_t last_sec_num;
> > } SectionHeader;
> >
> > +static int skip_identical(const SectionHeader *h, MpegTSSectionFilter *tssf)
> > +{
> > + if (h->version == tssf->last_ver)
> > + return 1;
> > +
> > + tssf->last_ver = h->version;
> > +
> > + return 0;
> > +}
> > +
> > static inline int get8(const uint8_t **pp, const uint8_t *p_end)
> > {
> > const uint8_t *p;
> > @@ -1469,9 +1479,8 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
> > return;
> > if (h.tid != M4OD_TID)
> > return;
> > - if (h.version == tssf->last_ver)
> > + if (skip_identical(&h, tssf))
> > return;
> > - tssf->last_ver = h.version;
> >
>
> I'm not sure this is better. Do you plan on extending the function
> later or something?
yes, that was the idea behind factoring it out but ive not yet tried
to check more fields
> Right now, it saves one line code, but makes the code less clear on
> what it does, IMHO.
>
> - Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150429/bff2a456/attachment.asc>
More information about the ffmpeg-devel
mailing list