xmv.c
Go to the documentation of this file.
1 /*
2  * Microsoft XMV demuxer
3  * Copyright (c) 2011 Sven Hesse <drmccoy@drmccoy.de>
4  * Copyright (c) 2011 Matthew Hoops <clone2727@gmail.com>
5  *
6  * This file is part of Libav.
7  *
8  * Libav is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * Libav is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with Libav; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
28 #include <stdint.h>
29 
30 #include "libavutil/intreadwrite.h"
31 
32 #include "avformat.h"
33 #include "internal.h"
34 #include "riff.h"
35 
36 #define XMV_MIN_HEADER_SIZE 36
37 
38 #define XMV_AUDIO_ADPCM51_FRONTLEFTRIGHT 1
39 #define XMV_AUDIO_ADPCM51_FRONTCENTERLOW 2
40 #define XMV_AUDIO_ADPCM51_REARLEFTRIGHT 4
41 
42 #define XMV_AUDIO_ADPCM51 (XMV_AUDIO_ADPCM51_FRONTLEFTRIGHT | \
43  XMV_AUDIO_ADPCM51_FRONTCENTERLOW | \
44  XMV_AUDIO_ADPCM51_REARLEFTRIGHT)
45 
46 #define XMV_BLOCK_ALIGN_SIZE 36
47 
48 typedef struct XMVAudioTrack {
49  uint16_t compression;
50  uint16_t channels;
51  uint32_t sample_rate;
52  uint16_t bits_per_sample;
53  uint32_t bit_rate;
54  uint16_t flags;
55  uint16_t block_align;
56  uint16_t block_samples;
57 
60 
61 typedef struct XMVVideoPacket {
62  /* The decoder stream index for this video packet. */
64 
65  uint32_t data_size;
66  uint32_t data_offset;
67 
68  uint32_t current_frame;
69  uint32_t frame_count;
70 
71  /* Does the video packet contain extra data? */
73 
74  /* Extra data */
76 
77  int64_t last_pts;
78  int64_t pts;
80 
81 typedef struct XMVAudioPacket {
82  /* The decoder stream index for this audio packet. */
84 
85  /* The audio track this packet encodes. */
87 
88  uint32_t data_size;
89  uint32_t data_offset;
90 
91  uint32_t frame_size;
92 
93  uint32_t block_count;
95 
96 typedef struct XMVDemuxContext {
98 
100 
103 
106 
107  uint16_t current_stream;
108  uint16_t stream_count;
109 
113 
114 static int xmv_probe(AVProbeData *p)
115 {
116  uint32_t file_version;
117 
118  if (p->buf_size < XMV_MIN_HEADER_SIZE)
119  return 0;
120 
121  file_version = AV_RL32(p->buf + 16);
122  if ((file_version == 0) || (file_version > 4))
123  return 0;
124 
125  if (!memcmp(p->buf + 12, "xobX", 4))
126  return AVPROBE_SCORE_MAX;
127 
128  return 0;
129 }
130 
132 {
133  XMVDemuxContext *xmv = s->priv_data;
134 
135  av_free(xmv->audio);
136  av_free(xmv->audio_tracks);
137 
138  return 0;
139 }
140 
142 {
143  XMVDemuxContext *xmv = s->priv_data;
144  AVIOContext *pb = s->pb;
145  AVStream *vst = NULL;
146 
147  uint32_t file_version;
148  uint32_t this_packet_size;
149  uint16_t audio_track;
150  int ret;
151 
152  avio_skip(pb, 4); /* Next packet size */
153 
154  this_packet_size = avio_rl32(pb);
155 
156  avio_skip(pb, 4); /* Max packet size */
157  avio_skip(pb, 4); /* "xobX" */
158 
159  file_version = avio_rl32(pb);
160  if ((file_version != 4) && (file_version != 2))
161  av_log_ask_for_sample(s, "Found uncommon version %d\n", file_version);
162 
163 
164  /* Video track */
165 
166  vst = avformat_new_stream(s, NULL);
167  if (!vst)
168  return AVERROR(ENOMEM);
169 
170  avpriv_set_pts_info(vst, 32, 1, 1000);
171 
174  vst->codec->codec_tag = MKBETAG('W', 'M', 'V', '2');
175  vst->codec->width = avio_rl32(pb);
176  vst->codec->height = avio_rl32(pb);
177 
178  vst->duration = avio_rl32(pb);
179 
180  xmv->video.stream_index = vst->index;
181 
182  /* Audio tracks */
183 
184  xmv->audio_track_count = avio_rl16(pb);
185 
186  avio_skip(pb, 2); /* Unknown (padding?) */
187 
188  xmv->audio_tracks = av_malloc(xmv->audio_track_count * sizeof(XMVAudioTrack));
189  if (!xmv->audio_tracks)
190  return AVERROR(ENOMEM);
191 
192  xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket));
193  if (!xmv->audio) {
194  ret = AVERROR(ENOMEM);
195  goto fail;
196  }
197 
198  for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) {
199  XMVAudioTrack *track = &xmv->audio_tracks[audio_track];
200  XMVAudioPacket *packet = &xmv->audio [audio_track];
201  AVStream *ast = NULL;
202 
203  track->compression = avio_rl16(pb);
204  track->channels = avio_rl16(pb);
205  track->sample_rate = avio_rl32(pb);
206  track->bits_per_sample = avio_rl16(pb);
207  track->flags = avio_rl16(pb);
208 
209  track->bit_rate = track->bits_per_sample *
210  track->sample_rate *
211  track->channels;
212  track->block_align = XMV_BLOCK_ALIGN_SIZE * track->channels;
213  track->block_samples = 64;
214  track->codec_id = ff_wav_codec_get_id(track->compression,
215  track->bits_per_sample);
216 
217  packet->track = track;
218  packet->stream_index = -1;
219 
220  packet->frame_size = 0;
221  packet->block_count = 0;
222 
223  /* TODO: ADPCM'd 5.1 sound is encoded in three separate streams.
224  * Those need to be interleaved to a proper 5.1 stream. */
225  if (track->flags & XMV_AUDIO_ADPCM51)
226  av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
227  "(0x%04X)\n", track->flags);
228 
229  if (!track->channels || !track->sample_rate ||
230  track->channels >= UINT16_MAX / XMV_BLOCK_ALIGN_SIZE) {
231  av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %d.\n",
232  audio_track);
233  ret = AVERROR_INVALIDDATA;
234  goto fail;
235  }
236 
237  ast = avformat_new_stream(s, NULL);
238  if (!ast) {
239  ret = AVERROR(ENOMEM);
240  goto fail;
241  }
242 
244  ast->codec->codec_id = track->codec_id;
245  ast->codec->codec_tag = track->compression;
246  ast->codec->channels = track->channels;
247  ast->codec->sample_rate = track->sample_rate;
249  ast->codec->bit_rate = track->bit_rate;
250  ast->codec->block_align = 36 * track->channels;
251 
252  avpriv_set_pts_info(ast, 32, track->block_samples, track->sample_rate);
253 
254  packet->stream_index = ast->index;
255 
256  ast->duration = vst->duration;
257  }
258 
259 
262  xmv->next_packet_offset = avio_tell(pb);
263  xmv->next_packet_size = this_packet_size - xmv->next_packet_offset;
264  xmv->stream_count = xmv->audio_track_count + 1;
265 
266  return 0;
267 
268 fail:
269  xmv_read_close(s);
270  return ret;
271 }
272 
273 static void xmv_read_extradata(uint8_t *extradata, AVIOContext *pb)
274 {
275  /* Read the XMV extradata */
276 
277  uint32_t data = avio_rl32(pb);
278 
279  int mspel_bit = !!(data & 0x01);
280  int loop_filter = !!(data & 0x02);
281  int abt_flag = !!(data & 0x04);
282  int j_type_bit = !!(data & 0x08);
283  int top_left_mv_flag = !!(data & 0x10);
284  int per_mb_rl_bit = !!(data & 0x20);
285  int slice_count = (data >> 6) & 7;
286 
287  /* Write it back as standard WMV2 extradata */
288 
289  data = 0;
290 
291  data |= mspel_bit << 15;
292  data |= loop_filter << 14;
293  data |= abt_flag << 13;
294  data |= j_type_bit << 12;
295  data |= top_left_mv_flag << 11;
296  data |= per_mb_rl_bit << 10;
297  data |= slice_count << 7;
298 
299  AV_WB32(extradata, data);
300 }
301 
303 {
304  XMVDemuxContext *xmv = s->priv_data;
305  AVIOContext *pb = s->pb;
306 
307  uint8_t data[8];
308  uint16_t audio_track;
309  uint32_t data_offset;
310 
311  /* Next packet size */
312  xmv->next_packet_size = avio_rl32(pb);
313 
314  /* Packet video header */
315 
316  if (avio_read(pb, data, 8) != 8)
317  return AVERROR(EIO);
318 
319  xmv->video.data_size = AV_RL32(data) & 0x007FFFFF;
320 
321  xmv->video.current_frame = 0;
322  xmv->video.frame_count = (AV_RL32(data) >> 23) & 0xFF;
323 
324  xmv->video.has_extradata = (data[3] & 0x80) != 0;
325 
326  /* Adding the audio data sizes and the video data size keeps you 4 bytes
327  * short for every audio track. But as playing around with XMV files with
328  * ADPCM audio showed, taking the extra 4 bytes from the audio data gives
329  * you either completely distorted audio or click (when skipping the
330  * remaining 68 bytes of the ADPCM block). Subtracting 4 bytes for every
331  * audio track from the video data works at least for the audio. Probably
332  * some alignment thing?
333  * The video data has (always?) lots of padding, so it should work out...
334  */
335  xmv->video.data_size -= xmv->audio_track_count * 4;
336 
337  xmv->current_stream = 0;
338  if (!xmv->video.frame_count) {
339  xmv->video.frame_count = 1;
340  xmv->current_stream = 1;
341  }
342 
343  /* Packet audio header */
344 
345  for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) {
346  XMVAudioPacket *packet = &xmv->audio[audio_track];
347 
348  if (avio_read(pb, data, 4) != 4)
349  return AVERROR(EIO);
350 
351  packet->data_size = AV_RL32(data) & 0x007FFFFF;
352  if ((packet->data_size == 0) && (audio_track != 0))
353  /* This happens when I create an XMV with several identical audio
354  * streams. From the size calculations, duplicating the previous
355  * stream's size works out, but the track data itself is silent.
356  * Maybe this should also redirect the offset to the previous track?
357  */
358  packet->data_size = xmv->audio[audio_track - 1].data_size;
359 
361  packet->frame_size = packet->data_size / xmv->video.frame_count;
362  packet->frame_size -= packet->frame_size % packet->track->block_align;
363  }
364 
365  /* Packet data offsets */
366 
367  data_offset = avio_tell(pb);
368 
369  xmv->video.data_offset = data_offset;
370  data_offset += xmv->video.data_size;
371 
372  for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) {
373  xmv->audio[audio_track].data_offset = data_offset;
374  data_offset += xmv->audio[audio_track].data_size;
375  }
376 
377  /* Video frames header */
378 
379  /* Read new video extra data */
380  if (xmv->video.data_size > 0) {
381  if (xmv->video.has_extradata) {
383 
384  xmv->video.data_size -= 4;
385  xmv->video.data_offset += 4;
386 
387  if (xmv->video.stream_index >= 0) {
388  AVStream *vst = s->streams[xmv->video.stream_index];
389 
390  assert(xmv->video.stream_index < s->nb_streams);
391 
392  if (vst->codec->extradata_size < 4) {
393  av_free(vst->codec->extradata);
394 
395  vst->codec->extradata =
397  vst->codec->extradata_size = 4;
398  }
399 
400  memcpy(vst->codec->extradata, xmv->video.extradata, 4);
401  }
402  }
403  }
404 
405  return 0;
406 }
407 
409 {
410  XMVDemuxContext *xmv = s->priv_data;
411  AVIOContext *pb = s->pb;
412  int result;
413 
414  /* Seek to it */
416  if (avio_seek(pb, xmv->this_packet_offset, SEEK_SET) != xmv->this_packet_offset)
417  return AVERROR(EIO);
418 
419  /* Update the size */
421  if (xmv->this_packet_size < (12 + xmv->audio_track_count * 4))
422  return AVERROR(EIO);
423 
424  /* Process the header */
425  result = xmv_process_packet_header(s);
426  if (result)
427  return result;
428 
429  /* Update the offset */
431 
432  return 0;
433 }
434 
436  AVPacket *pkt, uint32_t stream)
437 {
438  XMVDemuxContext *xmv = s->priv_data;
439  AVIOContext *pb = s->pb;
440  XMVAudioPacket *audio = &xmv->audio[stream];
441 
442  uint32_t data_size;
443  uint32_t block_count;
444  int result;
445 
446  /* Seek to it */
447  if (avio_seek(pb, audio->data_offset, SEEK_SET) != audio->data_offset)
448  return AVERROR(EIO);
449 
450  if ((xmv->video.current_frame + 1) < xmv->video.frame_count)
451  /* Not the last frame, get at most frame_size bytes. */
452  data_size = FFMIN(audio->frame_size, audio->data_size);
453  else
454  /* Last frame, get the rest. */
455  data_size = audio->data_size;
456 
457  /* Read the packet */
458  result = av_get_packet(pb, pkt, data_size);
459  if (result <= 0)
460  return result;
461 
462  pkt->stream_index = audio->stream_index;
463 
464  /* Calculate the PTS */
465 
466  block_count = data_size / audio->track->block_align;
467 
468  pkt->duration = block_count;
469  pkt->pts = audio->block_count;
470  pkt->dts = AV_NOPTS_VALUE;
471 
472  audio->block_count += block_count;
473 
474  /* Advance offset */
475  audio->data_size -= data_size;
476  audio->data_offset += data_size;
477 
478  return 0;
479 }
480 
482  AVPacket *pkt)
483 {
484  XMVDemuxContext *xmv = s->priv_data;
485  AVIOContext *pb = s->pb;
486  XMVVideoPacket *video = &xmv->video;
487 
488  int result;
489  uint32_t frame_header;
490  uint32_t frame_size, frame_timestamp;
491  uint32_t i;
492 
493  /* Seek to it */
494  if (avio_seek(pb, video->data_offset, SEEK_SET) != video->data_offset)
495  return AVERROR(EIO);
496 
497  /* Read the frame header */
498  frame_header = avio_rl32(pb);
499 
500  frame_size = (frame_header & 0x1FFFF) * 4 + 4;
501  frame_timestamp = (frame_header >> 17);
502 
503  if ((frame_size + 4) > video->data_size)
504  return AVERROR(EIO);
505 
506  /* Create the packet */
507  result = av_new_packet(pkt, frame_size);
508  if (result)
509  return result;
510 
511  /* Contrary to normal WMV2 video, the bit stream in XMV's
512  * WMV2 is little-endian.
513  * TODO: This manual swap is of course suboptimal.
514  */
515  for (i = 0; i < frame_size; i += 4)
516  AV_WB32(pkt->data + i, avio_rl32(pb));
517 
518  pkt->stream_index = video->stream_index;
519 
520  /* Calculate the PTS */
521 
522  video->last_pts = frame_timestamp + video->pts;
523 
524  pkt->duration = 0;
525  pkt->pts = video->last_pts;
526  pkt->dts = AV_NOPTS_VALUE;
527 
528  video->pts += frame_timestamp;
529 
530  /* Keyframe? */
531  pkt->flags = (pkt->data[0] & 0x80) ? 0 : AV_PKT_FLAG_KEY;
532 
533  /* Advance offset */
534  video->data_size -= frame_size + 4;
535  video->data_offset += frame_size + 4;
536 
537  return 0;
538 }
539 
541  AVPacket *pkt)
542 {
543  XMVDemuxContext *xmv = s->priv_data;
544  int result;
545 
546  if (xmv->video.current_frame == xmv->video.frame_count) {
547  /* No frames left in this packet, so we fetch a new one */
548 
549  result = xmv_fetch_new_packet(s);
550  if (result)
551  return result;
552  }
553 
554  if (xmv->current_stream == 0) {
555  /* Fetch a video frame */
556 
557  result = xmv_fetch_video_packet(s, pkt);
558  if (result)
559  return result;
560 
561  } else {
562  /* Fetch an audio frame */
563 
564  result = xmv_fetch_audio_packet(s, pkt, xmv->current_stream - 1);
565  if (result)
566  return result;
567  }
568 
569  /* Increase our counters */
570  if (++xmv->current_stream >= xmv->stream_count) {
571  xmv->current_stream = 0;
572  xmv->video.current_frame += 1;
573  }
574 
575  return 0;
576 }
577 
579  .name = "xmv",
580  .long_name = NULL_IF_CONFIG_SMALL("Microsoft XMV"),
581  .priv_data_size = sizeof(XMVDemuxContext),
586 };
uint32_t next_packet_size
Definition: xmv.c:102
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:61
Bytestream IO Context.
Definition: avio.h:68
uint32_t data_offset
Definition: xmv.c:66
XMVAudioTrack * audio_tracks
Definition: xmv.c:99
XMVAudioPacket * audio
Definition: xmv.c:111
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:3283
XMVVideoPacket video
Definition: xmv.c:110
int index
stream index in AVFormatContext
Definition: avformat.h:623
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:186
uint16_t block_align
Definition: xmv.c:55
static int xmv_fetch_new_packet(AVFormatContext *s)
Definition: xmv.c:408
static void xmv_read_extradata(uint8_t *extradata, AVIOContext *pb)
Definition: xmv.c:273
struct XMVDemuxContext XMVDemuxContext
enum AVCodecID codec_id
Definition: xmv.c:58
static int xmv_probe(AVProbeData *p)
Definition: xmv.c:114
static int xmv_fetch_video_packet(AVFormatContext *s, AVPacket *pkt)
Definition: xmv.c:481
uint32_t data_size
Definition: xmv.c:88
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:2141
static int xmv_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: xmv.c:540
uint32_t data_size
Definition: xmv.c:65
uint32_t block_count
Definition: xmv.c:93
Format I/O context.
Definition: avformat.h:828
uint16_t stream_count
Definition: xmv.c:108
struct XMVAudioPacket XMVAudioPacket
struct XMVAudioTrack XMVAudioTrack
uint8_t
#define AV_WB32(p, d)
Definition: intreadwrite.h:239
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1454
AVStream ** streams
Definition: avformat.h:876
uint32_t frame_count
Definition: xmv.c:69
uint32_t this_packet_size
Definition: xmv.c:101
const char data[16]
Definition: mxf.c:66
uint8_t * data
Definition: avcodec.h:915
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:218
int64_t last_pts
Definition: xmv.c:77
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:219
uint32_t frame_size
Definition: xmv.c:91
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2704
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:937
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:446
static const uint8_t frame_size[4]
Definition: g723_1_data.h:47
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:56
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:95
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:139
struct XMVVideoPacket XMVVideoPacket
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:546
uint16_t compression
Definition: xmv.c:49
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:88
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:146
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:2736
#define XMV_AUDIO_ADPCM51
Definition: xmv.c:42
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:921
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:641
uint16_t current_stream
Definition: xmv.c:107
uint32_t bit_rate
Definition: xmv.c:53
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:341
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:340
uint8_t extradata[4]
Definition: xmv.c:75
unsigned int nb_streams
A list of all streams in the file.
Definition: avformat.h:875
uint32_t sample_rate
Definition: xmv.c:51
int stream_index
Definition: xmv.c:63
uint16_t bits_per_sample
Definition: xmv.c:52
int bit_rate
the average bitrate
Definition: avcodec.h:1404
static int xmv_read_header(AVFormatContext *s)
Definition: xmv.c:141
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:54
int width
picture width / height.
Definition: avcodec.h:1508
AVInputFormat ff_xmv_demuxer
Definition: xmv.c:578
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: avio.h:210
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
uint32_t next_packet_offset
Definition: xmv.c:105
#define XMV_MIN_HEADER_SIZE
Definition: xmv.c:36
int64_t pts
Definition: xmv.c:78
#define AV_RL32
Definition: intreadwrite.h:146
static int xmv_process_packet_header(AVFormatContext *s)
Definition: xmv.c:302
uint16_t block_samples
Definition: xmv.c:56
static void loop_filter(H264Context *h, int start_x, int end_x)
Definition: h264.c:3539
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:536
Stream structure.
Definition: avformat.h:622
NULL
Definition: eval.c:52
enum AVMediaType codec_type
Definition: avcodec.h:1347
enum AVCodecID codec_id
Definition: avcodec.h:1350
int sample_rate
samples per second
Definition: avcodec.h:2104
AVIOContext * pb
I/O context.
Definition: avformat.h:861
static int xmv_fetch_audio_packet(AVFormatContext *s, AVPacket *pkt, uint32_t stream)
Definition: xmv.c:435
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1365
#define XMV_BLOCK_ALIGN_SIZE
Definition: xmv.c:46
int extradata_size
Definition: avcodec.h:1455
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
uint32_t data_offset
Definition: xmv.c:89
uint16_t audio_track_count
Definition: xmv.c:97
This structure contains the data a format has to probe a file.
Definition: avformat.h:338
int has_extradata
Definition: xmv.c:72
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:684
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:530
Main libavformat public API header.
enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps)
XMVAudioTrack * track
Definition: xmv.c:86
uint16_t channels
Definition: xmv.c:50
int channels
number of audio channels
Definition: avcodec.h:2105
void * priv_data
Format private data.
Definition: avformat.h:848
uint32_t current_frame
Definition: xmv.c:68
int stream_index
Definition: xmv.c:83
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:914
uint32_t this_packet_offset
Definition: xmv.c:104
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:455
static int xmv_read_close(AVFormatContext *s)
Definition: xmv.c:131
int stream_index
Definition: avcodec.h:917
This structure stores compressed data.
Definition: avcodec.h:898
uint16_t flags
Definition: xmv.c:54
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:908