Commit 9bacb576 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f726fc21'

* commit 'f726fc21':
  ogg: Provide an option to offset the serial number

Conflicts:
	libavformat/oggenc.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 021c0c5f f726fc21
...@@ -806,6 +806,11 @@ is 1 second. A value of 0 will fill all segments, making pages as large as ...@@ -806,6 +806,11 @@ is 1 second. A value of 0 will fill all segments, making pages as large as
possible. A value of 1 will effectively use 1 packet-per-page in most possible. A value of 1 will effectively use 1 packet-per-page in most
situations, giving a small seek granularity at the cost of additional container situations, giving a small seek granularity at the cost of additional container
overhead. overhead.
@item -serial_offset @var{value}
Serial value from which to set the streams serial number.
Setting it to different and sufficiently large values ensures that the produced
ogg files can be safely chained.
@end table @end table
@anchor{segment} @anchor{segment}
......
...@@ -71,12 +71,15 @@ typedef struct { ...@@ -71,12 +71,15 @@ typedef struct {
OGGPageList *page_list; OGGPageList *page_list;
int pref_size; ///< preferred page size (0 => fill all segments) int pref_size; ///< preferred page size (0 => fill all segments)
int64_t pref_duration; ///< preferred page duration (0 => fill all segments) int64_t pref_duration; ///< preferred page duration (0 => fill all segments)
int serial_offset;
} OGGContext; } OGGContext;
#define OFFSET(x) offsetof(OGGContext, x) #define OFFSET(x) offsetof(OGGContext, x)
#define PARAM AV_OPT_FLAG_ENCODING_PARAM #define PARAM AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = { static const AVOption options[] = {
{ "serial_offset", "serial number offset",
OFFSET(serial_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, PARAM },
{ "oggpagesize", "Set preferred Ogg page size.", { "oggpagesize", "Set preferred Ogg page size.",
offsetof(OGGContext, pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM}, offsetof(OGGContext, pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM},
{ "pagesize", "preferred page size in bytes (deprecated)", { "pagesize", "preferred page size in bytes (deprecated)",
...@@ -430,7 +433,7 @@ static int ogg_write_header(AVFormatContext *s) ...@@ -430,7 +433,7 @@ static int ogg_write_header(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i]; AVStream *st = s->streams[i];
unsigned serial_num = i; unsigned serial_num = i + ogg->serial_offset;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if (st->codec->codec_id == AV_CODEC_ID_OPUS) if (st->codec->codec_id == AV_CODEC_ID_OPUS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment