[FFmpeg-devel] [PATCH 3/3] lavf/movenc: add faststart option.
Clément Bœsch
ubitux at gmail.com
Thu Sep 27 09:01:18 CEST 2012
On Wed, Sep 26, 2012 at 05:45:56PM +0200, Clément Bœsch wrote:
> On Mon, Sep 24, 2012 at 09:58:07AM +0200, Clément Bœsch wrote:
> > On Sun, Sep 23, 2012 at 03:55:10AM +0200, Michael Niedermayer wrote:
> > > On Thu, Sep 20, 2012 at 10:47:20AM +0200, Clément Bœsch wrote:
> > > > From: Clément Bœsch <clement.boesch at smartjog.com>
> > > >
> > > > ---
> > > > libavformat/movenc.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++---
> > > > libavformat/movenc.h | 3 +-
> > > > 2 files changed, 121 insertions(+), 7 deletions(-)
> > >
> > > this will need a fate test
> > >
> >
> > Added a commit on top of the patch set, see attached.
> >
> > >
> > > [...]
> > > > +static int shift_data(AVFormatContext *s)
> > > > +{
> > > > + int ret, moov_size;
> > > > + MOVMuxContext *mov = s->priv_data;
> > > > + int64_t pos, pos_end = avio_tell(s->pb);
> > > > + uint8_t *buf, *read_buf[2];
> > > > + int read_buf_id = 0;
> > > > + int read_size[2];
> > > > + AVIOContext *read_pb;
> > > > +
> > > > + moov_size = compute_moov_size(s);
> > > > + if (moov_size < 0)
> > > > + return moov_size;
> > > > +
> > > > + buf = av_malloc(moov_size * 2);
> > > > + if (!buf)
> > > > + return AVERROR(ENOMEM);
> > > > + read_buf[0] = buf;
> > > > + read_buf[1] = buf + moov_size;
> > > > +
> > > > + /* Shift the data: the AVIO context of the output can only be used for
> > > > + * writing, so we re-open the same output, but for reading. It also avoids
> > > > + * a read/seek/write/seek back and forth. */
> > > > + avio_flush(s->pb);
> > > > + ret = avio_open(&read_pb, s->filename, AVIO_FLAG_READ);
> > > > + if (ret < 0) {
> > > > + av_log(s, AV_LOG_ERROR, "Unable to re-open %s output file for "
> > > > + "the second pass (faststart)\n", s->filename);
> > > > + return ret;
> > > > + }
> > >
> > > memleak (buf)
> > >
> >
> > Fixed.
> >
> > > otherwise things look nice from a quick look
> > >
> >
> > I'll give 3 days before pushing unless you want that feature in 0.12.
> >
> [...]
>
> I'll push the patch set tomorrow if I see no other comment.
>
Applied.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120927/513c34e6/attachment.asc>
More information about the ffmpeg-devel
mailing list