Go to the documentation of this file.
41 #define MAX_PAGE_SIZE 65307
42 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
121 struct ogg *
ogg =
s->priv_data;
136 if (
i >=
ost->nstreams || !
ost->streams[
i].private) {
160 struct ogg *
ogg =
s->priv_data;
213 struct ogg *
ogg =
s->priv_data;
225 if (!codec && !probing) {
231 if (os->
codec != codec)
251 struct ogg *
ogg =
s->priv_data;
258 "in between Ogg context save/restore operations.\n");
268 memset(os, 0,
sizeof(*os));
317 struct ogg *
ogg =
s->priv_data;
323 uint32_t crc, crc_tmp;
329 uint8_t *readout_buf;
339 if (sync[sp & 3] ==
'O' &&
340 sync[(sp + 1) & 3] ==
'g' &&
341 sync[(sp + 2) & 3] ==
'g' && sync[(sp + 3) & 3] ==
'S')
504 struct ogg *
ogg =
s->priv_data;
553 if (!complete && os->
segp == os->
nsegs) {
566 "Page at %"PRId64
" is missing granule\n",
646 struct ogg *
ogg =
s->priv_data;
672 s->streams[
i]->duration =
675 s->streams[
i]->duration -=
s->streams[
i]->start_time;
700 s->streams[
i]->duration -=
pts;
715 struct ogg *
ogg =
s->priv_data;
730 struct ogg *
ogg =
s->priv_data;
752 "Headers mismatch for stream %d: "
753 "expected %d received %d.\n",
759 os->
lastpts =
s->streams[
i]->start_time =
773 struct ogg *
ogg =
s->priv_data;
803 struct ogg *
ogg =
s->priv_data;
807 switch (
s->streams[idx]->codecpar->codec_id) {
830 if (
s->io_repositioned) {
832 s->io_repositioned = 0;
841 }
while (idx < 0 || !s->streams[idx]);
895 struct ogg *
ogg =
s->priv_data;
906 if (
i == stream_index) {
936 struct ogg *
ogg =
s->priv_data;
961 if (!memcmp(
"OggS", p->
buf, 5) && p->
buf[5] <= 0x7)
969 .p.extensions =
"ogg",
971 .priv_data_size =
sizeof(
struct ogg),
const struct ogg_codec ff_old_flac_codec
const struct ogg_codec ff_ogm_text_codec
#define AV_LOG_WARNING
Something somehow does not look correct.
int ff_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
Perform a binary search using av_index_search_timestamp() and FFInputFormat.read_timestamp().
#define AV_EF_EXPLODE
abort decoding on minor error detection
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
const struct ogg_codec ff_ogm_audio_codec
static void ogg_validate_keyframe(AVFormatContext *s, int idx, int pstart, int psize)
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
const struct ogg_codec ff_vp8_codec
const struct ogg_codec ff_old_dirac_codec
int start_trimming
set the number of packets to drop from the start
static int ogg_read_header(AVFormatContext *s)
static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int nb_header
set to the number of parsed headers
static int ogg_reset(AVFormatContext *s)
int64_t avio_size(AVIOContext *s)
Get the filesize.
const struct ogg_codec ff_vorbis_codec
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
unsigned long ffio_get_checksum(AVIOContext *s)
const struct ogg_codec ff_flac_codec
const FFInputFormat ff_ogg_demuxer
int(* packet)(AVFormatContext *, int)
#define DECODER_BUFFER_SIZE
static uint64_t ogg_gptopts(AVFormatContext *s, int i, uint64_t gp, int64_t *dts)
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as a packet side data.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
#define ss(width, name, subs,...)
static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, int64_t *fpos)
find the next Ogg packet
static void free_stream(AVFormatContext *s, int i)
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define OGG_NOGRANULE_VALUE
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int got_data
1 if the stream got some data (non-initial packets), 0 otherwise
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int page_end
current packet is the last one completed in the page
int64_t data_offset
offset of the first packet
#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...
int64_t page_pos
file offset of the current page
int(* header)(AVFormatContext *, int)
Attempt to process a packet as a header.
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.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
const struct ogg_codec ff_ogm_old_codec
This structure contains the data a format has to probe a file.
static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
int64_t page_pos
file offset of the current page
struct ogg_stream * streams
static int ogg_save(AVFormatContext *s)
static int ogg_get_length(AVFormatContext *s)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int buf_realloc(struct ogg_stream *os, int size)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
static int ogg_read_close(AVFormatContext *s)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
@ AV_PKT_DATA_METADATA_UPDATE
A list of zero terminated key/value strings.
#define AV_NOPTS_VALUE
Undefined timestamp value.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int data_packets_seen(const struct ogg *ogg)
void ffio_init_checksum(AVIOContext *s, unsigned long(*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int avio_r8(AVIOContext *s)
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int flags
A combination of AV_PKT_FLAG values.
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
#define AV_LOG_INFO
Standard information.
int64_t sync_pos
file offset of the first page needed to reconstruct the current packet
int incomplete
whether we're expecting a continuation in the next page
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
const struct ogg_codec ff_ogm_video_codec
const struct ogg_codec ff_skeleton_codec
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static const struct ogg_codec *const ogg_codecs[]
static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit)
int id
Format-specific stream ID.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static const struct ogg_codec * ogg_find_codec(uint8_t *buf, int size)
#define AV_INPUT_BUFFER_PADDING_SIZE
static int ogg_find_stream(struct ogg *ogg, int serial)
void(* cleanup)(AVFormatContext *s, int idx)
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
static int ogg_restore(AVFormatContext *s)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int nb_header
Number of expected headers.
static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts)
const struct ogg_codec ff_celt_codec
static int ogg_probe(const AVProbeData *p)
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
uint64_t avio_rl64(AVIOContext *s)
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
#define flags(name, subs,...)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static int ogg_read_page(AVFormatContext *s, int *sid, int probing)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int end_trimming
set the number of packets to drop from the end
const struct ogg_codec ff_dirac_codec
const struct ogg_codec ff_speex_codec
int granule_is_start
1 if granule is the start time of the associated packet.
const struct ogg_codec ff_theora_codec
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
const struct ogg_codec * codec
const struct ogg_codec ff_opus_codec
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.