FFmpeg
Macros | Functions | Variables
oggdec.c File Reference
#include <stdio.h>
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avio_internal.h"
#include "demux.h"
#include "oggdec.h"
#include "avformat.h"
#include "internal.h"

Go to the source code of this file.

Macros

#define MAX_PAGE_SIZE   65307
 
#define DECODER_BUFFER_SIZE   MAX_PAGE_SIZE
 

Functions

static int64_t ogg_calc_pts (AVFormatContext *s, int idx, int64_t *dts)
 
static int ogg_new_stream (AVFormatContext *s, uint32_t serial)
 
static int ogg_restore (AVFormatContext *s)
 
static void free_stream (AVFormatContext *s, int i)
 
static int ogg_save (AVFormatContext *s)
 
static int ogg_reset (AVFormatContext *s)
 
static const struct ogg_codecogg_find_codec (uint8_t *buf, int size)
 
static int ogg_replace_stream (AVFormatContext *s, uint32_t serial, char *magic, int page_size, int probing)
 Replace the current stream with a new one. More...
 
static int data_packets_seen (const struct ogg *ogg)
 
static int buf_realloc (struct ogg_stream *os, int size)
 
static int ogg_read_page (AVFormatContext *s, int *sid, int probing)
 
static int ogg_packet (AVFormatContext *s, int *sid, int *dstart, int *dsize, int64_t *fpos)
 find the next Ogg packet More...
 
static int ogg_get_length (AVFormatContext *s)
 
static int ogg_read_close (AVFormatContext *s)
 
static int ogg_read_header (AVFormatContext *s)
 
static void ogg_validate_keyframe (AVFormatContext *s, int idx, int pstart, int psize)
 
static int ogg_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int64_t ogg_read_timestamp (AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit)
 
static int ogg_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 
static int ogg_probe (const AVProbeData *p)
 

Variables

static const struct ogg_codec *const ogg_codecs []
 
const FFInputFormat ff_ogg_demuxer
 

Macro Definition Documentation

◆ MAX_PAGE_SIZE

#define MAX_PAGE_SIZE   65307

Definition at line 41 of file oggdec.c.

◆ DECODER_BUFFER_SIZE

#define DECODER_BUFFER_SIZE   MAX_PAGE_SIZE

Definition at line 42 of file oggdec.c.

Function Documentation

◆ ogg_calc_pts()

static int64_t ogg_calc_pts ( AVFormatContext s,
int  idx,
int64_t *  dts 
)
static

Definition at line 769 of file oggdec.c.

Referenced by ogg_get_length(), ogg_read_packet(), and ogg_read_timestamp().

◆ ogg_new_stream()

static int ogg_new_stream ( AVFormatContext s,
uint32_t  serial 
)
static

Definition at line 249 of file oggdec.c.

Referenced by ogg_read_page().

◆ ogg_restore()

static int ogg_restore ( AVFormatContext s)
static

Definition at line 119 of file oggdec.c.

Referenced by ogg_get_length(), and ogg_save().

◆ free_stream()

static void free_stream ( AVFormatContext s,
int  i 
)
static

Definition at line 67 of file oggdec.c.

Referenced by ogg_read_close(), and ogg_restore().

◆ ogg_save()

static int ogg_save ( AVFormatContext s)
static

Definition at line 83 of file oggdec.c.

Referenced by ogg_get_length().

◆ ogg_reset()

static int ogg_reset ( AVFormatContext s)
static

Definition at line 158 of file oggdec.c.

Referenced by ogg_get_length(), ogg_read_packet(), ogg_read_seek(), and ogg_read_timestamp().

◆ ogg_find_codec()

static const struct ogg_codec* ogg_find_codec ( uint8_t *  buf,
int  size 
)
static

Definition at line 193 of file oggdec.c.

Referenced by ogg_packet(), and ogg_replace_stream().

◆ ogg_replace_stream()

static int ogg_replace_stream ( AVFormatContext s,
uint32_t  serial,
char *  magic,
int  page_size,
int  probing 
)
static

Replace the current stream with a new one.

This is a typical webradio situation where a new audio stream spawn (identified with a new serial) and must replace the previous one (track switch).

Definition at line 210 of file oggdec.c.

Referenced by ogg_read_page().

◆ data_packets_seen()

static int data_packets_seen ( const struct ogg ogg)
static

Definition at line 290 of file oggdec.c.

Referenced by ogg_read_page().

◆ buf_realloc()

static int buf_realloc ( struct ogg_stream os,
int  size 
)
static

Definition at line 300 of file oggdec.c.

Referenced by ogg_read_page().

◆ ogg_read_page()

static int ogg_read_page ( AVFormatContext s,
int sid,
int  probing 
)
static

Definition at line 314 of file oggdec.c.

Referenced by ogg_get_length(), and ogg_packet().

◆ ogg_packet()

static int ogg_packet ( AVFormatContext s,
int sid,
int dstart,
int dsize,
int64_t *  fpos 
)
static

find the next Ogg packet

Parameters
*sidis set to the stream for the packet or -1 if there is no matching stream, in that case assume all other return values to be uninitialized.
Returns
negative value on error or EOF.

Definition at line 498 of file oggdec.c.

Referenced by encode_frame(), encode_init(), libvorbis_encode_frame(), libvorbis_encode_init(), ogg_get_length(), ogg_read_header(), ogg_read_packet(), ogg_read_timestamp(), and oggvorbis_decode_frame().

◆ ogg_get_length()

static int ogg_get_length ( AVFormatContext s)
static

Definition at line 642 of file oggdec.c.

Referenced by ogg_read_header().

◆ ogg_read_close()

static int ogg_read_close ( AVFormatContext s)
static

Definition at line 711 of file oggdec.c.

◆ ogg_read_header()

static int ogg_read_header ( AVFormatContext s)
static

Definition at line 726 of file oggdec.c.

◆ ogg_validate_keyframe()

static void ogg_validate_keyframe ( AVFormatContext s,
int  idx,
int  pstart,
int  psize 
)
static

Definition at line 799 of file oggdec.c.

Referenced by ogg_read_packet(), and ogg_read_timestamp().

◆ ogg_read_packet()

static int ogg_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 820 of file oggdec.c.

◆ ogg_read_timestamp()

static int64_t ogg_read_timestamp ( AVFormatContext s,
int  stream_index,
int64_t *  pos_arg,
int64_t  pos_limit 
)
static

Definition at line 890 of file oggdec.c.

◆ ogg_read_seek()

static int ogg_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 931 of file oggdec.c.

◆ ogg_probe()

static int ogg_probe ( const AVProbeData p)
static

Definition at line 957 of file oggdec.c.

Variable Documentation

◆ ogg_codecs

const struct ogg_codec* const ogg_codecs[]
static

◆ ff_ogg_demuxer

const FFInputFormat ff_ogg_demuxer
Initial value:
= {
.p.name = "ogg",
.p.long_name = NULL_IF_CONFIG_SMALL("Ogg"),
.p.extensions = "ogg",
.priv_data_size = sizeof(struct ogg),
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
.read_probe = ogg_probe,
.read_header = ogg_read_header,
.read_packet = ogg_read_packet,
.read_close = ogg_read_close,
.read_seek = ogg_read_seek,
.read_timestamp = ogg_read_timestamp,
}

Definition at line 964 of file oggdec.c.

ff_old_flac_codec
const struct ogg_codec ff_old_flac_codec
Definition: oggparseflac.c:136
ff_ogm_text_codec
const struct ogg_codec ff_ogm_text_codec
Definition: oggparseogm.c:213
ff_ogm_audio_codec
const struct ogg_codec ff_ogm_audio_codec
Definition: oggparseogm.c:204
ff_vp8_codec
const struct ogg_codec ff_vp8_codec
Definition: oggparsevp8.c:139
ff_old_dirac_codec
const struct ogg_codec ff_old_dirac_codec
Definition: oggparsedirac.c:126
ogg_read_header
static int ogg_read_header(AVFormatContext *s)
Definition: oggdec.c:726
AVFMT_NOBINSEARCH
#define AVFMT_NOBINSEARCH
Format does not allow to fall back on binary search via read_timestamp.
Definition: avformat.h:485
ogg
Definition: oggdec.h:101
ff_vorbis_codec
const struct ogg_codec ff_vorbis_codec
Definition: oggparsevorbis.c:511
ff_flac_codec
const struct ogg_codec ff_flac_codec
Definition: oggparseflac.c:129
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:480
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
NULL
#define NULL
Definition: coverity.c:32
ff_ogm_old_codec
const struct ogg_codec ff_ogm_old_codec
Definition: oggparseogm.c:222
ogg_read_seek
static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: oggdec.c:931
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
ogg_read_close
static int ogg_read_close(AVFormatContext *s)
Definition: oggdec.c:711
ff_ogm_video_codec
const struct ogg_codec ff_ogm_video_codec
Definition: oggparseogm.c:195
ff_skeleton_codec
const struct ogg_codec ff_skeleton_codec
Definition: oggparseskeleton.c:96
ogg_read_timestamp
static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit)
Definition: oggdec.c:890
ogg_read_packet
static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: oggdec.c:820
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:481
ff_celt_codec
const struct ogg_codec ff_celt_codec
Definition: oggparsecelt.c:93
ogg_probe
static int ogg_probe(const AVProbeData *p)
Definition: oggdec.c:957
ff_dirac_codec
const struct ogg_codec ff_dirac_codec
Definition: oggparsedirac.c:117
ff_speex_codec
const struct ogg_codec ff_speex_codec
Definition: oggparsespeex.c:144
ff_theora_codec
const struct ogg_codec ff_theora_codec
Definition: oggparsetheora.c:211
ff_opus_codec
const struct ogg_codec ff_opus_codec
Definition: oggparseopus.c:182