diff mbox series

[FFmpeg-devel] avformat: add mpegtsraw muxer

Message ID 20201221225857.61712-1-ffmpeg@tmm1.net
State New
Headers show
Series [FFmpeg-devel] avformat: add mpegtsraw muxer
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Aman Karmani Dec. 21, 2020, 10:58 p.m. UTC
From: Aman Karmani <aman@tmm1.net>

Allows easier writing of a AV_CODEC_ID_MPEG2TS stream out to disk.

Signed-off-by: Aman Karmani <aman@tmm1.net>
---
 libavformat/Makefile     |  1 +
 libavformat/allformats.c |  1 +
 libavformat/rawenc.c     | 14 ++++++++++++++
 3 files changed, 16 insertions(+)

Comments

Andreas Rheinhardt Dec. 22, 2020, 12:58 a.m. UTC | #1
Aman Karmani:
> From: Aman Karmani <aman@tmm1.net>
> 
> Allows easier writing of a AV_CODEC_ID_MPEG2TS stream out to disk.
> 
> Signed-off-by: Aman Karmani <aman@tmm1.net>
> ---
>  libavformat/Makefile     |  1 +
>  libavformat/allformats.c |  1 +
>  libavformat/rawenc.c     | 14 ++++++++++++++
>  3 files changed, 16 insertions(+)
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 97d868081b..ad528de589 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -350,6 +350,7 @@ OBJS-$(CONFIG_MPEG2VOB_MUXER)            += mpegenc.o
>  OBJS-$(CONFIG_MPEGPS_DEMUXER)            += mpeg.o
>  OBJS-$(CONFIG_MPEGTS_DEMUXER)            += mpegts.o
>  OBJS-$(CONFIG_MPEGTS_MUXER)              += mpegtsenc.o
> +OBJS-$(CONFIG_MPEGTSRAW_MUXER)           += rawenc.o
>  OBJS-$(CONFIG_MPEGVIDEO_DEMUXER)         += mpegvideodec.o rawdec.o
>  OBJS-$(CONFIG_MPJPEG_DEMUXER)            += mpjpegdec.o
>  OBJS-$(CONFIG_MPJPEG_MUXER)              += mpjpeg.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 0e0caaad39..6106344ba0 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -279,6 +279,7 @@ extern AVInputFormat  ff_mpegps_demuxer;
>  extern AVInputFormat  ff_mpegts_demuxer;
>  extern AVOutputFormat ff_mpegts_muxer;
>  extern AVInputFormat  ff_mpegtsraw_demuxer;
> +extern AVOutputFormat ff_mpegtsraw_muxer;
>  extern AVInputFormat  ff_mpegvideo_demuxer;
>  extern AVInputFormat  ff_mpjpeg_demuxer;
>  extern AVOutputFormat ff_mpjpeg_muxer;
> diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> index 32704f9bfd..38def493cf 100644
> --- a/libavformat/rawenc.c
> +++ b/libavformat/rawenc.c
> @@ -465,6 +465,20 @@ AVOutputFormat ff_mpeg2video_muxer = {
>  };
>  #endif
>  
> +#if CONFIG_MPEGTSRAW_MUXER
> +AVOutputFormat ff_mpegtsraw_muxer = {
> +    .name           = "mpegtsraw",
> +    .long_name      = NULL_IF_CONFIG_SMALL("raw MPEG-TS"),
> +    .mime_type      = "video/MP2T",
> +    .extensions     = "ts,m2t,m2ts,mts",
> +    .audio_codec    = AV_CODEC_ID_NONE,
> +    .video_codec    = AV_CODEC_ID_NONE,
> +    .data_codec     = AV_CODEC_ID_MPEG2TS,
> +    .write_packet   = ff_raw_write_packet,
> +    .flags          = AVFMT_NOTIMESTAMPS,
> +};
> +#endif
> +
>  #if CONFIG_RAWVIDEO_MUXER
>  AVOutputFormat ff_rawvideo_muxer = {
>      .name              = "rawvideo",
> 
Why don't you just use the data muxer instead of adding a new muxer with
the same extensions and mime type as an existing (and preferable) muxer?

- Andreas
Aman Karmani Dec. 22, 2020, 1:03 a.m. UTC | #2
On Mon, Dec 21, 2020 at 4:58 PM Andreas Rheinhardt <
andreas.rheinhardt@gmail.com> wrote:

> Aman Karmani:
> > From: Aman Karmani <aman@tmm1.net>
> >
> > Allows easier writing of a AV_CODEC_ID_MPEG2TS stream out to disk.
> >
> > Signed-off-by: Aman Karmani <aman@tmm1.net>
> > ---
> >  libavformat/Makefile     |  1 +
> >  libavformat/allformats.c |  1 +
> >  libavformat/rawenc.c     | 14 ++++++++++++++
> >  3 files changed, 16 insertions(+)
> >
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index 97d868081b..ad528de589 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -350,6 +350,7 @@ OBJS-$(CONFIG_MPEG2VOB_MUXER)            += mpegenc.o
> >  OBJS-$(CONFIG_MPEGPS_DEMUXER)            += mpeg.o
> >  OBJS-$(CONFIG_MPEGTS_DEMUXER)            += mpegts.o
> >  OBJS-$(CONFIG_MPEGTS_MUXER)              += mpegtsenc.o
> > +OBJS-$(CONFIG_MPEGTSRAW_MUXER)           += rawenc.o
> >  OBJS-$(CONFIG_MPEGVIDEO_DEMUXER)         += mpegvideodec.o rawdec.o
> >  OBJS-$(CONFIG_MPJPEG_DEMUXER)            += mpjpegdec.o
> >  OBJS-$(CONFIG_MPJPEG_MUXER)              += mpjpeg.o
> > diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> > index 0e0caaad39..6106344ba0 100644
> > --- a/libavformat/allformats.c
> > +++ b/libavformat/allformats.c
> > @@ -279,6 +279,7 @@ extern AVInputFormat  ff_mpegps_demuxer;
> >  extern AVInputFormat  ff_mpegts_demuxer;
> >  extern AVOutputFormat ff_mpegts_muxer;
> >  extern AVInputFormat  ff_mpegtsraw_demuxer;
> > +extern AVOutputFormat ff_mpegtsraw_muxer;
> >  extern AVInputFormat  ff_mpegvideo_demuxer;
> >  extern AVInputFormat  ff_mpjpeg_demuxer;
> >  extern AVOutputFormat ff_mpjpeg_muxer;
> > diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> > index 32704f9bfd..38def493cf 100644
> > --- a/libavformat/rawenc.c
> > +++ b/libavformat/rawenc.c
> > @@ -465,6 +465,20 @@ AVOutputFormat ff_mpeg2video_muxer = {
> >  };
> >  #endif
> >
> > +#if CONFIG_MPEGTSRAW_MUXER
> > +AVOutputFormat ff_mpegtsraw_muxer = {
> > +    .name           = "mpegtsraw",
> > +    .long_name      = NULL_IF_CONFIG_SMALL("raw MPEG-TS"),
> > +    .mime_type      = "video/MP2T",
> > +    .extensions     = "ts,m2t,m2ts,mts",
> > +    .audio_codec    = AV_CODEC_ID_NONE,
> > +    .video_codec    = AV_CODEC_ID_NONE,
> > +    .data_codec     = AV_CODEC_ID_MPEG2TS,
> > +    .write_packet   = ff_raw_write_packet,
> > +    .flags          = AVFMT_NOTIMESTAMPS,
> > +};
> > +#endif
> > +
> >  #if CONFIG_RAWVIDEO_MUXER
> >  AVOutputFormat ff_rawvideo_muxer = {
> >      .name              = "rawvideo",
> >
> Why don't you just use the data muxer instead of adding a new muxer with
> the same extensions and mime type as an existing (and preferable) muxer?
>

I missed the generic data muxer, thanks for pointing it out. Please
disregard this patch.

Aman


> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 97d868081b..ad528de589 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -350,6 +350,7 @@  OBJS-$(CONFIG_MPEG2VOB_MUXER)            += mpegenc.o
 OBJS-$(CONFIG_MPEGPS_DEMUXER)            += mpeg.o
 OBJS-$(CONFIG_MPEGTS_DEMUXER)            += mpegts.o
 OBJS-$(CONFIG_MPEGTS_MUXER)              += mpegtsenc.o
+OBJS-$(CONFIG_MPEGTSRAW_MUXER)           += rawenc.o
 OBJS-$(CONFIG_MPEGVIDEO_DEMUXER)         += mpegvideodec.o rawdec.o
 OBJS-$(CONFIG_MPJPEG_DEMUXER)            += mpjpegdec.o
 OBJS-$(CONFIG_MPJPEG_MUXER)              += mpjpeg.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0e0caaad39..6106344ba0 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -279,6 +279,7 @@  extern AVInputFormat  ff_mpegps_demuxer;
 extern AVInputFormat  ff_mpegts_demuxer;
 extern AVOutputFormat ff_mpegts_muxer;
 extern AVInputFormat  ff_mpegtsraw_demuxer;
+extern AVOutputFormat ff_mpegtsraw_muxer;
 extern AVInputFormat  ff_mpegvideo_demuxer;
 extern AVInputFormat  ff_mpjpeg_demuxer;
 extern AVOutputFormat ff_mpjpeg_muxer;
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 32704f9bfd..38def493cf 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -465,6 +465,20 @@  AVOutputFormat ff_mpeg2video_muxer = {
 };
 #endif
 
+#if CONFIG_MPEGTSRAW_MUXER
+AVOutputFormat ff_mpegtsraw_muxer = {
+    .name           = "mpegtsraw",
+    .long_name      = NULL_IF_CONFIG_SMALL("raw MPEG-TS"),
+    .mime_type      = "video/MP2T",
+    .extensions     = "ts,m2t,m2ts,mts",
+    .audio_codec    = AV_CODEC_ID_NONE,
+    .video_codec    = AV_CODEC_ID_NONE,
+    .data_codec     = AV_CODEC_ID_MPEG2TS,
+    .write_packet   = ff_raw_write_packet,
+    .flags          = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_RAWVIDEO_MUXER
 AVOutputFormat ff_rawvideo_muxer = {
     .name              = "rawvideo",