[FFmpeg-devel] [PATCH] avformat/movenc: add EAC3 muxing support.
Benoit Fouet
benoit.fouet at free.fr
Fri Oct 3 09:38:02 CEST 2014
Hi,
----- Mail original -----
> 2014-10-02 19:39 GMT+09:00 Benoit Fouet <benoit.fouet at free.fr>:
>
[...]
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index bfee866..62b2d4b 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -31,6 +31,7 @@
> > #include "avio.h"
> > #include "isom.h"
> > #include "avc.h"
> > +#include "libavcodec/ac3_parser.h"
> > #include "libavcodec/get_bits.h"
> > #include "libavcodec/put_bits.h"
> > #include "libavcodec/vc1_common.h"
> > @@ -292,6 +293,40 @@ static int mov_write_ac3_tag(AVIOContext *pb,
> > MOVTrack *track)
> > return 11;
> > }
> >
> > +static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
> > +{
> > + GetBitContext gbc;
> > + PutBitContext pbc;
> > + uint8_t buf[5];
> > + AC3HeaderInfo tmp, *hdr = &tmp;
> > +
> > + if (!track->vos_len)
> > + return -1;
> > +
> > + init_get_bits(&gbc, track->vos_data, track->vos_len * 8);
> > + if (avpriv_ac3_parse_header2(&gbc, &hdr) != 0)
> > + return -1;
> > +
> > + avio_wb32(pb, 13);
> > + ffio_wfourcc(pb, "dec3");
> > +
> > + init_put_bits(&pbc, buf, sizeof(buf));
> > + put_bits(&pbc, 13, hdr->bit_rate);
> > + put_bits(&pbc, 3, 0); /* consider there is only one
> > independent
> > substream present */
> > + put_bits(&pbc, 2, hdr->sr_code);
> > + put_bits(&pbc, 5, hdr->bitstream_id);
> > + put_bits(&pbc, 5, hdr->bitstream_mode);
> > + put_bits(&pbc, 3, hdr->channel_mode);
> > + put_bits(&pbc, 1, hdr->lfe_on);
> > + put_bits(&pbc, 5, 0); /* reserved */
> > + put_bits(&pbc, 4, 0); /* no dependent substream */
> >
>
> I tested this patch for a 7.1ch source (requires dependent stream(s))
> and I
> get the result containing improper settings here.
> Please set properly here. Or reject streams requiring dependent
> streams.
>
Do you have a sample you can share?
I don't have any material to test this.
> Sorry, multiple and consecutive posts.
> But I found another issue in this patch.
> This patch does not pack syncframes into a sample in order to pack 6 blocks.
> The spec requires a sample consists of 6 blocks to make samle_delta in stts
> equal to 1536.
>
I'll have a look at that too.
Thanks
--
Ben
More information about the ffmpeg-devel
mailing list