36 #define MAX_PAGE_SIZE 65025
77 #define OFFSET(x) offsetof(OGGContext, x)
78 #define PARAM AV_OPT_FLAG_ENCODING_PARAM
81 {
"serial_offset",
"serial number offset",
83 {
"oggpagesize",
"Set preferred Ogg page size.",
85 {
"pagesize",
"preferred page size in bytes (deprecated)",
87 {
"page_duration",
"preferred page duration, in microseconds",
92 #define OGG_CLASS(flavor, name)\
93 static const AVClass flavor ## _muxer_class = {\
94 .class_name = #name " muxer",\
95 .item_name = av_default_item_name,\
97 .version = LIBAVUTIL_VERSION_INT,\
155 return (granule>>oggstream->
kfgshift) +
156 (granule & ((1<<oggstream->
kfgshift)-1));
165 int64_t next_granule, cur_granule;
174 return next_granule > cur_granule;
217 int total_segments = size / 255 + 1;
236 if (!header && oggstream->
page.
size > 0 &&
241 for (i = 0; i < total_segments; ) {
252 len =
FFMIN(size, segments*255);
254 memcpy(page->
data+page->
size, p, len);
260 if (i == total_segments)
303 bytestream_put_byte(&p, 1);
324 bytestream_put_byte(&p, 0x7F);
326 bytestream_put_byte(&p, 1);
327 bytestream_put_byte(&p, 0);
328 bytestream_put_be16(&p, 1);
330 bytestream_put_byte(&p, 0x00);
331 bytestream_put_be24(&p, 34);
339 bytestream_put_byte(&p, 0x84);
340 bytestream_put_be24(&p, oggstream->
header_len[1] - 4);
345 #define SPEEX_HEADER_SIZE 80
374 #define OPUS_HEADER_SIZE 19
417 flush == 1 && oggstream->
page_count == 1 ? 4 : 0);
468 for (j = 0; j < i; j++) {
527 bytestream_put_byte(&p, header_type);
551 for (i = 1; i < 3; i++) {
580 if (pframe_count >= (1<<oggstream->
kfgshift)) {
594 oggstream->page.start_granule =
pkt->
pts;
602 oggstream->last_granule = granule;
657 .mime_type =
"application/ogg",
658 .extensions =
"ogg,ogv"
659 #if !CONFIG_SPX_MUXER
662 #if !CONFIG_OPUS_MUXER
667 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
674 .priv_class = &ogg_muxer_class,
683 .mime_type =
"audio/ogg",
686 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
692 .priv_class = &oga_muxer_class,
701 .mime_type =
"audio/ogg",
709 .priv_class = &spx_muxer_class,
713 #if CONFIG_OPUS_MUXER
718 .mime_type =
"audio/ogg",
719 .extensions =
"opus",
726 .priv_class = &opus_muxer_class,