30 #include "libavutil/intreadwrite.h"
35 #include "libavutil/avassert.h"
38 #define XMV_MIN_HEADER_SIZE 36
41 #define XMV_AUDIO_ADPCM51_FRONTLEFTRIGHT 1
43 #define XMV_AUDIO_ADPCM51_FRONTCENTERLOW 2
45 #define XMV_AUDIO_ADPCM51_REARLEFTRIGHT 4
48 #define XMV_AUDIO_ADPCM51 (XMV_AUDIO_ADPCM51_FRONTLEFTRIGHT | \
49 XMV_AUDIO_ADPCM51_FRONTCENTERLOW | \
50 XMV_AUDIO_ADPCM51_REARLEFTRIGHT)
52 #define XMV_BLOCK_ALIGN_SIZE 36
114 uint32_t file_version;
120 if ((file_version == 0) || (file_version > 4))
123 if (!memcmp(p->
buf + 12,
"xobX", 4))
144 uint32_t file_version;
145 uint32_t this_packet_size;
146 uint16_t audio_track;
157 if ((file_version != 4) && (file_version != 2))
218 "(0x%04X)\n", packet->
flags);
270 int mspel_bit = !!(data & 0x01);
272 int abt_flag = !!(data & 0x04);
273 int j_type_bit = !!(data & 0x08);
274 int top_left_mv_flag = !!(data & 0x10);
275 int per_mb_rl_bit = !!(data & 0x20);
276 int slice_count = (data >> 6) & 7;
282 data |= mspel_bit << 15;
283 data |= loop_filter << 14;
284 data |= abt_flag << 13;
285 data |= j_type_bit << 12;
286 data |= top_left_mv_flag << 11;
287 data |= per_mb_rl_bit << 10;
288 data |= slice_count << 7;
299 uint16_t audio_track;
300 uint64_t data_offset;
343 if ((packet->
data_size == 0) && (audio_track != 0))
435 uint32_t block_count;
492 frame_size = (frame_header & 0x1FFFF) * 4 + 4;
493 frame_timestamp = (frame_header >> 17);
500 if (result != frame_size)
507 for (data = pkt->
data, end = pkt->
data + frame_size; data < end; data += 4)
520 video->
pts += frame_timestamp;
uint32_t next_packet_size
Size of the next packet.
uint16_t compression
The type of compression.
XMVAudioPacket * audio
The audio packets contained in each packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
XMVVideoPacket video
The video packet contained in each packet.
AVCodecContext * codec
Codec context associated with this stream.
int index
stream index in AVFormatContext
uint64_t data_offset
The offset of the audio data within the file.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static int xmv_fetch_new_packet(AVFormatContext *s)
static void xmv_read_extradata(uint8_t *extradata, AVIOContext *pb)
static int xmv_probe(AVProbeData *p)
static int xmv_fetch_video_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t data_size
The size of the remaining audio data.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
static int xmv_read_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
uint32_t data_size
The size of the remaining video data.
uint16_t stream_count
The number of streams in this file.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static av_cold int end(AVCodecContext *avctx)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
An audio packet with an XMV file.
uint32_t frame_count
The amount of frames within this video packet.
uint32_t this_packet_size
Size of the current packet.
static av_cold int read_close(AVFormatContext *ctx)
uint64_t data_offset
The offset of the video data within the file.
int64_t last_pts
PTS of the last video frame.
uint32_t frame_size
Number of bytes to put into an audio frame.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static const uint8_t frame_size[4]
AVCodecID
Identify the syntax and semantics of the bitstream.
A video packet with an XMV file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
uint64_t block_count
Running counter of decompressed audio block.
uint16_t bits_per_sample
Bits per compressed sample.
uint32_t sample_rate
Sampling rate.
void * priv_data
Format private data.
Context for demuxing an XMV file.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
uint64_t next_packet_offset
Offset of the next packet.
unsigned block_align
Bytes per compressed block.
#define XMV_AUDIO_ADPCM51
Audio flag: Any of the ADPCM'd 5.1 stream flags.
uint64_t this_packet_offset
Offset of the current packet.
int flags
A combination of AV_PKT_FLAG values.
uint16_t current_stream
The index of the stream currently handling.
int buf_size
Size of buf except extra allocated bytes.
uint8_t extradata[4]
The extra data.
unsigned int nb_streams
A list of all streams in the file.
int stream_index
The decoder stream index for this video packet.
int bit_rate
the average bitrate
static int xmv_read_header(AVFormatContext *s)
int width
picture width / height.
AVInputFormat ff_xmv_demuxer
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
#define XMV_MIN_HEADER_SIZE
The min size of an XMV header.
int64_t pts
PTS of the most current video frame.
static int xmv_process_packet_header(AVFormatContext *s)
static void loop_filter(H264Context *h, int start_x, int end_x)
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
static int xmv_fetch_audio_packet(AVFormatContext *s, AVPacket *pkt, uint32_t stream)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
#define XMV_BLOCK_ALIGN_SIZE
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
uint16_t audio_track_count
Number of audio track in this file.
uint16_t channels
Number of channels.
enum AVCodecID codec_id
The codec ID of the compression scheme.
uint32_t bit_rate
Bits of compressed data per second.
This structure contains the data a format has to probe a file.
#define MKBETAG(a, b, c, d)
int has_extradata
Does the video packet contain extra data?
int64_t duration
Decoding: duration of the stream, in stream time base.
enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps)
uint16_t block_samples
Decompressed samples per compressed block.
#define AVERROR_INVALIDDATA
int channels
number of audio channels
uint32_t current_frame
The current frame within this video packet.
int stream_index
The decoder stream index for this audio packet.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static int xmv_read_close(AVFormatContext *s)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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.