diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-01 00:36:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-01 00:36:43 +0200 |
commit | 2f7bd3b5162c240e62c11cf0373342fa89f26c8f (patch) | |
tree | 1d0f0aeb6b2c6acc811f11eca9fbeb16c451ea2c /libavformat/oggenc.c | |
parent | 5216245a2c5ed8140d99f14fcc148fbb6db9831e (diff) | |
parent | 420d1df2e2a857eae45fa947e16eae7494793d57 (diff) | |
download | ffmpeg-2f7bd3b5162c240e62c11cf0373342fa89f26c8f.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
apedec: check bits <= 32.
cavs: Remove unused code.
oggenc: fix condition when not to flush due to keyframe granule.
oggenc: add pagesize option to set preferred page size
libspeexdec: set frame size in libspeex_decode_init()
smacker audio: sign-extend the initial 16-bit predicted value
Conflicts:
libavcodec/apedec.c
libavcodec/libspeexdec.c
libavformat/oggenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggenc.c')
-rw-r--r-- | libavformat/oggenc.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 05b4b25a71..b787d1b26c 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -22,6 +22,7 @@ #include "libavutil/crc.h" #include "libavutil/opt.h" #include "libavutil/mathematics.h" +#include "libavutil/opt.h" #include "libavutil/random_seed.h" #include "libavcodec/xiph.h" #include "libavcodec/bytestream.h" @@ -69,18 +70,22 @@ typedef struct { int pref_size; ///< preferred page size (0 => fill all segments) } OGGContext; +#define OFFSET(x) offsetof(OGGContext, x) +#define PARAM AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { { "oggpagesize", "Set preferred Ogg page size.", offsetof(OGGContext, pref_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM}, + { "pagesize", "preferred page size in bytes", + OFFSET(pref_size), AV_OPT_TYPE_INT, { 0 }, 0, MAX_PAGE_SIZE, PARAM }, { NULL }, }; static const AVClass ogg_muxer_class = { - "Ogg muxer", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, + .class_name = "Ogg muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, }; @@ -209,8 +214,7 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st, // them as such, otherwise seeking will not work correctly at the very // least with old libogg versions. // Do not try to flush header packets though, that will create broken files. - if (st->codec->codec_id == CODEC_ID_THEORA && - !header && + if (st->codec->codec_id == CODEC_ID_THEORA && !header && (ogg_granule_to_timestamp(oggstream, granule) > ogg_granule_to_timestamp(oggstream, oggstream->last_granule) + 1 || ogg_key_granule(oggstream, granule))) { @@ -241,8 +245,8 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st, if (i == total_segments) page->granule = granule; - if(page->segments_count == 255 || - (ogg->pref_size > 0 && page->size >= ogg->pref_size)) { + if (!header && (page->segments_count == 255 || + (ogg->pref_size > 0 && page->size >= ogg->pref_size))) { ogg_buffer_page(s, oggstream); } } @@ -547,5 +551,5 @@ AVOutputFormat ff_ogg_muxer = { .write_header = ogg_write_header, .write_packet = ogg_write_packet, .write_trailer = ogg_write_trailer, - .priv_class = &ogg_muxer_class, + .priv_class = &ogg_muxer_class, }; |