36 #define MAX_PAGE_SIZE 65025
76 #define OFFSET(x) offsetof(OGGContext, x)
77 #define PARAM AV_OPT_FLAG_ENCODING_PARAM
80 {
"oggpagesize",
"Set preferred Ogg page size.",
82 {
"pagesize",
"preferred page size in bytes (deprecated)",
84 {
"page_duration",
"preferred page duration, in microseconds",
89 #define OGG_CLASS(flavor, name)\
90 static const AVClass flavor ## _muxer_class = {\
91 .class_name = #name " muxer",\
92 .item_name = av_default_item_name,\
94 .version = LIBAVUTIL_VERSION_INT,\
152 return (granule>>oggstream->
kfgshift) +
153 (granule & ((1<<oggstream->
kfgshift)-1));
162 int64_t next_granule, cur_granule;
171 return next_granule > cur_granule;
214 int total_segments = size / 255 + 1;
233 if (!header && oggstream->
page.
size > 0 &&
238 for (i = 0; i < total_segments; ) {
249 len =
FFMIN(size, segments*255);
251 memcpy(page->
data+page->
size, p, len);
257 if (i == total_segments)
300 bytestream_put_byte(&p, 1);
323 bytestream_put_byte(&p, 0x7F);
325 bytestream_put_byte(&p, 1);
326 bytestream_put_byte(&p, 0);
327 bytestream_put_be16(&p, 1);
329 bytestream_put_byte(&p, 0x00);
330 bytestream_put_be24(&p, 34);
338 bytestream_put_byte(&p, 0x84);
339 bytestream_put_be24(&p, oggstream->
header_len[1] - 4);
344 #define SPEEX_HEADER_SIZE 80
373 #define OPUS_HEADER_SIZE 19
416 flush == 1 && oggstream->
page_count == 1 ? 4 : 0);
435 unsigned serial_num = i;
467 for (j = 0; j < i; j++) {
526 bytestream_put_byte(&p, header_type);
550 for (i = 1; i < 3; i++) {
579 if (pframe_count >= (1<<oggstream->
kfgshift)) {
590 oggstream->page.start_granule =
pkt->
pts;
598 oggstream->last_granule = granule;
653 .mime_type =
"application/ogg",
654 .extensions =
"ogg,ogv"
655 #if !CONFIG_SPX_MUXER
658 #if !CONFIG_OPUS_MUXER
663 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
670 .priv_class = &ogg_muxer_class,
679 .mime_type =
"audio/ogg",
682 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
688 .priv_class = &oga_muxer_class,
697 .mime_type =
"audio/ogg",
705 .priv_class = &spx_muxer_class,
709 #if CONFIG_OPUS_MUXER
714 .mime_type =
"audio/ogg",
715 .extensions =
"opus",
722 .priv_class = &opus_muxer_class,