oggenc.c File Reference
#include "libavutil/crc.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/random_seed.h"
#include "libavcodec/xiph.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/flac.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "vorbiscomment.h"

Go to the source code of this file.

Data Structures

struct  OGGPage
 
struct  OGGStreamContext
 
struct  OGGPageList
 
struct  OGGContext
 

Macros

#define MAX_PAGE_SIZE   65025
 
#define OFFSET(x)   offsetof(OGGContext, x)
 
#define PARAM   AV_OPT_FLAG_ENCODING_PARAM
 
#define SPEEX_HEADER_SIZE   80
 
#define OPUS_HEADER_SIZE   19
 

Typedefs

typedef struct OGGPageList OGGPageList
 

Functions

static void ogg_update_checksum (AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
 
static int ogg_write_page (AVFormatContext *s, OGGPage *page, int extra_flags)
 
static int64_t ogg_granule_to_timestamp (OGGStreamContext *oggstream, int64_t granule)
 
static int ogg_compare_granule (AVFormatContext *s, OGGPage *next, OGGPage *page)
 
static int ogg_reset_cur_page (OGGStreamContext *oggstream)
 
static int ogg_buffer_page (AVFormatContext *s, OGGStreamContext *oggstream)
 
static int ogg_buffer_data (AVFormatContext *s, AVStream *st, uint8_t *data, unsigned size, int64_t granule, int header)
 
static uint8_togg_write_vorbiscomment (int offset, int bitexact, int *header_len, AVDictionary **m, int framing_bit)
 
static int ogg_build_flac_headers (AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, AVDictionary **m)
 
static int ogg_build_speex_headers (AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, AVDictionary **m)
 
static int ogg_build_opus_headers (AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, AVDictionary **m)
 
static int ogg_write_header (AVFormatContext *s)
 
static void ogg_write_pages (AVFormatContext *s, int flush)
 
static int ogg_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int ogg_write_trailer (AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass ogg_muxer_class
 
AVOutputFormat ff_ogg_muxer
 

Macro Definition Documentation

#define MAX_PAGE_SIZE   65025

Definition at line 34 of file oggenc.c.

#define OFFSET (   x)    offsetof(OGGContext, x)

Definition at line 72 of file oggenc.c.

#define OPUS_HEADER_SIZE   19

Definition at line 339 of file oggenc.c.

Referenced by ogg_build_opus_headers().

#define PARAM   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 73 of file oggenc.c.

#define SPEEX_HEADER_SIZE   80

Definition at line 310 of file oggenc.c.

Referenced by ogg_build_speex_headers().

Typedef Documentation

typedef struct OGGPageList OGGPageList

Function Documentation

static int ogg_buffer_data ( AVFormatContext s,
AVStream st,
uint8_t data,
unsigned  size,
int64_t  granule,
int  header 
)
static

Definition at line 194 of file oggenc.c.

Referenced by ogg_write_header().

static int ogg_buffer_page ( AVFormatContext s,
OGGStreamContext oggstream 
)
static

Definition at line 170 of file oggenc.c.

Referenced by ogg_buffer_data(), ogg_write_header(), and ogg_write_trailer().

static int ogg_build_flac_headers ( AVCodecContext avctx,
OGGStreamContext oggstream,
int  bitexact,
AVDictionary **  m 
)
static

Definition at line 272 of file oggenc.c.

Referenced by ogg_write_header().

static int ogg_build_opus_headers ( AVCodecContext avctx,
OGGStreamContext oggstream,
int  bitexact,
AVDictionary **  m 
)
static

Definition at line 341 of file oggenc.c.

Referenced by ogg_write_header().

static int ogg_build_speex_headers ( AVCodecContext avctx,
OGGStreamContext oggstream,
int  bitexact,
AVDictionary **  m 
)
static

Definition at line 312 of file oggenc.c.

Referenced by ogg_write_header().

static int ogg_compare_granule ( AVFormatContext s,
OGGPage next,
OGGPage page 
)
static

Definition at line 145 of file oggenc.c.

Referenced by ogg_buffer_page().

static int64_t ogg_granule_to_timestamp ( OGGStreamContext oggstream,
int64_t  granule 
)
static

Definition at line 136 of file oggenc.c.

Referenced by ogg_buffer_data(), and ogg_compare_granule().

static int ogg_reset_cur_page ( OGGStreamContext oggstream)
static

Definition at line 161 of file oggenc.c.

Referenced by ogg_buffer_page().

static void ogg_update_checksum ( AVFormatContext s,
AVIOContext pb,
int64_t  crc_offset 
)
static

Definition at line 89 of file oggenc.c.

Referenced by ogg_write_page().

static int ogg_write_header ( AVFormatContext s)
static

KFGSHIFT is the width of the less significant section of the granule position The less significant section is the frame count since the last keyframe

Definition at line 368 of file oggenc.c.

static int ogg_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 517 of file oggenc.c.

static int ogg_write_page ( AVFormatContext s,
OGGPage page,
int  extra_flags 
)
static

Definition at line 98 of file oggenc.c.

Referenced by ogg_write_pages().

static void ogg_write_pages ( AVFormatContext s,
int  flush 
)
static

Definition at line 495 of file oggenc.c.

Referenced by ogg_write_trailer().

static int ogg_write_trailer ( AVFormatContext s)
static

Definition at line 552 of file oggenc.c.

static uint8_t* ogg_write_vorbiscomment ( int  offset,
int  bitexact,
int *  header_len,
AVDictionary **  m,
int  framing_bit 
)
static

Variable Documentation

AVOutputFormat ff_ogg_muxer
Initial value:
= {
.name = "ogg",
.long_name = NULL_IF_CONFIG_SMALL("Ogg"),
.mime_type = "application/ogg",
.extensions = "ogg,ogv,spx,opus",
.priv_data_size = sizeof(OGGContext),
.audio_codec = AV_CODEC_ID_FLAC,
.video_codec = AV_CODEC_ID_THEORA,
.priv_class = &ogg_muxer_class,
}
static int ogg_write_header(AVFormatContext *s)
Definition: oggenc.c:368
static int write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: assenc.c:58
static const AVClass ogg_muxer_class
Definition: oggenc.c:81
static int write_trailer(AVFormatContext *s)
Definition: assenc.c:67
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:88
static int ogg_write_trailer(AVFormatContext *s)
Definition: oggenc.c:552
static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: oggenc.c:517
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:380

Definition at line 576 of file oggenc.c.

const AVClass ogg_muxer_class
static
Initial value:
= {
.class_name = "Ogg muxer",
.item_name = av_default_item_name,
.option = options,
}
static const AVOption options[]
Definition: oggenc.c:75
LIBAVUTIL_VERSION_INT
Definition: eval.c:52
av_default_item_name
Definition: dnxhdenc.c:43

Definition at line 81 of file oggenc.c.

const AVOption options[]
static
Initial value:
= {
{ "pagesize", "preferred page size in bytes",
OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM },
{ NULL },
}
#define MAX_PAGE_SIZE
Definition: oggenc.c:34
NULL
Definition: eval.c:52
#define PARAM
Definition: oggenc.c:73
#define OFFSET(x)
Definition: oggenc.c:72

Definition at line 75 of file oggenc.c.