41 probe_packet->
buf[6] &&
42 probe_packet->
buf[7] &&
43 !(probe_packet->
buf[8] & 1) &&
44 !(probe_packet->
buf[10] & 1))
56 AVStream *audio_stream, *video_stream;
73 audio_dec = audio_stream->
codec;
80 video_dec = video_stream->
codec;
87 yop->frame_size =
avio_r8(pb) * 2048;
97 yop->palette_size = video_dec->
extradata[0] * 3 + 4;
101 if (yop->audio_block_length < 920 ||
102 yop->audio_block_length + yop->palette_size >= yop->frame_size) {
120 int actual_video_data_size = yop->frame_size -
121 yop->audio_block_length - yop->palette_size;
123 yop->video_packet.stream_index = 1;
125 if (yop->video_packet.data) {
126 *pkt = yop->video_packet;
127 yop->video_packet.data =
NULL;
128 yop->video_packet.size = 0;
129 pkt->
data[0] = yop->odd_frame;
135 yop->frame_size - yop->audio_block_length);
141 ret =
avio_read(pb, yop->video_packet.data, yop->palette_size);
144 }
else if (ret < yop->palette_size) {
154 pkt->
pos = yop->video_packet.pos;
156 avio_skip(pb, yop->audio_block_length - ret);
158 ret =
avio_read(pb, yop->video_packet.data + yop->palette_size,
159 actual_video_data_size);
162 else if (ret < actual_video_data_size)
166 return yop->audio_block_length;
181 int64_t timestamp,
int flags)
184 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;
199 yop->odd_frame = timestamp & 1;
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t avio_size(AVIOContext *s)
Get the filesize.
AV_WL32 AV_WL24 AV_WL16 AV_WB32 AV_WB24 AV_RB16
int64_t pos
byte position in stream, -1 if unknown
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
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.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t data_offset
offset of the first packet
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int read_header(FFV1Context *f)
void av_free_packet(AVPacket *pkt)
Free a packet.
#define AVERROR_EOF
End of file.
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.
#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.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
codec context
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
struct AVRational AVRational
rational number numerator/denominator
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_probe(AVProbeData *p)
enum AVMediaType codec_type
int sample_rate
samples per second
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
This structure contains the data a format has to probe a file.
unsigned int avio_rl16(AVIOContext *s)
static AVRational frame_rate
int channels
number of audio channels
void * priv_data
Format private data.
struct YopDecContext YopDecContext