diff mbox

[FFmpeg-devel] lavf/mpegtsenc: Automatically insert dump_extra for asp muxing

Message ID 201611081225.00692.cehoyos@ag.or.at
State New
Headers show

Commit Message

Carl Eugen Hoyos Nov. 8, 2016, 11:25 a.m. UTC
Hi!

Attached patch allows automatic insertion of dump_extra when 
remuxing mpeg4 asp.

Please comment, Carl Eugen
From 8ff75d4fa9127f3f02dde9408795f27c8d0e9c2c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Tue, 8 Nov 2016 12:22:26 +0100
Subject: [PATCH] lavf/mpegtsenc: Automatically insert dump_extra for asp
 muxing.

---
 libavformat/mpegtsenc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 8, 2016, 12:05 p.m. UTC | #1
On Tue, Nov 08, 2016 at 12:25:00PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch allows automatic insertion of dump_extra when 
> remuxing mpeg4 asp.
> 
> Please comment, Carl Eugen

>  mpegtsenc.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 071687a7d12bb9b78df360193b991c01677ba8c1  0001-lavf-mpegtsenc-Automatically-insert-dump_extra-for-a.patch
> From 8ff75d4fa9127f3f02dde9408795f27c8d0e9c2c Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> Date: Tue, 8 Nov 2016 12:22:26 +0100
> Subject: [PATCH] lavf/mpegtsenc: Automatically insert dump_extra for asp
>  muxing.
> 
> ---
>  libavformat/mpegtsenc.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 71a6642..9e98fd2 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -28,6 +28,7 @@
>  #include "libavutil/opt.h"
>  
>  #include "libavcodec/internal.h"
> +#include "libavcodec/mpeg4video.h"
>  
>  #include "avformat.h"
>  #include "avio_internal.h"
> @@ -1823,8 +1824,12 @@ static int mpegts_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt
>                                (st->codecpar->extradata_size > 0 &&
>                                 st->codecpar->extradata[0] == 1)))
>              ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
> +    } else if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
> +        if (pkt->size >= 5 && AV_RB32(pkt->data) != VOS_STARTCODE &&
> +                              st->codecpar->extradata_size >= 5 &&
> +                              AV_RB32(st->codecpar->extradata) == VOS_STARTCODE)

this should search both for the startcode and not use fixed locations

[...]
Fredrik Persson Nov. 8, 2016, 5:48 p.m. UTC | #2
I will try this, thank you very much!

/Fredrik Persson

On Tue, Nov 8, 2016 at 1:05 PM, Michael Niedermayer <michael@niedermayer.cc>
wrote:

> On Tue, Nov 08, 2016 at 12:25:00PM +0100, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch allows automatic insertion of dump_extra when
> > remuxing mpeg4 asp.
> >
> > Please comment, Carl Eugen
>
> >  mpegtsenc.c |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 071687a7d12bb9b78df360193b991c01677ba8c1  0001-lavf-mpegtsenc-
> Automatically-insert-dump_extra-for-a.patch
> > From 8ff75d4fa9127f3f02dde9408795f27c8d0e9c2c Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> > Date: Tue, 8 Nov 2016 12:22:26 +0100
> > Subject: [PATCH] lavf/mpegtsenc: Automatically insert dump_extra for asp
> >  muxing.
> >
> > ---
> >  libavformat/mpegtsenc.c |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index 71a6642..9e98fd2 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -28,6 +28,7 @@
> >  #include "libavutil/opt.h"
> >
> >  #include "libavcodec/internal.h"
> > +#include "libavcodec/mpeg4video.h"
> >
> >  #include "avformat.h"
> >  #include "avio_internal.h"
> > @@ -1823,8 +1824,12 @@ static int mpegts_check_bitstream(struct
> AVFormatContext *s, const AVPacket *pkt
> >                                (st->codecpar->extradata_size > 0 &&
> >                                 st->codecpar->extradata[0] == 1)))
> >              ret = ff_stream_add_bitstream_filter(st,
> "hevc_mp4toannexb", NULL);
> > +    } else if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
> > +        if (pkt->size >= 5 && AV_RB32(pkt->data) != VOS_STARTCODE &&
> > +                              st->codecpar->extradata_size >= 5 &&
> > +                              AV_RB32(st->codecpar->extradata) ==
> VOS_STARTCODE)
>
> this should search both for the startcode and not use fixed locations
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> During times of universal deceit, telling the truth becomes a
> revolutionary act. -- George Orwell
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
diff mbox

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 71a6642..9e98fd2 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -28,6 +28,7 @@ 
 #include "libavutil/opt.h"
 
 #include "libavcodec/internal.h"
+#include "libavcodec/mpeg4video.h"
 
 #include "avformat.h"
 #include "avio_internal.h"
@@ -1823,8 +1824,12 @@  static int mpegts_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt
                               (st->codecpar->extradata_size > 0 &&
                                st->codecpar->extradata[0] == 1)))
             ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
+    } else if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
+        if (pkt->size >= 5 && AV_RB32(pkt->data) != VOS_STARTCODE &&
+                              st->codecpar->extradata_size >= 5 &&
+                              AV_RB32(st->codecpar->extradata) == VOS_STARTCODE)
+            ret = ff_stream_add_bitstream_filter(st, "dump_extra", NULL);
     }
-
     return ret;
 }