40 #define MAX_PAGE_SIZE 65307
41 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
120 struct ogg *
ogg =
s->priv_data;
135 if (
i >=
ost->nstreams || !
ost->streams[
i].private) {
159 struct ogg *
ogg =
s->priv_data;
177 if (start_pos <= s->internal->data_offset) {
212 struct ogg *
ogg =
s->priv_data;
224 if (!codec && !probing) {
230 if (os->
codec != codec)
250 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;
339 if (sync[
sp & 3] ==
'O' &&
340 sync[(
sp + 1) & 3] ==
'g' &&
341 sync[(
sp + 2) & 3] ==
'g' && sync[(
sp + 3) & 3] ==
'S')
501 struct ogg *
ogg =
s->priv_data;
550 if (!complete && os->
segp == os->
nsegs) {
563 "Page at %"PRId64
" is missing granule\n",
586 if (!
s->internal->data_offset)
595 s->internal->data_offset =
FFMIN(
s->internal->data_offset, cur_os->
sync_pos);
643 struct ogg *
ogg =
s->priv_data;
669 s->streams[
i]->duration =
672 s->streams[
i]->duration -=
s->streams[
i]->start_time;
688 avio_seek (
s->pb,
s->internal->data_offset, SEEK_SET);
697 s->streams[
i]->duration -=
pts;
712 struct ogg *
ogg =
s->priv_data;
727 struct ogg *
ogg =
s->priv_data;
751 "Headers mismatch for stream %d: "
752 "expected %d received %d.\n",
760 os->
lastpts =
s->streams[
i]->start_time =
776 struct ogg *
ogg =
s->priv_data;
806 struct ogg *
ogg =
s->priv_data;
810 switch (
s->streams[idx]->codecpar->codec_id) {
833 if (
s->io_repositioned) {
835 s->io_repositioned = 0;
844 }
while (idx < 0 || !s->streams[idx]);
898 struct ogg *
ogg =
s->priv_data;
909 if (
i == stream_index) {
939 struct ogg *
ogg =
s->priv_data;
964 if (!memcmp(
"OggS", p->
buf, 5) && p->
buf[5] <= 0x7)
972 .priv_data_size =
sizeof(
struct ogg),
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_EF_EXPLODE
abort decoding on minor error detection
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int avio_rl32(AVIOContext *s)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
uint64_t avio_rl64(AVIOContext *s)
void ffio_init_checksum(AVIOContext *s, unsigned long(*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum)
unsigned long ffio_get_checksum(AVIOContext *s)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, buffer_size_t size)
#define flags(name, subs,...)
#define ss(width, name, subs,...)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
FF_ENABLE_DEPRECATION_WARNINGS 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.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
@ AV_PKT_DATA_METADATA_UPDATE
A list of zero terminated key/value strings.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array through a pointer to a pointer.
static int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
#define AV_NOPTS_VALUE
Undefined timestamp value.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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 ogg_get_length(AVFormatContext *s)
static int ogg_save(AVFormatContext *s)
static const struct ogg_codec *const ogg_codecs[]
static int ogg_probe(const AVProbeData *p)
static const struct ogg_codec * ogg_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.
static int ogg_read_header(AVFormatContext *s)
static int ogg_restore(AVFormatContext *s)
static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, int64_t *fpos)
find the next Ogg packet
static int buf_realloc(struct ogg_stream *os, int size)
static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit)
static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts)
static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
#define DECODER_BUFFER_SIZE
static int ogg_reset(AVFormatContext *s)
static void free_stream(AVFormatContext *s, int i)
AVInputFormat ff_ogg_demuxer
static int data_packets_seen(const struct ogg *ogg)
static int ogg_read_close(AVFormatContext *s)
static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
static int ogg_read_page(AVFormatContext *s, int *sid, int probing)
static void ogg_validate_keyframe(AVFormatContext *s, int idx, int pstart, int psize)
const struct ogg_codec ff_skeleton_codec
const struct ogg_codec ff_flac_codec
#define OGG_NOGRANULE_VALUE
const struct ogg_codec ff_ogm_old_codec
const struct ogg_codec ff_opus_codec
const struct ogg_codec ff_vp8_codec
const struct ogg_codec ff_celt_codec
const struct ogg_codec ff_ogm_video_codec
static uint64_t ogg_gptopts(AVFormatContext *s, int i, uint64_t gp, int64_t *dts)
const struct ogg_codec ff_speex_codec
const struct ogg_codec ff_old_dirac_codec
const struct ogg_codec ff_old_flac_codec
const struct ogg_codec ff_ogm_audio_codec
const struct ogg_codec ff_dirac_codec
const struct ogg_codec ff_vorbis_codec
static int ogg_find_stream(struct ogg *ogg, int serial)
const struct ogg_codec ff_ogm_text_codec
const struct ogg_codec ff_theora_codec
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int64_t pos
byte position in stream, -1 if unknown
This structure contains the data a format has to probe a file.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int id
Format-specific stream ID.
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
int(* header)(AVFormatContext *, int)
Attempt to process a packet as a header.
void(* cleanup)(AVFormatContext *s, int idx)
int granule_is_start
1 if granule is the start time of the associated packet.
int nb_header
Number of expected headers.
int(* packet)(AVFormatContext *, int)
int incomplete
whether we're expecting a continuation in the next page
int end_trimming
set the number of packets to drop from the end
int nb_header
set to the number of parsed headers
int start_trimming
set the number of packets to drop from the start
buffer_size_t new_metadata_size
int page_end
current packet is the last one completed in the page
int64_t page_pos
file offset of the current page
const struct ogg_codec * codec
int64_t sync_pos
file offset of the first page needed to reconstruct the current packet
int got_data
1 if the stream got some data (non-initial packets), 0 otherwise
int64_t page_pos
file offset of the current page
struct ogg_stream * streams