[FFmpeg-devel] [PATCH 6/9] sbc: add raw muxer for SBC

Aurelien Jacobs aurel at gnuage.org
Tue Dec 26 18:54:39 EET 2017


On Mon, Dec 25, 2017 at 12:43:18PM +0000, Rostislav Pehlivanov wrote:
> On 23 December 2017 at 18:01, Aurelien Jacobs <aurel at gnuage.org> wrote:
>
> > ---
> >  doc/general.texi         |  2 +-
> >  libavformat/Makefile     |  2 ++
> >  libavformat/allformats.c |  4 ++--
> >  libavformat/rawenc.c     | 28 ++++++++++++++++++++++++++++
> >  4 files changed, 33 insertions(+), 3 deletions(-)
> >
> > diff --git a/doc/general.texi b/doc/general.texi
> > index e5669b0e93..560465a4b8 100644
> > --- a/doc/general.texi
> > +++ b/doc/general.texi
> > @@ -466,7 +466,7 @@ library:
> >  @item raw NULL                  @tab X @tab
> >  @item raw video                 @tab X @tab X
> >  @item raw id RoQ                @tab X @tab
> > - at item raw SBC                   @tab   @tab X
> > + at item raw SBC                   @tab X @tab X
> >  @item raw Shorten               @tab   @tab X
> >  @item raw TAK                   @tab   @tab X
> >  @item raw TrueHD                @tab X @tab X
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index 6270c28a8a..689fc6b23f 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -448,7 +448,9 @@ OBJS-$(CONFIG_SAMI_DEMUXER)              += samidec.o
> > subtitles.o
> >  OBJS-$(CONFIG_SAP_DEMUXER)               += sapdec.o
> >  OBJS-$(CONFIG_SAP_MUXER)                 += sapenc.o
> >  OBJS-$(CONFIG_SBC_DEMUXER)               += sbcdec.o rawdec.o
> > +OBJS-$(CONFIG_SBC_MUXER)                 += rawenc.o
> >  OBJS-$(CONFIG_MSBC_DEMUXER)              += sbcdec.o rawdec.o
> > +OBJS-$(CONFIG_MSBC_MUXER)                += rawenc.o
> >  OBJS-$(CONFIG_SBG_DEMUXER)               += sbgdec.o
> >  OBJS-$(CONFIG_SCC_DEMUXER)               += sccdec.o subtitles.o
> >  OBJS-$(CONFIG_SCC_MUXER)                 += sccenc.o subtitles.o
> > diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> > index a6b72715bd..eb1d17d38c 100644
> > --- a/libavformat/allformats.c
> > +++ b/libavformat/allformats.c
> > @@ -211,7 +211,7 @@ static void register_all(void)
> >      REGISTER_MUXDEMUX(MPJPEG,           mpjpeg);
> >      REGISTER_DEMUXER (MPL2,             mpl2);
> >      REGISTER_DEMUXER (MPSUB,            mpsub);
> > -    REGISTER_DEMUXER (MSBC,             msbc);
> > +    REGISTER_MUXDEMUX(MSBC,             msbc);
> >      REGISTER_DEMUXER (MSF,              msf);
> >      REGISTER_DEMUXER (MSNWC_TCP,        msnwc_tcp);
> >      REGISTER_DEMUXER (MTAF,             mtaf);
> > @@ -278,7 +278,7 @@ static void register_all(void)
> >      REGISTER_DEMUXER (S337M,            s337m);
> >      REGISTER_DEMUXER (SAMI,             sami);
> >      REGISTER_MUXDEMUX(SAP,              sap);
> > -    REGISTER_DEMUXER (SBC,              sbc);
> > +    REGISTER_MUXDEMUX(SBC,              sbc);
> >      REGISTER_DEMUXER (SBG,              sbg);
> >      REGISTER_MUXDEMUX(SCC,              scc);
> >      REGISTER_DEMUXER (SDP,              sdp);
> > diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> > index aa3ef76fbf..e27b280014 100644
> > --- a/libavformat/rawenc.c
> > +++ b/libavformat/rawenc.c
> > @@ -426,6 +426,34 @@ AVOutputFormat ff_rawvideo_muxer = {
> >  };
> >  #endif
> >
> > +#if CONFIG_SBC_MUXER
> > +AVOutputFormat ff_sbc_muxer = {
> > +    .name              = "sbc",
> > +    .long_name         = NULL_IF_CONFIG_SMALL("raw SBC"),
> > +    .mime_type         = "audio/x-sbc",
> > +    .extensions        = "sbc",
> > +    .audio_codec       = AV_CODEC_ID_SBC,
> > +    .video_codec       = AV_CODEC_ID_NONE,
> > +    .write_header      = force_one_stream,
> > +    .write_packet      = ff_raw_write_packet,
> > +    .flags             = AVFMT_NOTIMESTAMPS,
> > +};
> > +#endif
> > +
> > +#if CONFIG_MSBC_MUXER
> > +AVOutputFormat ff_msbc_muxer = {
> > +    .name              = "msbc",
> > +    .long_name         = NULL_IF_CONFIG_SMALL("raw mSBC"),
> > +    .mime_type         = "audio/x-msbc",
> > +    .extensions        = "msbc",
> > +    .audio_codec       = AV_CODEC_ID_MSBC,
> > +    .video_codec       = AV_CODEC_ID_NONE,
> > +    .write_header      = force_one_stream,
> > +    .write_packet      = ff_raw_write_packet,
> > +    .flags             = AVFMT_NOTIMESTAMPS,
> > +};
> > +#endif
> > +
> >  #if CONFIG_TRUEHD_MUXER
> >  AVOutputFormat ff_truehd_muxer = {
> >      .name              = "truehd",
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
>
> What happened with the profiles idea? Are the 2 variants different enough
> to need 2 CODEC_IDs?

Repeating what I wrote in the other thread:

SBC support various samplerates while mSBC is limited to 16 kHz.
I think the only way to declare this properly and to get automatic
conversion to 16 kHz when encoding to mSBC is to have 2 separate
codec ID.


More information about the ffmpeg-devel mailing list