FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
oggenc.c File Reference
#include <stdint.h>
#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 OGG_CLASS(flavor, name)
 
#define SPEEX_HEADER_SIZE   80
 
#define OPUS_HEADER_SIZE   19
 

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 int ogg_key_granule (OGGStreamContext *oggstream, int64_t granule)
 
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 (int64_t 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 void ogg_write_pages (AVFormatContext *s, int flush)
 
static int ogg_write_header (AVFormatContext *s)
 
static int ogg_write_packet_internal (AVFormatContext *s, AVPacket *pkt)
 
static int ogg_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int ogg_write_trailer (AVFormatContext *s)
 

Variables

static const AVOption options []
 

Macro Definition Documentation

#define MAX_PAGE_SIZE   65025

Definition at line 36 of file oggenc.c.

Referenced by ogg_buffer_data().

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

Definition at line 77 of file oggenc.c.

#define PARAM   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 78 of file oggenc.c.

#define OGG_CLASS (   flavor,
  name 
)
Value:
static const AVClass flavor ## _muxer_class = {\
.class_name = #name " muxer",\
.item_name = av_default_item_name,\
.option = options,\
.version = LIBAVUTIL_VERSION_INT,\
};
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
static const AVOption options[]
Definition: oggenc.c:80
av_default_item_name
Describe the class of an AVClass context structure.
Definition: log.h:67
const char * name
Definition: opengl_enc.c:103

Definition at line 92 of file oggenc.c.

#define SPEEX_HEADER_SIZE   80

Definition at line 347 of file oggenc.c.

Referenced by ogg_build_speex_headers().

#define OPUS_HEADER_SIZE   19

Definition at line 376 of file oggenc.c.

Referenced by ogg_build_opus_headers().

Function Documentation

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

Definition at line 100 of file oggenc.c.

Referenced by ogg_write_page().

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

Definition at line 109 of file oggenc.c.

Referenced by ogg_write_pages().

static int ogg_key_granule ( OGGStreamContext oggstream,
int64_t  granule 
)
static

Definition at line 147 of file oggenc.c.

Referenced by ogg_buffer_data().

static int64_t ogg_granule_to_timestamp ( OGGStreamContext oggstream,
int64_t  granule 
)
static

Definition at line 152 of file oggenc.c.

Referenced by ogg_buffer_data(), and ogg_compare_granule().

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

Definition at line 161 of file oggenc.c.

Referenced by ogg_buffer_page().

static int ogg_reset_cur_page ( OGGStreamContext oggstream)
static

Definition at line 177 of file oggenc.c.

Referenced by ogg_buffer_page().

static int ogg_buffer_page ( AVFormatContext s,
OGGStreamContext oggstream 
)
static

Definition at line 186 of file oggenc.c.

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

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

Definition at line 211 of file oggenc.c.

Referenced by ogg_write_header().

static uint8_t* ogg_write_vorbiscomment ( int64_t  offset,
int  bitexact,
int *  header_len,
AVDictionary **  m,
int  framing_bit 
)
static
static int ogg_build_flac_headers ( AVCodecContext avctx,
OGGStreamContext oggstream,
int  bitexact,
AVDictionary **  m 
)
static

Definition at line 311 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 349 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 378 of file oggenc.c.

Referenced by ogg_write_header().

static void ogg_write_pages ( AVFormatContext s,
int  flush 
)
static

Definition at line 405 of file oggenc.c.

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

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 427 of file oggenc.c.

static int ogg_write_packet_internal ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 568 of file oggenc.c.

Referenced by ogg_write_packet().

static int ogg_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 609 of file oggenc.c.

static int ogg_write_trailer ( AVFormatContext s)
static

Definition at line 626 of file oggenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "serial_offset", "serial number offset",
OFFSET(serial_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, PARAM },
{ "oggpagesize", "Set preferred Ogg page size.",
OFFSET(pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, PARAM},
{ "pagesize", "preferred page size in bytes (deprecated)",
OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM },
{ "page_duration", "preferred page duration, in microseconds",
OFFSET(pref_duration), AV_OPT_TYPE_INT64, { .i64 = 1000000 }, 0, INT64_MAX, PARAM },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define MAX_PAGE_SIZE
Definition: oggenc.c:36
#define PARAM
Definition: oggenc.c:78
#define OFFSET(x)
Definition: oggenc.c:77

Definition at line 80 of file oggenc.c.