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",
144 return (granule>>oggstream->
kfgshift) +
145 (granule & ((1<<oggstream->
kfgshift)-1));
154 int64_t next_granule, cur_granule;
163 return next_granule > cur_granule;
206 int total_segments = size / 255 + 1;
225 if (!header && oggstream->
page.
size > 0 &&
230 for (i = 0; i < total_segments; ) {
241 len =
FFMIN(size, segments*255);
243 memcpy(page->
data+page->
size, p, len);
249 if (i == total_segments)
292 bytestream_put_byte(&p, 1);
315 bytestream_put_byte(&p, 0x7F);
317 bytestream_put_byte(&p, 1);
318 bytestream_put_byte(&p, 0);
319 bytestream_put_be16(&p, 1);
321 bytestream_put_byte(&p, 0x00);
322 bytestream_put_be24(&p, 34);
330 bytestream_put_byte(&p, 0x84);
331 bytestream_put_be24(&p, oggstream->
header_len[1] - 4);
336 #define SPEEX_HEADER_SIZE 80
365 #define OPUS_HEADER_SIZE 19
408 flush == 1 && oggstream->
page_count == 1 ? 4 : 0);
427 unsigned serial_num = i;
459 for (j = 0; j < i; j++) {
518 bytestream_put_byte(&p, header_type);
542 for (i = 1; i < 3; i++) {
571 if (pframe_count >= (1<<oggstream->
kfgshift)) {
582 oggstream->page.start_granule =
pkt->
pts;
590 oggstream->last_granule = granule;
641 static const AVClass ogg_muxer_class = {
651 .mime_type =
"application/ogg",
652 .extensions =
"ogg,ogv"
653 #if !CONFIG_SPEEX_MUXER
656 #if !CONFIG_OPUS_MUXER
661 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
668 .priv_class = &ogg_muxer_class,
673 static const AVClass oga_muxer_class = {
683 .mime_type =
"audio/ogg",
692 .priv_class = &oga_muxer_class,
696 #if CONFIG_SPEEX_MUXER
697 static const AVClass speex_muxer_class = {
707 .mime_type =
"audio/ogg",
716 .priv_class = &speex_muxer_class,
720 #if CONFIG_OPUS_MUXER
721 static const AVClass opus_muxer_class = {
731 .mime_type =
"audio/ogg",
732 .extensions =
"opus",
740 .priv_class = &opus_muxer_class,