26 #define PVA_MAX_PAYLOAD_LENGTH 0x17f8
27 #define PVA_VIDEO_PAYLOAD 0x01
28 #define PVA_AUDIO_PAYLOAD 0x02
29 #define PVA_MAGIC (('A' << 8) + 'V')
44 const unsigned char *
buf = pd->
buf;
80 #define pva_log if (read_packet) av_log
86 int syncword, streamid, reserved,
flags,
length, pts_flag;
100 pts_flag = flags & 0x10;
110 if (reserved != 0x55) {
127 int pes_signal, pes_header_data_length, pes_packet_length,
129 unsigned char pes_header_data[256];
135 pes_header_data_length =
avio_r8(pb);
137 if (pes_signal != 1 || pes_header_data_length == 0) {
139 "trying to recover\n");
146 ret =
avio_read(pb, pes_header_data, pes_header_data_length);
147 if (ret != pes_header_data_length)
149 length -= 9 + pes_header_data_length;
151 pes_packet_length -= 3 + pes_header_data_length;
155 if (pes_flags & 0x80 && (pes_header_data[0] & 0xf0) == 0x20) {
156 if (pes_header_data_length < 5) {
185 int ret,
length, streamid;
198 int64_t *pos, int64_t pos_limit) {
206 while (*pos < pos_limit) {
static int recover(WtvContext *wtv, uint64_t broken_pos)
Try to seek over a broken chunk.
static int pva_read_packet(AVFormatContext *s, AVPacket *pkt)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int pva_read_header(AVFormatContext *s)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rb16(AVIOContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
#define PVA_VIDEO_PAYLOAD
static int read_part_of_packet(AVFormatContext *s, int64_t *pts, int *len, int *strid, int read_packet)
unsigned int avio_rb32(AVIOContext *s)
enum AVStreamParseType need_parsing
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
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 AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int pva_check(const uint8_t *p)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int64_t ff_parse_pes_pts(const uint8_t *buf)
Parse MPEG-PES five-byte timestamp.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define PVA_AUDIO_PAYLOAD
unsigned int avio_rb24(AVIOContext *s)
static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit)
AVInputFormat ff_pva_demuxer
preferred ID for MPEG-1/2 video decoding
static int read_header(FFV1Context *f)
#define PVA_MAX_PAYLOAD_LENGTH
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
This structure contains the data a format has to probe a file.
static int64_t pts
Global timestamp for the audio frames.
static int pva_probe(AVProbeData *pd)
void * priv_data
Format private data.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.