FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
oggenc.c
Go to the documentation of this file.
1 /*
2  * Ogg muxer
3  * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at free dot fr>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include <stdint.h>
23 
24 #include "libavutil/crc.h"
25 #include "libavutil/mathematics.h"
26 #include "libavutil/opt.h"
27 #include "libavutil/random_seed.h"
28 #include "libavcodec/xiph.h"
29 #include "libavcodec/bytestream.h"
30 #include "libavcodec/flac.h"
31 #include "avformat.h"
32 #include "avio_internal.h"
33 #include "internal.h"
34 #include "vorbiscomment.h"
35 
36 #define MAX_PAGE_SIZE 65025
37 
38 typedef struct OGGPage {
39  int64_t start_granule;
40  int64_t granule;
46  uint16_t size;
47 } OGGPage;
48 
49 typedef struct OGGStreamContext {
50  unsigned page_counter;
52  int header_len[3];
53  /** for theora granule */
54  int kfgshift;
55  int64_t last_kf_pts;
56  int vrev;
57  int eos;
58  unsigned page_count; ///< number of page buffered
59  OGGPage page; ///< current page
60  unsigned serial_num; ///< serial number
61  int64_t last_granule; ///< last packet granule
63 
64 typedef struct OGGPageList {
66  struct OGGPageList *next;
67 } OGGPageList;
68 
69 typedef struct OGGContext {
70  const AVClass *class;
72  int pref_size; ///< preferred page size (0 => fill all segments)
73  int64_t pref_duration; ///< preferred page duration (0 => fill all segments)
75 } OGGContext;
76 
77 #define OFFSET(x) offsetof(OGGContext, x)
78 #define PARAM AV_OPT_FLAG_ENCODING_PARAM
79 
80 static const AVOption options[] = {
81  { "serial_offset", "serial number offset",
82  OFFSET(serial_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, PARAM },
83  { "oggpagesize", "Set preferred Ogg page size.",
84  OFFSET(pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, PARAM},
85  { "pagesize", "preferred page size in bytes (deprecated)",
86  OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM },
87  { "page_duration", "preferred page duration, in microseconds",
88  OFFSET(pref_duration), AV_OPT_TYPE_INT64, { .i64 = 1000000 }, 0, INT64_MAX, PARAM },
89  { NULL },
90 };
91 
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,\
96  .option = options,\
97  .version = LIBAVUTIL_VERSION_INT,\
98 };
99 
100 static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
101 {
102  int64_t pos = avio_tell(pb);
103  uint32_t checksum = ffio_get_checksum(pb);
104  avio_seek(pb, crc_offset, SEEK_SET);
105  avio_wb32(pb, checksum);
106  avio_seek(pb, pos, SEEK_SET);
107 }
108 
109 static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
110 {
111  OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data;
112  AVIOContext *pb;
113  int64_t crc_offset;
114  int ret, size;
115  uint8_t *buf;
116 
117  ret = avio_open_dyn_buf(&pb);
118  if (ret < 0)
119  return ret;
121  ffio_wfourcc(pb, "OggS");
122  avio_w8(pb, 0);
123  avio_w8(pb, page->flags | extra_flags);
124  avio_wl64(pb, page->granule);
125  avio_wl32(pb, oggstream->serial_num);
126  avio_wl32(pb, oggstream->page_counter++);
127  crc_offset = avio_tell(pb);
128  avio_wl32(pb, 0); // crc
129  avio_w8(pb, page->segments_count);
130  avio_write(pb, page->segments, page->segments_count);
131  avio_write(pb, page->data, page->size);
132 
133  ogg_update_checksum(s, pb, crc_offset);
134  avio_flush(pb);
135 
136  size = avio_close_dyn_buf(pb, &buf);
137  if (size < 0)
138  return size;
139 
140  avio_write(s->pb, buf, size);
141  avio_flush(s->pb);
142  av_free(buf);
143  oggstream->page_count--;
144  return 0;
145 }
146 
147 static int ogg_key_granule(OGGStreamContext *oggstream, int64_t granule)
148 {
149  return oggstream->kfgshift && !(granule & ((1<<oggstream->kfgshift)-1));
150 }
151 
152 static int64_t ogg_granule_to_timestamp(OGGStreamContext *oggstream, int64_t granule)
153 {
154  if (oggstream->kfgshift)
155  return (granule>>oggstream->kfgshift) +
156  (granule & ((1<<oggstream->kfgshift)-1));
157  else
158  return granule;
159 }
160 
162 {
163  AVStream *st2 = s->streams[next->stream_index];
164  AVStream *st = s->streams[page->stream_index];
165  int64_t next_granule, cur_granule;
166 
167  if (next->granule == -1 || page->granule == -1)
168  return 0;
169 
170  next_granule = av_rescale_q(ogg_granule_to_timestamp(st2->priv_data, next->granule),
171  st2->time_base, AV_TIME_BASE_Q);
172  cur_granule = av_rescale_q(ogg_granule_to_timestamp(st->priv_data, page->granule),
173  st ->time_base, AV_TIME_BASE_Q);
174  return next_granule > cur_granule;
175 }
176 
177 static int ogg_reset_cur_page(OGGStreamContext *oggstream)
178 {
179  oggstream->page.granule = -1;
180  oggstream->page.flags = 0;
181  oggstream->page.segments_count = 0;
182  oggstream->page.size = 0;
183  return 0;
184 }
185 
187 {
188  OGGContext *ogg = s->priv_data;
189  OGGPageList **p = &ogg->page_list;
190  OGGPageList *l = av_mallocz(sizeof(*l));
191 
192  if (!l)
193  return AVERROR(ENOMEM);
194  l->page = oggstream->page;
195 
196  oggstream->page.start_granule = oggstream->page.granule;
197  oggstream->page_count++;
198  ogg_reset_cur_page(oggstream);
199 
200  while (*p) {
201  if (ogg_compare_granule(s, &(*p)->page, &l->page))
202  break;
203  p = &(*p)->next;
204  }
205  l->next = *p;
206  *p = l;
207 
208  return 0;
209 }
210 
212  uint8_t *data, unsigned size, int64_t granule,
213  int header)
214 {
215  OGGStreamContext *oggstream = st->priv_data;
216  OGGContext *ogg = s->priv_data;
217  int total_segments = size / 255 + 1;
218  uint8_t *p = data;
219  int i, segments, len, flush = 0;
220 
221  // Handles VFR by flushing page because this frame needs to have a timestamp
222  // For theora, keyframes also need to have a timestamp to correctly mark
223  // them as such, otherwise seeking will not work correctly at the very
224  // least with old libogg versions.
225  // Do not try to flush header packets though, that will create broken files.
226  if (st->codec->codec_id == AV_CODEC_ID_THEORA && !header &&
227  (ogg_granule_to_timestamp(oggstream, granule) >
228  ogg_granule_to_timestamp(oggstream, oggstream->last_granule) + 1 ||
229  ogg_key_granule(oggstream, granule))) {
230  if (oggstream->page.granule != -1)
231  ogg_buffer_page(s, oggstream);
232  flush = 1;
233  }
234 
235  // avoid a continued page
236  if (!header && oggstream->page.size > 0 &&
237  MAX_PAGE_SIZE - oggstream->page.size < size) {
238  ogg_buffer_page(s, oggstream);
239  }
240 
241  for (i = 0; i < total_segments; ) {
242  OGGPage *page = &oggstream->page;
243 
244  segments = FFMIN(total_segments - i, 255 - page->segments_count);
245 
246  if (i && !page->segments_count)
247  page->flags |= 1; // continued packet
248 
249  memset(page->segments+page->segments_count, 255, segments - 1);
250  page->segments_count += segments - 1;
251 
252  len = FFMIN(size, segments*255);
253  page->segments[page->segments_count++] = len - (segments-1)*255;
254  memcpy(page->data+page->size, p, len);
255  p += len;
256  size -= len;
257  i += segments;
258  page->size += len;
259 
260  if (i == total_segments)
261  page->granule = granule;
262 
263  if (!header) {
264  AVStream *st = s->streams[page->stream_index];
265 
266  int64_t start = av_rescale_q(page->start_granule, st->time_base,
268  int64_t next = av_rescale_q(page->granule, st->time_base,
270 
271  if (page->segments_count == 255 ||
272  (ogg->pref_size > 0 && page->size >= ogg->pref_size) ||
273  (ogg->pref_duration > 0 && next - start >= ogg->pref_duration)) {
274  ogg_buffer_page(s, oggstream);
275  }
276  }
277  }
278 
279  if (flush && oggstream->page.granule != -1)
280  ogg_buffer_page(s, oggstream);
281 
282  return 0;
283 }
284 
285 static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
286  int *header_len, AVDictionary **m, int framing_bit)
287 {
288  const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
289  int size;
290  uint8_t *p, *p0;
291 
293 
294  size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit;
295  p = av_mallocz(size);
296  if (!p)
297  return NULL;
298  p0 = p;
299 
300  p += offset;
301  ff_vorbiscomment_write(&p, m, vendor);
302  if (framing_bit)
303  bytestream_put_byte(&p, 1);
304 
305  *header_len = size;
306  return p0;
307 }
308 
310  OGGStreamContext *oggstream, int bitexact,
311  AVDictionary **m)
312 {
313  uint8_t *p;
314 
316  return AVERROR(EINVAL);
317 
318  // first packet: STREAMINFO
319  oggstream->header_len[0] = 51;
320  oggstream->header[0] = av_mallocz(51); // per ogg flac specs
321  p = oggstream->header[0];
322  if (!p)
323  return AVERROR(ENOMEM);
324  bytestream_put_byte(&p, 0x7F);
325  bytestream_put_buffer(&p, "FLAC", 4);
326  bytestream_put_byte(&p, 1); // major version
327  bytestream_put_byte(&p, 0); // minor version
328  bytestream_put_be16(&p, 1); // headers packets without this one
329  bytestream_put_buffer(&p, "fLaC", 4);
330  bytestream_put_byte(&p, 0x00); // streaminfo
331  bytestream_put_be24(&p, 34);
333 
334  // second packet: VorbisComment
335  p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m, 0);
336  if (!p)
337  return AVERROR(ENOMEM);
338  oggstream->header[1] = p;
339  bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment
340  bytestream_put_be24(&p, oggstream->header_len[1] - 4);
341 
342  return 0;
343 }
344 
345 #define SPEEX_HEADER_SIZE 80
346 
348  OGGStreamContext *oggstream, int bitexact,
349  AVDictionary **m)
350 {
351  uint8_t *p;
352 
353  if (avctx->extradata_size < SPEEX_HEADER_SIZE)
354  return AVERROR_INVALIDDATA;
355 
356  // first packet: Speex header
358  if (!p)
359  return AVERROR(ENOMEM);
360  oggstream->header[0] = p;
361  oggstream->header_len[0] = SPEEX_HEADER_SIZE;
363  AV_WL32(&oggstream->header[0][68], 0); // set extra_headers to 0
364 
365  // second packet: VorbisComment
366  p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m, 0);
367  if (!p)
368  return AVERROR(ENOMEM);
369  oggstream->header[1] = p;
370 
371  return 0;
372 }
373 
374 #define OPUS_HEADER_SIZE 19
375 
377  OGGStreamContext *oggstream, int bitexact,
378  AVDictionary **m)
379 {
380  uint8_t *p;
381 
382  if (avctx->extradata_size < OPUS_HEADER_SIZE)
383  return AVERROR_INVALIDDATA;
384 
385  /* first packet: Opus header */
386  p = av_mallocz(avctx->extradata_size);
387  if (!p)
388  return AVERROR(ENOMEM);
389  oggstream->header[0] = p;
390  oggstream->header_len[0] = avctx->extradata_size;
391  bytestream_put_buffer(&p, avctx->extradata, avctx->extradata_size);
392 
393  /* second packet: VorbisComment */
394  p = ogg_write_vorbiscomment(8, bitexact, &oggstream->header_len[1], m, 0);
395  if (!p)
396  return AVERROR(ENOMEM);
397  oggstream->header[1] = p;
398  bytestream_put_buffer(&p, "OpusTags", 8);
399 
400  return 0;
401 }
402 
404 {
405  OGGContext *ogg = s->priv_data;
406  OGGPageList *next, *p;
407 
408  if (!ogg->page_list)
409  return;
410 
411  for (p = ogg->page_list; p; ) {
412  OGGStreamContext *oggstream =
414  if (oggstream->page_count < 2 && !flush)
415  break;
416  ogg_write_page(s, &p->page,
417  flush == 1 && oggstream->page_count == 1 ? 4 : 0); // eos
418  next = p->next;
419  av_freep(&p);
420  p = next;
421  }
422  ogg->page_list = p;
423 }
424 
426 {
427  OGGContext *ogg = s->priv_data;
428  OGGStreamContext *oggstream = NULL;
429  int i, j;
430 
431  if (ogg->pref_size)
432  av_log(s, AV_LOG_WARNING, "The pagesize option is deprecated\n");
433 
434  for (i = 0; i < s->nb_streams; i++) {
435  AVStream *st = s->streams[i];
436  unsigned serial_num = i + ogg->serial_offset;
437 
438  if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
439  if (st->codec->codec_id == AV_CODEC_ID_OPUS)
440  /* Opus requires a fixed 48kHz clock */
441  avpriv_set_pts_info(st, 64, 1, 48000);
442  else
443  avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
444  }
445 
446  if (st->codec->codec_id != AV_CODEC_ID_VORBIS &&
448  st->codec->codec_id != AV_CODEC_ID_SPEEX &&
449  st->codec->codec_id != AV_CODEC_ID_FLAC &&
450  st->codec->codec_id != AV_CODEC_ID_OPUS) {
451  av_log(s, AV_LOG_ERROR, "Unsupported codec id in stream %d\n", i);
452  return AVERROR(EINVAL);
453  }
454 
455  if (!st->codec->extradata || !st->codec->extradata_size) {
456  av_log(s, AV_LOG_ERROR, "No extradata present\n");
457  return AVERROR_INVALIDDATA;
458  }
459  oggstream = av_mallocz(sizeof(*oggstream));
460  if (!oggstream)
461  return AVERROR(ENOMEM);
462 
463  oggstream->page.stream_index = i;
464 
465  if (!(s->flags & AVFMT_FLAG_BITEXACT))
466  do {
467  serial_num = av_get_random_seed();
468  for (j = 0; j < i; j++) {
469  OGGStreamContext *sc = s->streams[j]->priv_data;
470  if (serial_num == sc->serial_num)
471  break;
472  }
473  } while (j < i);
474  oggstream->serial_num = serial_num;
475 
477 
478  st->priv_data = oggstream;
479  if (st->codec->codec_id == AV_CODEC_ID_FLAC) {
480  int err = ogg_build_flac_headers(st->codec, oggstream,
482  &st->metadata);
483  if (err) {
484  av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n");
485  av_freep(&st->priv_data);
486  return err;
487  }
488  } else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) {
489  int err = ogg_build_speex_headers(st->codec, oggstream,
491  &st->metadata);
492  if (err) {
493  av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n");
494  av_freep(&st->priv_data);
495  return err;
496  }
497  } else if (st->codec->codec_id == AV_CODEC_ID_OPUS) {
498  int err = ogg_build_opus_headers(st->codec, oggstream,
500  &st->metadata);
501  if (err) {
502  av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
503  av_freep(&st->priv_data);
504  return err;
505  }
506  } else {
507  uint8_t *p;
508  const char *cstr = st->codec->codec_id == AV_CODEC_ID_VORBIS ? "vorbis" : "theora";
509  int header_type = st->codec->codec_id == AV_CODEC_ID_VORBIS ? 3 : 0x81;
510  int framing_bit = st->codec->codec_id == AV_CODEC_ID_VORBIS ? 1 : 0;
511 
513  st->codec->codec_id == AV_CODEC_ID_VORBIS ? 30 : 42,
514  (const uint8_t**)oggstream->header, oggstream->header_len) < 0) {
515  av_log(s, AV_LOG_ERROR, "Extradata corrupted\n");
516  av_freep(&st->priv_data);
517  return AVERROR_INVALIDDATA;
518  }
519 
521  &oggstream->header_len[1], &st->metadata,
522  framing_bit);
523  oggstream->header[1] = p;
524  if (!p)
525  return AVERROR(ENOMEM);
526 
527  bytestream_put_byte(&p, header_type);
528  bytestream_put_buffer(&p, cstr, 6);
529 
530  if (st->codec->codec_id == AV_CODEC_ID_THEORA) {
531  /** KFGSHIFT is the width of the less significant section of the granule position
532  The less significant section is the frame count since the last keyframe */
533  oggstream->kfgshift = ((oggstream->header[0][40]&3)<<3)|(oggstream->header[0][41]>>5);
534  oggstream->vrev = oggstream->header[0][9];
535  av_log(s, AV_LOG_DEBUG, "theora kfgshift %d, vrev %d\n",
536  oggstream->kfgshift, oggstream->vrev);
537  }
538  }
539  }
540 
541  for (j = 0; j < s->nb_streams; j++) {
542  OGGStreamContext *oggstream = s->streams[j]->priv_data;
543  ogg_buffer_data(s, s->streams[j], oggstream->header[0],
544  oggstream->header_len[0], 0, 1);
545  oggstream->page.flags |= 2; // bos
546  ogg_buffer_page(s, oggstream);
547  }
548  for (j = 0; j < s->nb_streams; j++) {
549  AVStream *st = s->streams[j];
550  OGGStreamContext *oggstream = st->priv_data;
551  for (i = 1; i < 3; i++) {
552  if (oggstream->header_len[i])
553  ogg_buffer_data(s, st, oggstream->header[i],
554  oggstream->header_len[i], 0, 1);
555  }
556  ogg_buffer_page(s, oggstream);
557  }
558 
559  oggstream->page.start_granule = AV_NOPTS_VALUE;
560 
561  ogg_write_pages(s, 2);
562 
563  return 0;
564 }
565 
567 {
568  AVStream *st = s->streams[pkt->stream_index];
569  OGGStreamContext *oggstream = st->priv_data;
570  int ret;
571  int64_t granule;
572 
573  if (st->codec->codec_id == AV_CODEC_ID_THEORA) {
574  int64_t pts = oggstream->vrev < 1 ? pkt->pts : pkt->pts + pkt->duration;
575  int pframe_count;
576  if (pkt->flags & AV_PKT_FLAG_KEY)
577  oggstream->last_kf_pts = pts;
578  pframe_count = pts - oggstream->last_kf_pts;
579  // prevent frame count from overflow if key frame flag is not set
580  if (pframe_count >= (1<<oggstream->kfgshift)) {
581  oggstream->last_kf_pts += pframe_count;
582  pframe_count = 0;
583  }
584  granule = (oggstream->last_kf_pts<<oggstream->kfgshift) | pframe_count;
585  } else if (st->codec->codec_id == AV_CODEC_ID_OPUS)
586  granule = pkt->pts + pkt->duration +
588  (AVRational){ 1, st->codec->sample_rate },
589  st->time_base);
590  else
591  granule = pkt->pts + pkt->duration;
592 
593  if (oggstream->page.start_granule == AV_NOPTS_VALUE)
594  oggstream->page.start_granule = pkt->pts;
595 
596  ret = ogg_buffer_data(s, st, pkt->data, pkt->size, granule, 0);
597  if (ret < 0)
598  return ret;
599 
600  ogg_write_pages(s, 0);
601 
602  oggstream->last_granule = granule;
603 
604  return 0;
605 }
606 
608 {
609  int i;
610 
611  if (pkt)
612  return ogg_write_packet_internal(s, pkt);
613 
614  for (i = 0; i < s->nb_streams; i++) {
615  OGGStreamContext *oggstream = s->streams[i]->priv_data;
616  if (oggstream->page.segments_count)
617  ogg_buffer_page(s, oggstream);
618  }
619 
620  ogg_write_pages(s, 2);
621  return 0;
622 }
623 
625 {
626  int i;
627 
628  /* flush current page if needed */
629  for (i = 0; i < s->nb_streams; i++) {
630  OGGStreamContext *oggstream = s->streams[i]->priv_data;
631 
632  if (oggstream->page.size > 0)
633  ogg_buffer_page(s, oggstream);
634  }
635 
636  ogg_write_pages(s, 1);
637 
638  for (i = 0; i < s->nb_streams; i++) {
639  AVStream *st = s->streams[i];
640  OGGStreamContext *oggstream = st->priv_data;
641  if (st->codec->codec_id == AV_CODEC_ID_FLAC ||
642  st->codec->codec_id == AV_CODEC_ID_SPEEX ||
643  st->codec->codec_id == AV_CODEC_ID_OPUS) {
644  av_freep(&oggstream->header[0]);
645  }
646  av_freep(&oggstream->header[1]);
647  av_freep(&st->priv_data);
648  }
649  return 0;
650 }
651 
652 #if CONFIG_OGG_MUXER
653 OGG_CLASS(ogg, Ogg)
654 AVOutputFormat ff_ogg_muxer = {
655  .name = "ogg",
656  .long_name = NULL_IF_CONFIG_SMALL("Ogg"),
657  .mime_type = "application/ogg",
658  .extensions = "ogg,ogv"
659 #if !CONFIG_SPX_MUXER
660  ",spx"
661 #endif
662 #if !CONFIG_OPUS_MUXER
663  ",opus"
664 #endif
665  ,
666  .priv_data_size = sizeof(OGGContext),
667  .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
669  .video_codec = AV_CODEC_ID_THEORA,
674  .priv_class = &ogg_muxer_class,
675 };
676 #endif
677 
678 #if CONFIG_OGA_MUXER
679 OGG_CLASS(oga, Ogg audio)
680 AVOutputFormat ff_oga_muxer = {
681  .name = "oga",
682  .long_name = NULL_IF_CONFIG_SMALL("Ogg Audio"),
683  .mime_type = "audio/ogg",
684  .extensions = "oga",
685  .priv_data_size = sizeof(OGGContext),
686  .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
687  AV_CODEC_ID_VORBIS : AV_CODEC_ID_FLAC,
692  .priv_class = &oga_muxer_class,
693 };
694 #endif
695 
696 #if CONFIG_SPX_MUXER
697 OGG_CLASS(spx, Ogg Speex)
698 AVOutputFormat ff_spx_muxer = {
699  .name = "spx",
700  .long_name = NULL_IF_CONFIG_SMALL("Ogg Speex"),
701  .mime_type = "audio/ogg",
702  .extensions = "spx",
703  .priv_data_size = sizeof(OGGContext),
704  .audio_codec = AV_CODEC_ID_SPEEX,
709  .priv_class = &spx_muxer_class,
710 };
711 #endif
712 
713 #if CONFIG_OPUS_MUXER
714 OGG_CLASS(opus, Ogg Opus)
715 AVOutputFormat ff_opus_muxer = {
716  .name = "opus",
717  .long_name = NULL_IF_CONFIG_SMALL("Ogg Opus"),
718  .mime_type = "audio/ogg",
719  .extensions = "opus",
720  .priv_data_size = sizeof(OGGContext),
721  .audio_codec = AV_CODEC_ID_OPUS,
726  .priv_class = &opus_muxer_class,
727 };
728 #endif