42 probe_packet->
buf[6] &&
43 probe_packet->
buf[7] &&
44 !(probe_packet->
buf[8] & 1) &&
45 !(probe_packet->
buf[10] & 1))
57 AVStream *audio_stream, *video_stream;
74 audio_dec = audio_stream->
codec;
82 video_dec = video_stream->
codec;
89 yop->frame_size =
avio_r8(pb) * 2048;
99 yop->palette_size = video_dec->
extradata[0] * 3 + 4;
103 if (yop->audio_block_length < 920 ||
104 yop->audio_block_length + yop->palette_size >= yop->frame_size) {
122 int actual_video_data_size = yop->frame_size -
123 yop->audio_block_length - yop->palette_size;
125 yop->video_packet.stream_index = 1;
127 if (yop->video_packet.data) {
128 *pkt = yop->video_packet;
129 yop->video_packet.data =
NULL;
130 yop->video_packet.size = 0;
131 pkt->
data[0] = yop->odd_frame;
137 yop->frame_size - yop->audio_block_length);
143 ret =
avio_read(pb, yop->video_packet.data, yop->palette_size);
146 }
else if (ret < yop->palette_size) {
156 pkt->
pos = yop->video_packet.pos;
158 avio_skip(pb, yop->audio_block_length - ret);
160 ret =
avio_read(pb, yop->video_packet.data + yop->palette_size,
161 actual_video_data_size);
164 else if (ret < actual_video_data_size)
168 return yop->audio_block_length;
183 int64_t timestamp,
int flags)
186 int64_t frame_pos, pos_min, pos_max;
194 frame_count = (pos_max - pos_min) / yop->frame_size;
196 timestamp =
FFMAX(0,
FFMIN(frame_count, timestamp));
198 frame_pos = timestamp * yop->frame_size + pos_min;
204 yop->odd_frame = timestamp & 1;
int64_t avio_size(AVIOContext *s)
Get the filesize.
void av_free_packet(AVPacket *pkt)
Free a packet.
int64_t pos
byte position in stream, -1 if unknown
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t data_offset
offset of the first packet
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
int flags
A combination of AV_PKT_FLAG values.
uint64_t channel_layout
Audio channel layout.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
struct AVRational AVRational
rational number numerator/denominator
audio channel layout utility functions
int width
picture width / height.
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
main external API structure.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
#define FF_INPUT_BUFFER_PADDING_SIZE
This structure contains the data a format has to probe a file.
unsigned int avio_rl16(AVIOContext *s)
#define AVERROR_INVALIDDATA
#define AVPROBE_SCORE_MAX
int channels
number of audio channels
void * priv_data
Format private data.
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define AVFMT_GENERIC_INDEX
struct YopDecContext YopDecContext