FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
electronicarts.c
Go to the documentation of this file.
1 /* Electronic Arts Multimedia File Demuxer
2  * Copyright (c) 2004 The FFmpeg Project
3  * Copyright (c) 2006-2008 Peter Ross
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * Electronic Arts Multimedia file demuxer (WVE/UV2/etc.)
25  * by Robin Kay (komadori at gekkou.co.uk)
26  */
27 
28 #include <inttypes.h>
29 
30 #include "libavutil/intreadwrite.h"
31 #include "avformat.h"
32 #include "internal.h"
33 
34 #define SCHl_TAG MKTAG('S', 'C', 'H', 'l')
35 #define SEAD_TAG MKTAG('S', 'E', 'A', 'D') /* Sxxx header */
36 #define SNDC_TAG MKTAG('S', 'N', 'D', 'C') /* Sxxx data */
37 #define SEND_TAG MKTAG('S', 'E', 'N', 'D') /* Sxxx end */
38 #define SHEN_TAG MKTAG('S', 'H', 'E', 'N') /* SxEN header */
39 #define SDEN_TAG MKTAG('S', 'D', 'E', 'N') /* SxEN data */
40 #define SEEN_TAG MKTAG('S', 'E', 'E', 'N') /* SxEN end */
41 #define ISNh_TAG MKTAG('1', 'S', 'N', 'h') /* 1SNx header */
42 #define EACS_TAG MKTAG('E', 'A', 'C', 'S')
43 #define ISNd_TAG MKTAG('1', 'S', 'N', 'd') /* 1SNx data */
44 #define ISNe_TAG MKTAG('1', 'S', 'N', 'e') /* 1SNx end */
45 #define PT00_TAG MKTAG('P', 'T', 0x0, 0x0)
46 #define GSTR_TAG MKTAG('G', 'S', 'T', 'R')
47 #define SCDl_TAG MKTAG('S', 'C', 'D', 'l')
48 #define SCEl_TAG MKTAG('S', 'C', 'E', 'l')
49 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T') /* TGV I-frame */
50 #define fVGT_TAG MKTAG('f', 'V', 'G', 'T') /* TGV P-frame */
51 #define mTCD_TAG MKTAG('m', 'T', 'C', 'D') /* MDEC */
52 #define MADk_TAG MKTAG('M', 'A', 'D', 'k') /* MAD I-frame */
53 #define MADm_TAG MKTAG('M', 'A', 'D', 'm') /* MAD P-frame */
54 #define MADe_TAG MKTAG('M', 'A', 'D', 'e') /* MAD lqp-frame */
55 #define MPCh_TAG MKTAG('M', 'P', 'C', 'h') /* MPEG-2 */
56 #define TGQs_TAG MKTAG('T', 'G', 'Q', 's') /* TGQ I-frame (appears in .TGQ files) */
57 #define pQGT_TAG MKTAG('p', 'Q', 'G', 'T') /* TGQ I-frame (appears in .UV files) */
58 #define pIQT_TAG MKTAG('p', 'I', 'Q', 'T') /* TQI/UV2 I-frame (.UV2/.WVE) */
59 #define MVhd_TAG MKTAG('M', 'V', 'h', 'd')
60 #define MV0K_TAG MKTAG('M', 'V', '0', 'K')
61 #define MV0F_TAG MKTAG('M', 'V', '0', 'F')
62 #define AVhd_TAG MKTAG('A', 'V', 'h', 'd')
63 #define AV0K_TAG MKTAG('A', 'V', '0', 'K')
64 #define AV0F_TAG MKTAG('A', 'V', '0', 'F')
65 #define MVIh_TAG MKTAG('M', 'V', 'I', 'h') /* CMV header */
66 #define MVIf_TAG MKTAG('M', 'V', 'I', 'f') /* CMV I-frame */
67 #define AVP6_TAG MKTAG('A', 'V', 'P', '6')
68 
69 typedef struct VideoProperties {
72  int width, height;
73  int nb_frames;
76 
77 typedef struct EaDemuxContext {
79 
81 
84 
85  int bytes;
90 
91 static uint32_t read_arbitrary(AVIOContext *pb)
92 {
93  uint8_t size, byte;
94  int i;
95  uint32_t word;
96 
97  size = avio_r8(pb);
98 
99  word = 0;
100  for (i = 0; i < size; i++) {
101  byte = avio_r8(pb);
102  word <<= 8;
103  word |= byte;
104  }
105 
106  return word;
107 }
108 
110 {
111  EaDemuxContext *ea = s->priv_data;
112  AVIOContext *pb = s->pb;
113  int in_header = 1;
114  int compression_type = -1, revision = -1, revision2 = -1;
115 
116  ea->bytes = 2;
117  ea->sample_rate = -1;
118  ea->num_channels = 1;
119 
120  while (!avio_feof(pb) && in_header) {
121  int in_subheader;
122  uint8_t byte;
123  byte = avio_r8(pb);
124 
125  switch (byte) {
126  case 0xFD:
127  av_log(s, AV_LOG_DEBUG, "entered audio subheader\n");
128  in_subheader = 1;
129  while (!avio_feof(pb) && in_subheader) {
130  uint8_t subbyte;
131  subbyte = avio_r8(pb);
132 
133  switch (subbyte) {
134  case 0x80:
135  revision = read_arbitrary(pb);
136  av_log(s, AV_LOG_DEBUG,
137  "revision (element 0x80) set to 0x%08x\n", revision);
138  break;
139  case 0x82:
140  ea->num_channels = read_arbitrary(pb);
141  av_log(s, AV_LOG_DEBUG,
142  "num_channels (element 0x82) set to 0x%08x\n",
143  ea->num_channels);
144  break;
145  case 0x83:
146  compression_type = read_arbitrary(pb);
147  av_log(s, AV_LOG_DEBUG,
148  "compression_type (element 0x83) set to 0x%08x\n",
149  compression_type);
150  break;
151  case 0x84:
152  ea->sample_rate = read_arbitrary(pb);
153  av_log(s, AV_LOG_DEBUG,
154  "sample_rate (element 0x84) set to %i\n",
155  ea->sample_rate);
156  break;
157  case 0x85:
158  ea->num_samples = read_arbitrary(pb);
159  av_log(s, AV_LOG_DEBUG,
160  "num_samples (element 0x85) set to 0x%08x\n",
161  ea->num_samples);
162  break;
163  case 0x8A:
164  av_log(s, AV_LOG_DEBUG,
165  "element 0x%02x set to 0x%08"PRIx32"\n",
166  subbyte, read_arbitrary(pb));
167  av_log(s, AV_LOG_DEBUG, "exited audio subheader\n");
168  in_subheader = 0;
169  break;
170  case 0xA0:
171  revision2 = read_arbitrary(pb);
172  av_log(s, AV_LOG_DEBUG,
173  "revision2 (element 0xA0) set to 0x%08x\n",
174  revision2);
175  break;
176  case 0xFF:
177  av_log(s, AV_LOG_DEBUG,
178  "end of header block reached (within audio subheader)\n");
179  in_subheader = 0;
180  in_header = 0;
181  break;
182  default:
183  av_log(s, AV_LOG_DEBUG,
184  "element 0x%02x set to 0x%08"PRIx32"\n",
185  subbyte, read_arbitrary(pb));
186  break;
187  }
188  }
189  break;
190  case 0xFF:
191  av_log(s, AV_LOG_DEBUG, "end of header block reached\n");
192  in_header = 0;
193  break;
194  default:
195  av_log(s, AV_LOG_DEBUG,
196  "header element 0x%02x set to 0x%08"PRIx32"\n",
197  byte, read_arbitrary(pb));
198  break;
199  }
200  }
201 
202  switch (compression_type) {
203  case 0:
205  break;
206  case 7:
208  break;
209  case -1:
210  switch (revision) {
211  case 1:
213  break;
214  case 2:
216  break;
217  case 3:
219  break;
220  case -1:
221  break;
222  default:
223  avpriv_request_sample(s, "stream type; revision=%i", revision);
224  return 0;
225  }
226  switch (revision2) {
227  case 8:
229  break;
230  case 10:
231  switch (revision) {
232  case -1:
233  case 2: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R1; break;
234  case 3: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
235  default:
236  avpriv_request_sample(s, "stream type; revision=%i, revision2=%i", revision, revision2);
237  return 0;
238  }
239  break;
240  case 16:
242  break;
243  case -1:
244  break;
245  default:
247  avpriv_request_sample(s, "stream type; revision2=%i", revision2);
248  return 0;
249  }
250  break;
251  default:
253  "stream type; compression_type=%i",
254  compression_type);
255  return 0;
256  }
257 
258  if (ea->sample_rate == -1)
259  ea->sample_rate = revision == 3 ? 48000 : 22050;
260 
261  return 1;
262 }
263 
265 {
266  EaDemuxContext *ea = s->priv_data;
267  AVIOContext *pb = s->pb;
268  int compression_type;
269 
270  ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
271  ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */
272  ea->num_channels = avio_r8(pb);
273  compression_type = avio_r8(pb);
274  avio_skip(pb, 13);
275 
276  switch (compression_type) {
277  case 0:
278  switch (ea->bytes) {
279  case 1:
281  break;
282  case 2:
284  break;
285  }
286  break;
287  case 1:
289  ea->bytes = 1;
290  break;
291  case 2:
293  break;
294  default:
296  "stream type; audio compression_type=%i",
297  compression_type);
298  }
299 }
300 
302 {
303  EaDemuxContext *ea = s->priv_data;
304  AVIOContext *pb = s->pb;
305 
306  ea->sample_rate = avio_rl32(pb);
307  ea->bytes = avio_rl32(pb); /* 1=8-bit, 2=16-bit */
308  ea->num_channels = avio_rl32(pb);
310 }
311 
313 {
314  AVIOContext *pb = s->pb;
315  avio_skip(pb, 4);
316  video->width = avio_rl16(pb);
317  video->height = avio_rl16(pb);
318  video->time_base = (AVRational) { 1, 15 };
319  video->codec = AV_CODEC_ID_MDEC;
320 }
321 
323 {
324  AVIOContext *pb = s->pb;
325 
326  avio_skip(pb, 8);
327  video->nb_frames = avio_rl32(pb);
328  avio_skip(pb, 4);
329  video->time_base.den = avio_rl32(pb);
330  video->time_base.num = avio_rl32(pb);
331  if (video->time_base.den <= 0 || video->time_base.num <= 0) {
332  av_log(s, AV_LOG_ERROR, "Timebase is invalid\n");
333  return AVERROR_INVALIDDATA;
334  }
335  video->codec = AV_CODEC_ID_VP6;
336 
337  return 1;
338 }
339 
341 {
342  int fps;
343 
344  avio_skip(s->pb, 10);
345  fps = avio_rl16(s->pb);
346  if (fps)
347  video->time_base = (AVRational) { 1, fps };
348  video->codec = AV_CODEC_ID_CMV;
349 }
350 
351 /* Process EA file header.
352  * Return 1 if the EA file is valid and successfully opened, 0 otherwise. */
354 {
355  uint32_t blockid, size = 0;
356  EaDemuxContext *ea = s->priv_data;
357  AVIOContext *pb = s->pb;
358  int i;
359 
360  for (i = 0; i < 5 && (!ea->audio_codec || !ea->video.codec); i++) {
361  uint64_t startpos = avio_tell(pb);
362  int err = 0;
363 
364  blockid = avio_rl32(pb);
365  size = avio_rl32(pb);
366  if (i == 0)
367  ea->big_endian = size > av_bswap32(size);
368  if (ea->big_endian)
369  size = av_bswap32(size);
370 
371  if (size < 8) {
372  av_log(s, AV_LOG_ERROR, "chunk size too small\n");
373  return AVERROR_INVALIDDATA;
374  }
375 
376  switch (blockid) {
377  case ISNh_TAG:
378  if (avio_rl32(pb) != EACS_TAG) {
379  avpriv_request_sample(s, "unknown 1SNh headerid");
380  return 0;
381  }
383  break;
384 
385  case SCHl_TAG:
386  case SHEN_TAG:
387  blockid = avio_rl32(pb);
388  if (blockid == GSTR_TAG) {
389  avio_skip(pb, 4);
390  } else if ((blockid & 0xFFFF) != PT00_TAG) {
391  avpriv_request_sample(s, "unknown SCHl headerid");
392  return 0;
393  }
395  break;
396 
397  case SEAD_TAG:
399  break;
400 
401  case MVIh_TAG:
403  break;
404 
405  case kVGT_TAG:
407  break;
408 
409  case mTCD_TAG:
411  break;
412 
413  case MPCh_TAG:
415  break;
416 
417  case pQGT_TAG:
418  case TGQs_TAG:
420  ea->video.time_base = (AVRational) { 1, 15 };
421  break;
422 
423  case pIQT_TAG:
425  ea->video.time_base = (AVRational) { 1, 15 };
426  break;
427 
428  case MADk_TAG:
430  avio_skip(pb, 6);
431  ea->video.time_base = (AVRational) { avio_rl16(pb), 1000 };
432  break;
433 
434  case MVhd_TAG:
435  err = process_video_header_vp6(s, &ea->video);
436  break;
437 
438  case AVhd_TAG:
439  err = process_video_header_vp6(s, &ea->alpha);
440  break;
441  }
442 
443  if (err < 0) {
444  av_log(s, AV_LOG_ERROR, "error parsing header: %i\n", err);
445  return err;
446  }
447 
448  avio_seek(pb, startpos + size, SEEK_SET);
449  }
450 
451  avio_seek(pb, 0, SEEK_SET);
452 
453  return 1;
454 }
455 
456 static int ea_probe(AVProbeData *p)
457 {
458  unsigned big_endian, size;
459 
460  switch (AV_RL32(&p->buf[0])) {
461  case ISNh_TAG:
462  case SCHl_TAG:
463  case SEAD_TAG:
464  case SHEN_TAG:
465  case kVGT_TAG:
466  case MADk_TAG:
467  case MPCh_TAG:
468  case MVhd_TAG:
469  case MVIh_TAG:
470  case AVP6_TAG:
471  break;
472  default:
473  return 0;
474  }
475  size = AV_RL32(&p->buf[4]);
476  big_endian = size > 0x000FFFFF;
477  if (big_endian)
478  size = av_bswap32(size);
479  if (size > 0xfffff || size < 8)
480  return 0;
481 
482  return AVPROBE_SCORE_MAX;
483 }
484 
486 {
487  AVStream *st;
488 
489  if (!video->codec)
490  return 0;
491 
492  /* initialize the video decoder stream */
493  st = avformat_new_stream(s, NULL);
494  if (!st)
495  return AVERROR(ENOMEM);
496  video->stream_index = st->index;
498  st->codec->codec_id = video->codec;
499  // parsing is necessary to make FFmpeg generate correct timestamps
502  st->codec->codec_tag = 0; /* no fourcc */
503  st->codec->width = video->width;
504  st->codec->height = video->height;
505  st->duration = st->nb_frames = video->nb_frames;
506  if (video->time_base.num)
507  avpriv_set_pts_info(st, 64, video->time_base.num, video->time_base.den);
508  st->r_frame_rate =
509  st->avg_frame_rate = av_inv_q(video->time_base);
510  return 0;
511 }
512 
514 {
515  EaDemuxContext *ea = s->priv_data;
516  AVStream *st;
517 
518  if (process_ea_header(s)<=0)
519  return AVERROR(EIO);
520 
521  if (init_video_stream(s, &ea->video) || init_video_stream(s, &ea->alpha))
522  return AVERROR(ENOMEM);
523 
524  if (ea->audio_codec) {
525  if (ea->num_channels <= 0 || ea->num_channels > 2) {
527  "Unsupported number of channels: %d\n", ea->num_channels);
528  ea->audio_codec = 0;
529  return 1;
530  }
531  if (ea->sample_rate <= 0) {
532  av_log(s, AV_LOG_ERROR,
533  "Unsupported sample rate: %d\n", ea->sample_rate);
534  ea->audio_codec = 0;
535  return 1;
536  }
537  if (ea->bytes <= 0) {
538  av_log(s, AV_LOG_ERROR,
539  "Invalid number of bytes per sample: %d\n", ea->bytes);
541  return 1;
542  }
543 
544  /* initialize the audio decoder stream */
545  st = avformat_new_stream(s, NULL);
546  if (!st)
547  return AVERROR(ENOMEM);
548  avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
550  st->codec->codec_id = ea->audio_codec;
551  st->codec->codec_tag = 0; /* no tag */
552  st->codec->channels = ea->num_channels;
553  st->codec->sample_rate = ea->sample_rate;
554  st->codec->bits_per_coded_sample = ea->bytes * 8;
555  st->codec->bit_rate = st->codec->channels *
556  st->codec->sample_rate *
557  st->codec->bits_per_coded_sample / 4;
558  st->codec->block_align = st->codec->channels *
560  ea->audio_stream_index = st->index;
561  st->start_time = 0;
562  }
563 
564  return 1;
565 }
566 
568 {
569  EaDemuxContext *ea = s->priv_data;
570  AVIOContext *pb = s->pb;
571  int partial_packet = 0;
572  unsigned int chunk_type, chunk_size;
573  int ret = 0, packet_read = 0, key = 0;
574  int av_uninit(num_samples);
575 
576  while (!packet_read || partial_packet) {
577  chunk_type = avio_rl32(pb);
578  chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
579  if (chunk_size < 8)
580  return AVERROR_INVALIDDATA;
581  chunk_size -= 8;
582 
583  switch (chunk_type) {
584  /* audio data */
585  case ISNh_TAG:
586  /* header chunk also contains data; skip over the header portion */
587  if (chunk_size < 32)
588  return AVERROR_INVALIDDATA;
589  avio_skip(pb, 32);
590  chunk_size -= 32;
591  case ISNd_TAG:
592  case SCDl_TAG:
593  case SNDC_TAG:
594  case SDEN_TAG:
595  if (!ea->audio_codec) {
596  avio_skip(pb, chunk_size);
597  break;
598  } else if (ea->audio_codec == AV_CODEC_ID_PCM_S16LE_PLANAR ||
599  ea->audio_codec == AV_CODEC_ID_MP3) {
600  num_samples = avio_rl32(pb);
601  avio_skip(pb, 8);
602  chunk_size -= 12;
603  }
604 
605  if (partial_packet) {
606  avpriv_request_sample(s, "video header followed by audio packet");
607  av_free_packet(pkt);
608  partial_packet = 0;
609  }
610 
611  if (!chunk_size)
612  continue;
613 
614  ret = av_get_packet(pb, pkt, chunk_size);
615  if (ret < 0)
616  return ret;
617  pkt->stream_index = ea->audio_stream_index;
618 
619  switch (ea->audio_codec) {
625  if (pkt->size < 4) {
626  av_log(s, AV_LOG_ERROR, "Packet is too short\n");
627  av_free_packet(pkt);
628  return AVERROR_INVALIDDATA;
629  }
631  pkt->duration = AV_RB32(pkt->data);
632  else
633  pkt->duration = AV_RL32(pkt->data);
634  break;
636  pkt->duration = ret * 2 / ea->num_channels;
637  break;
639  case AV_CODEC_ID_MP3:
640  pkt->duration = num_samples;
641  break;
642  default:
643  pkt->duration = chunk_size / (ea->bytes * ea->num_channels);
644  }
645 
646  packet_read = 1;
647  break;
648 
649  /* ending tag */
650  case 0:
651  case ISNe_TAG:
652  case SCEl_TAG:
653  case SEND_TAG:
654  case SEEN_TAG:
655  ret = AVERROR(EIO);
656  packet_read = 1;
657  break;
658 
659  case MVIh_TAG:
660  case kVGT_TAG:
661  case pQGT_TAG:
662  case TGQs_TAG:
663  case MADk_TAG:
664  key = AV_PKT_FLAG_KEY;
665  case MVIf_TAG:
666  case fVGT_TAG:
667  case MADm_TAG:
668  case MADe_TAG:
669  avio_seek(pb, -8, SEEK_CUR); // include chunk preamble
670  chunk_size += 8;
671  goto get_video_packet;
672 
673  case mTCD_TAG:
674  if (chunk_size < 8)
675  return AVERROR_INVALIDDATA;
676 
677  avio_skip(pb, 8); // skip ea DCT header
678  chunk_size -= 8;
679  goto get_video_packet;
680 
681  case MV0K_TAG:
682  case AV0K_TAG:
683  case MPCh_TAG:
684  case pIQT_TAG:
685  key = AV_PKT_FLAG_KEY;
686  case MV0F_TAG:
687  case AV0F_TAG:
688 get_video_packet:
689  if (!chunk_size)
690  continue;
691 
692  if (partial_packet) {
693  ret = av_append_packet(pb, pkt, chunk_size);
694  } else
695  ret = av_get_packet(pb, pkt, chunk_size);
696  if (ret < 0) {
697  packet_read = 1;
698  break;
699  }
700  partial_packet = chunk_type == MVIh_TAG;
701  if (chunk_type == AV0K_TAG || chunk_type == AV0F_TAG)
702  pkt->stream_index = ea->alpha.stream_index;
703  else
704  pkt->stream_index = ea->video.stream_index;
705  pkt->flags |= key;
706  packet_read = 1;
707  break;
708 
709  default:
710  avio_skip(pb, chunk_size);
711  break;
712  }
713  }
714 
715  if (ret < 0 && partial_packet)
716  av_free_packet(pkt);
717  return ret;
718 }
719 
721  .name = "ea",
722  .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia"),
723  .priv_data_size = sizeof(EaDemuxContext),
724  .read_probe = ea_probe,
727 };
#define NULL
Definition: coverity.c:32
#define SEEN_TAG
static int process_ea_header(AVFormatContext *s)
const char * s
Definition: avisynth_c.h:631
Bytestream IO Context.
Definition: avio.h:111
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static uint32_t read_arbitrary(AVIOContext *pb)
void av_free_packet(AVPacket *pkt)
Free a packet.
Definition: avpacket.c:280
enum AVCodecID codec
#define SCDl_TAG
static void process_video_header_cmv(AVFormatContext *s, VideoProperties *video)
#define pIQT_TAG
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
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:4071
#define mTCD_TAG
int num
numerator
Definition: rational.h:44
int index
stream index in AVFormatContext
Definition: avformat.h:843
int size
Definition: avcodec.h:1423
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:204
#define MV0F_TAG
enum AVCodecID audio_codec
#define fVGT_TAG
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:277
#define SCEl_TAG
static AVPacket pkt
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:2298
#define pQGT_TAG
#define ISNe_TAG
#define TGQs_TAG
Format I/O context.
Definition: avformat.h:1272
#define MPCh_TAG
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define PT00_TAG
uint8_t
#define MADm_TAG
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:690
enum AVStreamParseType need_parsing
Definition: avformat.h:1035
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:3737
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_RB32
Definition: bytestream.h:87
uint8_t * data
Definition: avcodec.h:1422
static int init_video_stream(AVFormatContext *s, VideoProperties *video)
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:241
ptrdiff_t size
Definition: opengl_enc.c:101
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:390
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2997
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:1440
#define SEND_TAG
#define av_log(a,...)
int av_append_packet(AVIOContext *s, AVPacket *pkt, int size)
Read data and append it to the current content of the AVPacket.
Definition: utils.c:251
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1468
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:102
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define SCHl_TAG
#define AVP6_TAG
#define MADk_TAG
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:659
static int process_video_header_vp6(AVFormatContext *s, VideoProperties *video)
#define AVERROR(e)
Definition: error.h:43
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: avcodec.h:425
AVRational time_base
VideoProperties video
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:925
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1428
Only parse headers, do not repack.
Definition: avformat.h:775
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:529
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:861
#define SDEN_TAG
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:450
static void process_audio_header_eacs(AVFormatContext *s)
int bit_rate
the average bitrate
Definition: avcodec.h:1566
static void process_video_header_mdec(AVFormatContext *s, VideoProperties *video)
#define SNDC_TAG
static int process_audio_header_elements(AVFormatContext *s)
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
#define AVhd_TAG
ret
Definition: avfilter.c:974
int width
picture width / height.
Definition: avcodec.h:1680
static int ea_read_header(AVFormatContext *s)
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:107
#define AV0K_TAG
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:620
Stream structure.
Definition: avformat.h:842
#define ISNd_TAG
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
#define av_bswap32
Definition: bswap.h:33
enum AVMediaType codec_type
Definition: avcodec.h:1509
#define SEAD_TAG
enum AVCodecID codec_id
Definition: avcodec.h:1518
#define EACS_TAG
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_WB16 unsigned int_TMPL byte
Definition: bytestream.h:87
int sample_rate
samples per second
Definition: avcodec.h:2261
AVIOContext * pb
I/O context.
Definition: avformat.h:1314
#define kVGT_TAG
#define AV0F_TAG
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1533
#define GSTR_TAG
#define MVIh_TAG
rational number numerator/denominator
Definition: rational.h:43
#define MVhd_TAG
This structure contains the data a format has to probe a file.
Definition: avformat.h:448
static int ea_probe(AVProbeData *p)
#define SHEN_TAG
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:133
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:901
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:460
#define MV0K_TAG
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:643
Main libavformat public API header.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
Definition: avformat.h:894
#define MADe_TAG
VideoProperties alpha
static void process_audio_header_sead(AVFormatContext *s)
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:903
int den
denominator
Definition: rational.h:45
#define ISNh_TAG
#define MVIf_TAG
int channels
number of audio channels
Definition: avcodec.h:2262
void * priv_data
Format private data.
Definition: avformat.h:1300
#define av_uninit(x)
Definition: attributes.h:141
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:628
static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
Definition: aviobuf.c:301
int stream_index
Definition: avcodec.h:1424
AVInputFormat ff_ea_demuxer
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:1062
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
This structure stores compressed data.
Definition: avcodec.h:1399