40 #define CHUNK_PREAMBLE_SIZE 4 
   41 #define OPCODE_PREAMBLE_SIZE 4 
   43 #define CHUNK_INIT_AUDIO   0x0000 
   44 #define CHUNK_AUDIO_ONLY   0x0001 
   45 #define CHUNK_INIT_VIDEO   0x0002 
   46 #define CHUNK_VIDEO        0x0003 
   47 #define CHUNK_SHUTDOWN     0x0004 
   48 #define CHUNK_END          0x0005 
   50 #define CHUNK_DONE         0xFFFC 
   51 #define CHUNK_NOMEM        0xFFFD 
   52 #define CHUNK_EOF          0xFFFE 
   53 #define CHUNK_BAD          0xFFFF 
   55 #define OPCODE_END_OF_STREAM           0x00 
   56 #define OPCODE_END_OF_CHUNK            0x01 
   57 #define OPCODE_CREATE_TIMER            0x02 
   58 #define OPCODE_INIT_AUDIO_BUFFERS      0x03 
   59 #define OPCODE_START_STOP_AUDIO        0x04 
   60 #define OPCODE_INIT_VIDEO_BUFFERS      0x05 
   61 #define OPCODE_UNKNOWN_06              0x06 
   62 #define OPCODE_SEND_BUFFER             0x07 
   63 #define OPCODE_AUDIO_FRAME             0x08 
   64 #define OPCODE_SILENCE_FRAME           0x09 
   65 #define OPCODE_INIT_VIDEO_MODE         0x0A 
   66 #define OPCODE_CREATE_GRADIENT         0x0B 
   67 #define OPCODE_SET_PALETTE             0x0C 
   68 #define OPCODE_SET_PALETTE_COMPRESSED  0x0D 
   69 #define OPCODE_UNKNOWN_0E              0x0E 
   70 #define OPCODE_SET_DECODING_MAP        0x0F 
   71 #define OPCODE_UNKNOWN_10              0x10 
   72 #define OPCODE_VIDEO_DATA              0x11 
   73 #define OPCODE_UNKNOWN_12              0x12 
   74 #define OPCODE_UNKNOWN_13              0x13 
   75 #define OPCODE_UNKNOWN_14              0x14 
   76 #define OPCODE_UNKNOWN_15              0x15 
   78 #define PALETTE_COUNT 256 
  123                    "audio codec is known\n");
 
  250     unsigned char opcode_type;
 
  251     unsigned char opcode_version;
 
  253     unsigned char scratch[1024];
 
  255     int first_color, last_color;
 
  257     unsigned char r, 
g, 
b;
 
  271     chunk_size = 
AV_RL16(&chunk_preamble[0]);
 
  272     chunk_type = 
AV_RL16(&chunk_preamble[2]);
 
  276     switch (chunk_type) {
 
  309     while ((chunk_size > 0) && (chunk_type != 
CHUNK_BAD)) {
 
  322         opcode_size = 
AV_RL16(&opcode_preamble[0]);
 
  323         opcode_type = opcode_preamble[2];
 
  324         opcode_version = opcode_preamble[3];
 
  327         chunk_size -= opcode_size;
 
  328         if (chunk_size < 0) {
 
  335                 opcode_type, opcode_version, opcode_size);
 
  336         switch (opcode_type) {
 
  350             if ((opcode_version > 0) || (opcode_size != 6)) {
 
  355             if (
avio_read(pb, scratch, opcode_size) !=
 
  368             if (opcode_version > 1 || opcode_size > 10 || opcode_size < 6) {
 
  373             if (
avio_read(pb, scratch, opcode_size) !=
 
  379             audio_flags = 
AV_RL16(&scratch[2]);
 
  383             s->
audio_bits = (((audio_flags >> 1) & 1) + 1) * 8;
 
  385             if ((opcode_version == 1) && (audio_flags & 0x4))
 
  395                     "Interplay audio" : 
"PCM");
 
  405             if ((opcode_version > 2) || (opcode_size > 8) || opcode_size < 4
 
  406                 || opcode_version == 2 && opcode_size < 8
 
  412             if (
avio_read(pb, scratch, opcode_size) !=
 
  417             width  = 
AV_RL16(&scratch[0]) * 8;
 
  418             height = 
AV_RL16(&scratch[2]) * 8;
 
  427             if (opcode_version < 2 || !
AV_RL16(&scratch[6])) {
 
  480             if (opcode_size > 0x304 || opcode_size < 4) {
 
  485             if (
avio_read(pb, scratch, opcode_size) != opcode_size) {
 
  491             first_color = 
AV_RL16(&scratch[0]);
 
  492             last_color = first_color + 
AV_RL16(&scratch[2]) - 1;
 
  494             if (   (first_color > 0xFF) || (last_color > 0xFF)
 
  495                 || (last_color - first_color + 1)*3 + 4 > opcode_size) {
 
  497                     first_color, last_color);
 
  502             for (i = first_color; i <= last_color; i++) {
 
  505                 r = scratch[j++] * 4;
 
  506                 g = scratch[j++] * 4;
 
  507                 b = scratch[j++] * 4;
 
  508                 s->
palette[i] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
 
  558 static const char signature[] = 
"Interplay MVE File\x1A\0\x1A";
 
  585     avio_read(pb, signature_buffer, 
sizeof(signature_buffer));
 
  587         memmove(signature_buffer, signature_buffer + 1, 
sizeof(signature_buffer) - 1);
 
  588         signature_buffer[
sizeof(signature_buffer) - 1] = 
avio_r8(pb);
 
  600     for (i = 0; i < 256; i++)
 
  601         ipmovie->
palette[i] = 0xFFU << 24;
 
  612     chunk_type = 
AV_RL16(&chunk_preamble[2]);
 
#define OPCODE_SET_PALETTE_COMPRESSED
int64_t decode_map_chunk_offset
#define OPCODE_UNKNOWN_06
#define OPCODE_SEND_BUFFER
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
static int ipmovie_read_header(AVFormatContext *s)
#define OPCODE_VIDEO_DATA
int64_t pos
byte position in stream, -1 if unknown 
#define OPCODE_UNKNOWN_14
enum AVCodecID codec_id
Specific type of the encoded data (the codec used). 
int index
stream index in AVFormatContext 
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. 
#define AV_CH_LAYOUT_STEREO
int ctx_flags
Flags signalling stream properties. 
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
#define OPCODE_CREATE_GRADIENT
static int ipmovie_probe(AVProbeData *p)
static const char signature[]
#define OPCODE_UNKNOWN_12
int64_t audio_chunk_offset
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development. 
unsigned int audio_channels
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file. 
int decode_map_chunk_size
int64_t next_chunk_offset
#define AVERROR_EOF
End of file. 
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext. 
uint64_t channel_layout
Audio only. 
unsigned int video_height
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf. 
int64_t bit_rate
The average bitrate of the encoded data (in bits per second). 
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values. 
#define OPCODE_INIT_AUDIO_BUFFERS
AVCodecID
Identify the syntax and semantics of the bitstream. 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data. 
#define OPCODE_UNKNOWN_13
#define OPCODE_SET_DECODING_MAP
#define OPCODE_END_OF_CHUNK
int avio_r8(AVIOContext *s)
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. 
unsigned int nb_streams
Number of elements in AVFormatContext.streams. 
int block_align
Audio only. 
audio channel layout utility functions 
#define OPCODE_UNKNOWN_10
#define OPCODE_PREAMBLE_SIZE
#define OPCODE_START_STOP_AUDIO
#define OPCODE_UNKNOWN_0E
#define OPCODE_END_OF_STREAM
static int read_header(FFV1Context *f)
enum AVCodecID audio_type
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define OPCODE_INIT_VIDEO_MODE
AVIOContext * pb
I/O context. 
void av_packet_unref(AVPacket *pkt)
Wipe the packet. 
static int init_audio(AVFormatContext *s)
static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt)
#define OPCODE_INIT_VIDEO_BUFFERS
int64_t video_chunk_offset
This structure contains the data a format has to probe a file. 
static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt)
#define OPCODE_AUDIO_FRAME
#define OPCODE_CREATE_TIMER
int sample_rate
Audio only. 
#define OPCODE_SILENCE_FRAME
#define CHUNK_PREAMBLE_SIZE
AVInputFormat ff_ipmovie_demuxer
#define OPCODE_SET_PALETTE
unsigned int audio_frame_count
void * priv_data
Format private data. 
#define OPCODE_UNKNOWN_15
int bits_per_coded_sample
The number of bits per sample in the codedwords. 
static int ipmovie_read_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecParameters * codecpar
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext. 
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC). 
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet. 
#define AV_CH_LAYOUT_MONO
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data. 
unsigned int audio_sample_rate
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...