[FFmpeg-devel] [PATCH] Add VorbisComment writing to ogg-vorbis files (bump)
Stefano Sabatini
stefano.sabatini-lala
Wed May 5 01:39:52 CEST 2010
On date Thursday 2010-04-08 15:39:53 +0200, James Darnley encoded:
> On 31 March 2010 00:35, James Darnley <james.darnley at gmail.com> wrote:
> >>As the subject says, the attached patch adds VorbisComment writing to ogg-vorbis files.
> >
> > Perhaps more explaination will garner some attention.
> >
> > The change to ogg_write_vorbiscomment() is because vorbis requires
> > VorbisComments to have the framing bit whereas flac and speex (based
> > on inspection of a file made by speexenc) do not.
> >
> > Any other comments about the way I've done stuff?
> >
>
> New patch attached. Changed due to the recent AVERROR() changes. A
> couple of minor cosmetic changes too.
> From 88c4365f9665cbc5bf57133d3feb159669b973fc Mon Sep 17 00:00:00 2001
> From: James Darnley <james.darnley at gmail.com>
> Date: Thu, 8 Apr 2010 15:19:23 +0200
> Subject: [PATCH] Add VorbisComment writing to ogg-vorbis files
>
> ---
> libavformat/oggenc.c | 41 +++++++++++++++++++++++++++++++++++++----
> 1 files changed, 37 insertions(+), 4 deletions(-)
[...]
> +static int ogg_build_vorbis_headers(AVCodecContext *avctx,
> + OGGStreamContext *oggstream, int bitexact,
> + AVMetadata *m)
> +{
> + int ret;
> + uint8_t *p;
> +
> + ret = ff_split_xiph_headers(avctx->extradata, avctx->extradata_size,
> + 30, oggstream->header, oggstream->header_len);
> + if (ret)
> + return -1;
return ret;
> + p = ogg_write_vorbiscomment(7, bitexact, &oggstream->header_len[1], m, 1);
> + if (!p)
> + return AVERROR(ENOMEM);
> + oggstream->header[1] = p;
> + bytestream_put_byte(&p, 3);
> + bytestream_put_buffer(&p, "vorbis", 6);
> +
> + return 0;
> +}
> +
> static int ogg_write_header(AVFormatContext *s)
> {
> OGGStreamContext *oggstream;
> @@ -214,6 +238,15 @@ static int ogg_write_header(AVFormatContext *s)
> av_freep(&st->priv_data);
> return err;
> }
> + } else if (st->codec->codec_id == CODEC_ID_VORBIS) {
> + int err = ogg_build_vorbis_headers(st->codec, oggstream,
> + st->codec->flags & CODEC_FLAG_BITEXACT,
> + s->metadata);
weird align.
> + if (err) {
> + av_log(s, AV_LOG_ERROR, "Error writing Vorbis headers\n");
> + av_freep(&st->priv_data);
> + return err;
> + }
> } else {
> if (ff_split_xiph_headers(st->codec->extradata, st->codec->extradata_size,
> st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42,
> --
> 1.6.1.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
--
FFmpeg = Fierce Frightening Mastering Perennial Erroneous Game
More information about the ffmpeg-devel
mailing list