On Wed, Apr 29, 2015 at 10:24 PM, Michael Niedermayer <michae...@gmx.at> wrote:
> Signed-off-by: Michael Niedermayer <michae...@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?
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@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to