Libav
rmdec.c
Go to the documentation of this file.
1 /*
2  * "Real" compatible demuxer.
3  * Copyright (c) 2000, 2001 Fabrice Bellard
4  *
5  * This file is part of Libav.
6  *
7  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include <inttypes.h>
23 
24 #include "libavutil/avstring.h"
26 #include "libavutil/internal.h"
27 #include "libavutil/intreadwrite.h"
28 #include "libavutil/dict.h"
29 #include "avformat.h"
30 #include "internal.h"
31 #include "rmsipr.h"
32 #include "rm.h"
33 
34 #define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r')
35 #define DEINT_ID_INT0 MKTAG('I', 'n', 't', '0')
36 #define DEINT_ID_INT4 MKTAG('I', 'n', 't', '4')
37 #define DEINT_ID_SIPR MKTAG('s', 'i', 'p', 'r')
38 #define DEINT_ID_VBRF MKTAG('v', 'b', 'r', 'f')
39 #define DEINT_ID_VBRS MKTAG('v', 'b', 'r', 's')
40 
41 struct RMStream {
45  int curpic_num;
47  int64_t pktpos;
48  int64_t audiotimestamp;
50  int sub_packet_cnt; // Subpacket counter, used while reading
55 };
56 
57 typedef struct {
65 
66 static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len)
67 {
68  int i;
69  char *q, r;
70 
71  q = buf;
72  for(i=0;i<len;i++) {
73  r = avio_r8(pb);
74  if (i < buf_size - 1)
75  *q++ = r;
76  }
77  if (buf_size > 0) *q = '\0';
78 }
79 
80 static void get_str8(AVIOContext *pb, char *buf, int buf_size)
81 {
82  get_strl(pb, buf, buf_size, avio_r8(pb));
83 }
84 
85 static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size)
86 {
87  if (size >= 1<<24)
88  return -1;
90  if (!avctx->extradata)
91  return AVERROR(ENOMEM);
92  avctx->extradata_size = avio_read(pb, avctx->extradata, size);
93  if (avctx->extradata_size != size)
94  return AVERROR(EIO);
95  return 0;
96 }
97 
98 static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide)
99 {
100  char buf[1024];
101  int i;
102  for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
103  int len = wide ? avio_rb16(pb) : avio_r8(pb);
104  get_strl(pb, buf, sizeof(buf), len);
105  av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0);
106  }
107 }
108 
110 {
111  RMStream *rms = av_mallocz(sizeof(RMStream));
112  rms->curpic_num = -1;
113  return rms;
114 }
115 
117 {
118  av_free_packet(&rms->pkt);
119 }
120 
122  AVStream *st, RMStream *ast, int read_all)
123 {
124  char buf[256];
125  uint32_t version;
126  int ret;
127 
128  /* ra type header */
129  version = avio_rb16(pb); /* version */
130  if (version == 3) {
131  int header_size = avio_rb16(pb);
132  int64_t startpos = avio_tell(pb);
133  avio_skip(pb, 14);
134  rm_read_metadata(s, pb, 0);
135  if ((startpos + header_size) >= avio_tell(pb) + 2) {
136  // fourcc (should always be "lpcJ")
137  avio_r8(pb);
138  get_str8(pb, buf, sizeof(buf));
139  }
140  // Skip extra header crap (this should never happen)
141  if ((startpos + header_size) > avio_tell(pb))
142  avio_skip(pb, header_size + startpos - avio_tell(pb));
143  st->codec->sample_rate = 8000;
144  st->codec->channels = 1;
148  ast->deint_id = DEINT_ID_INT0;
149  } else {
150  int flavor, sub_packet_h, coded_framesize, sub_packet_size;
151  int codecdata_length;
152  /* old version (4) */
153  avio_skip(pb, 2); /* unused */
154  avio_rb32(pb); /* .ra4 */
155  avio_rb32(pb); /* data size */
156  avio_rb16(pb); /* version2 */
157  avio_rb32(pb); /* header size */
158  flavor= avio_rb16(pb); /* add codec info / flavor */
159  ast->coded_framesize = coded_framesize = avio_rb32(pb); /* coded frame size */
160  avio_rb32(pb); /* ??? */
161  avio_rb32(pb); /* ??? */
162  avio_rb32(pb); /* ??? */
163  ast->sub_packet_h = sub_packet_h = avio_rb16(pb); /* 1 */
164  st->codec->block_align= avio_rb16(pb); /* frame size */
165  ast->sub_packet_size = sub_packet_size = avio_rb16(pb); /* sub packet size */
166  avio_rb16(pb); /* ??? */
167  if (version == 5) {
168  avio_rb16(pb); avio_rb16(pb); avio_rb16(pb);
169  }
170  st->codec->sample_rate = avio_rb16(pb);
171  avio_rb32(pb);
172  st->codec->channels = avio_rb16(pb);
173  if (version == 5) {
174  ast->deint_id = avio_rl32(pb);
175  avio_read(pb, buf, 4);
176  buf[4] = 0;
177  } else {
178  get_str8(pb, buf, sizeof(buf)); /* desc */
179  ast->deint_id = AV_RL32(buf);
180  get_str8(pb, buf, sizeof(buf)); /* desc */
181  }
183  st->codec->codec_tag = AV_RL32(buf);
185  st->codec->codec_tag);
186 
187  switch (st->codec->codec_id) {
188  case AV_CODEC_ID_AC3:
190  break;
191  case AV_CODEC_ID_RA_288:
192  st->codec->extradata_size= 0;
193  ast->audio_framesize = st->codec->block_align;
194  st->codec->block_align = coded_framesize;
195  break;
196  case AV_CODEC_ID_COOK:
198  case AV_CODEC_ID_ATRAC3:
199  case AV_CODEC_ID_SIPR:
200  avio_rb16(pb); avio_r8(pb);
201  if (version == 5)
202  avio_r8(pb);
203  codecdata_length = avio_rb32(pb);
204  if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
205  av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
206  return -1;
207  }
208 
209  ast->audio_framesize = st->codec->block_align;
210  if (st->codec->codec_id == AV_CODEC_ID_SIPR) {
211  if (flavor > 3) {
212  av_log(s, AV_LOG_ERROR, "bad SIPR file flavor %d\n",
213  flavor);
214  return -1;
215  }
216  st->codec->block_align = ff_sipr_subpk_size[flavor];
217  } else {
218  if(sub_packet_size <= 0){
219  av_log(s, AV_LOG_ERROR, "sub_packet_size is invalid\n");
220  return -1;
221  }
222  st->codec->block_align = ast->sub_packet_size;
223  }
224  if ((ret = rm_read_extradata(pb, st->codec, codecdata_length)) < 0)
225  return ret;
226  break;
227  case AV_CODEC_ID_AAC:
228  avio_rb16(pb); avio_r8(pb);
229  if (version == 5)
230  avio_r8(pb);
231  codecdata_length = avio_rb32(pb);
232  if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
233  av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
234  return -1;
235  }
236  if (codecdata_length >= 1) {
237  avio_r8(pb);
238  if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0)
239  return ret;
240  }
241  break;
242  }
243  if (ast->deint_id == DEINT_ID_INT4 ||
244  ast->deint_id == DEINT_ID_GENR ||
245  ast->deint_id == DEINT_ID_SIPR) {
246  if (st->codec->block_align <= 0 ||
247  ast->audio_framesize * sub_packet_h > (unsigned)INT_MAX ||
248  ast->audio_framesize * sub_packet_h < st->codec->block_align)
249  return AVERROR_INVALIDDATA;
250  if (av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h) < 0)
251  return AVERROR(ENOMEM);
252  }
253  switch (ast->deint_id) {
254  case DEINT_ID_INT4:
255  if (ast->coded_framesize > ast->audio_framesize ||
256  sub_packet_h <= 1 ||
257  ast->coded_framesize * sub_packet_h > (2 + (sub_packet_h & 1)) * ast->audio_framesize)
258  return AVERROR_INVALIDDATA;
259  break;
260  case DEINT_ID_GENR:
261  if (ast->sub_packet_size <= 0 ||
262  ast->sub_packet_size > ast->audio_framesize)
263  return AVERROR_INVALIDDATA;
264  break;
265  case DEINT_ID_SIPR:
266  case DEINT_ID_INT0:
267  case DEINT_ID_VBRS:
268  case DEINT_ID_VBRF:
269  break;
270  default:
271  av_log(NULL, 0 ,"Unknown interleaver %"PRIX32"\n", ast->deint_id);
272  return AVERROR_INVALIDDATA;
273  }
274 
275  if (read_all) {
276  avio_r8(pb);
277  avio_r8(pb);
278  avio_r8(pb);
279  rm_read_metadata(s, pb, 0);
280  }
281  }
282  return 0;
283 }
284 
286  AVStream *st, RMStream *rst,
287  unsigned int codec_data_size)
288 {
289  unsigned int v;
290  int size;
291  int64_t codec_pos;
292  int ret;
293 
294  avpriv_set_pts_info(st, 64, 1, 1000);
295  codec_pos = avio_tell(pb);
296  v = avio_rb32(pb);
297  if (v == MKTAG(0xfd, 'a', 'r', '.')) {
298  /* ra type header */
299  if (rm_read_audio_stream_info(s, pb, st, rst, 0))
300  return -1;
301  } else if (v == MKBETAG('L', 'S', 'D', ':')) {
302  avio_seek(pb, -4, SEEK_CUR);
303  if ((ret = rm_read_extradata(pb, st->codec, codec_data_size)) < 0)
304  return ret;
305 
307  st->codec->codec_tag = AV_RL32(st->codec->extradata);
309  st->codec->codec_tag);
310  } else {
311  int fps;
312  if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) {
313  fail1:
314  av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
315  goto skip;
316  }
317  st->codec->codec_tag = avio_rl32(pb);
319  st->codec->codec_tag);
320  av_dlog(s, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
321  if (st->codec->codec_id == AV_CODEC_ID_NONE)
322  goto fail1;
323  st->codec->width = avio_rb16(pb);
324  st->codec->height = avio_rb16(pb);
325  avio_skip(pb, 2); // looks like bits per sample
326  avio_skip(pb, 4); // always zero?
329  fps = avio_rb32(pb);
330 
331  if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
332  return ret;
333 
334  if (fps > 0) {
336  0x10000, fps, (1 << 30) - 1);
337  } else if (s->error_recognition & AV_EF_EXPLODE) {
338  av_log(s, AV_LOG_ERROR, "Invalid framerate\n");
339  return AVERROR_INVALIDDATA;
340  }
341  }
342 
343 skip:
344  /* skip codec info */
345  size = avio_tell(pb) - codec_pos;
346  avio_skip(pb, codec_data_size - size);
347 
348  return 0;
349 }
350 
354 {
355  AVIOContext *pb = s->pb;
356  unsigned int size, n_pkts, str_id, next_off, n, pos, pts;
357  AVStream *st;
358 
359  do {
360  if (avio_rl32(pb) != MKTAG('I','N','D','X'))
361  return -1;
362  size = avio_rb32(pb);
363  if (size < 20)
364  return -1;
365  avio_skip(pb, 2);
366  n_pkts = avio_rb32(pb);
367  str_id = avio_rb16(pb);
368  next_off = avio_rb32(pb);
369  for (n = 0; n < s->nb_streams; n++)
370  if (s->streams[n]->id == str_id) {
371  st = s->streams[n];
372  break;
373  }
374  if (n == s->nb_streams) {
375  av_log(s, AV_LOG_ERROR,
376  "Invalid stream index %d for index at pos %"PRId64"\n",
377  str_id, avio_tell(pb));
378  goto skip;
379  } else if ((avio_size(pb) - avio_tell(pb)) / 14 < n_pkts) {
380  av_log(s, AV_LOG_ERROR,
381  "Nr. of packets in packet index for stream index %d "
382  "exceeds filesize (%"PRId64" at %"PRId64" = %"PRId64")\n",
383  str_id, avio_size(pb), avio_tell(pb),
384  (avio_size(pb) - avio_tell(pb)) / 14);
385  goto skip;
386  }
387 
388  for (n = 0; n < n_pkts; n++) {
389  avio_skip(pb, 2);
390  pts = avio_rb32(pb);
391  pos = avio_rb32(pb);
392  avio_skip(pb, 4); /* packet no. */
393 
394  av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
395  }
396 
397 skip:
398  if (next_off && avio_tell(pb) < next_off &&
399  avio_seek(pb, next_off, SEEK_SET) < 0) {
400  av_log(s, AV_LOG_ERROR,
401  "Non-linear index detected, not supported\n");
402  return -1;
403  }
404  } while (next_off);
405 
406  return 0;
407 }
408 
410 {
411  RMDemuxContext *rm = s->priv_data;
412  AVStream *st;
413 
414  rm->old_format = 1;
415  st = avformat_new_stream(s, NULL);
416  if (!st)
417  return -1;
419  return rm_read_audio_stream_info(s, s->pb, st, st->priv_data, 1);
420 }
421 
423 {
424  RMDemuxContext *rm = s->priv_data;
425  AVStream *st;
426  AVIOContext *pb = s->pb;
427  unsigned int tag;
428  int tag_size;
429  unsigned int start_time, duration;
430  unsigned int data_off = 0, indx_off = 0;
431  char buf[128];
432  int flags = 0;
433 
434  tag = avio_rl32(pb);
435  if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
436  /* very old .ra format */
437  return rm_read_header_old(s);
438  } else if (tag != MKTAG('.', 'R', 'M', 'F')) {
439  return AVERROR(EIO);
440  }
441 
442  tag_size = avio_rb32(pb);
443  avio_skip(pb, tag_size - 8);
444 
445  for(;;) {
446  if (pb->eof_reached)
447  return -1;
448  tag = avio_rl32(pb);
449  tag_size = avio_rb32(pb);
450  avio_rb16(pb);
451  av_dlog(s, "tag=%c%c%c%c (%08x) size=%d\n",
452  (tag ) & 0xff,
453  (tag >> 8) & 0xff,
454  (tag >> 16) & 0xff,
455  (tag >> 24) & 0xff,
456  tag,
457  tag_size);
458  if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A'))
459  return -1;
460  switch(tag) {
461  case MKTAG('P', 'R', 'O', 'P'):
462  /* file header */
463  avio_rb32(pb); /* max bit rate */
464  avio_rb32(pb); /* avg bit rate */
465  avio_rb32(pb); /* max packet size */
466  avio_rb32(pb); /* avg packet size */
467  avio_rb32(pb); /* nb packets */
468  avio_rb32(pb); /* duration */
469  avio_rb32(pb); /* preroll */
470  indx_off = avio_rb32(pb); /* index offset */
471  data_off = avio_rb32(pb); /* data offset */
472  avio_rb16(pb); /* nb streams */
473  flags = avio_rb16(pb); /* flags */
474  break;
475  case MKTAG('C', 'O', 'N', 'T'):
476  rm_read_metadata(s, pb, 1);
477  break;
478  case MKTAG('M', 'D', 'P', 'R'):
479  st = avformat_new_stream(s, NULL);
480  if (!st)
481  return AVERROR(ENOMEM);
482  st->id = avio_rb16(pb);
483  avio_rb32(pb); /* max bit rate */
484  st->codec->bit_rate = avio_rb32(pb); /* bit rate */
485  avio_rb32(pb); /* max packet size */
486  avio_rb32(pb); /* avg packet size */
487  start_time = avio_rb32(pb); /* start time */
488  avio_rb32(pb); /* preroll */
489  duration = avio_rb32(pb); /* duration */
490  st->start_time = start_time;
491  st->duration = duration;
492  get_str8(pb, buf, sizeof(buf)); /* desc */
493  get_str8(pb, buf, sizeof(buf)); /* mimetype */
496  if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
497  avio_rb32(pb)) < 0)
498  return -1;
499  break;
500  case MKTAG('D', 'A', 'T', 'A'):
501  goto header_end;
502  default:
503  /* unknown tag: skip it */
504  avio_skip(pb, tag_size - 10);
505  break;
506  }
507  }
508  header_end:
509  rm->nb_packets = avio_rb32(pb); /* number of packets */
510  if (!rm->nb_packets && (flags & 4))
511  rm->nb_packets = 3600 * 25;
512  avio_rb32(pb); /* next data header */
513 
514  if (!data_off)
515  data_off = avio_tell(pb) - 18;
516  if (indx_off && pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
517  avio_seek(pb, indx_off, SEEK_SET) >= 0) {
518  rm_read_index(s);
519  avio_seek(pb, data_off + 18, SEEK_SET);
520  }
521 
522  return 0;
523 }
524 
525 static int get_num(AVIOContext *pb, int *len)
526 {
527  int n, n1;
528 
529  n = avio_rb16(pb);
530  (*len)-=2;
531  n &= 0x7FFF;
532  if (n >= 0x4000) {
533  return n - 0x4000;
534  } else {
535  n1 = avio_rb16(pb);
536  (*len)-=2;
537  return (n << 16) | n1;
538  }
539 }
540 
541 /* multiple of 20 bytes for ra144 (ugly) */
542 #define RAW_PACKET_SIZE 1000
543 
544 static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){
545  RMDemuxContext *rm = s->priv_data;
546  AVIOContext *pb = s->pb;
547  AVStream *st;
548  uint32_t state=0xFFFFFFFF;
549 
550  while(!pb->eof_reached){
551  int len, num, i;
552  *pos= avio_tell(pb) - 3;
553  if(rm->remaining_len > 0){
554  num= rm->current_stream;
555  len= rm->remaining_len;
556  *timestamp = AV_NOPTS_VALUE;
557  *flags= 0;
558  }else{
559  state= (state<<8) + avio_r8(pb);
560 
561  if(state == MKBETAG('I', 'N', 'D', 'X')){
562  int n_pkts, expected_len;
563  len = avio_rb32(pb);
564  avio_skip(pb, 2);
565  n_pkts = avio_rb32(pb);
566  expected_len = 20 + n_pkts * 14;
567  if (len == 20)
568  /* some files don't add index entries to chunk size... */
569  len = expected_len;
570  else if (len != expected_len)
572  "Index size %d (%d pkts) is wrong, should be %d.\n",
573  len, n_pkts, expected_len);
574  len -= 14; // we already read part of the index header
575  if(len<0)
576  continue;
577  goto skip;
578  } else if (state == MKBETAG('D','A','T','A')) {
580  "DATA tag in middle of chunk, file may be broken.\n");
581  }
582 
583  if(state > (unsigned)0xFFFF || state <= 12)
584  continue;
585  len=state - 12;
586  state= 0xFFFFFFFF;
587 
588  num = avio_rb16(pb);
589  *timestamp = avio_rb32(pb);
590  avio_r8(pb); /* reserved */
591  *flags = avio_r8(pb); /* flags */
592  }
593  for(i=0;i<s->nb_streams;i++) {
594  st = s->streams[i];
595  if (num == st->id)
596  break;
597  }
598  if (i == s->nb_streams) {
599 skip:
600  /* skip packet if unknown number */
601  avio_skip(pb, len);
602  rm->remaining_len = 0;
603  continue;
604  }
605  *stream_index= i;
606 
607  return len;
608  }
609  return -1;
610 }
611 
613  RMDemuxContext *rm, RMStream *vst,
614  AVPacket *pkt, int len, int *pseq,
615  int64_t *timestamp)
616 {
617  int hdr, seq, pic_num, len2, pos;
618  int type;
619 
620  hdr = avio_r8(pb); len--;
621  type = hdr >> 6;
622 
623  if(type != 3){ // not frame as a part of packet
624  seq = avio_r8(pb); len--;
625  }
626  if(type != 1){ // not whole frame
627  len2 = get_num(pb, &len);
628  pos = get_num(pb, &len);
629  pic_num = avio_r8(pb); len--;
630  }
631  if(len<0)
632  return -1;
633  rm->remaining_len = len;
634  if(type&1){ // frame, not slice
635  if(type == 3){ // frame as a part of packet
636  len= len2;
637  *timestamp = pos;
638  }
639  if(rm->remaining_len < len)
640  return -1;
641  rm->remaining_len -= len;
642  if(av_new_packet(pkt, len + 9) < 0)
643  return AVERROR(EIO);
644  pkt->data[0] = 0;
645  AV_WL32(pkt->data + 1, 1);
646  AV_WL32(pkt->data + 5, 0);
647  avio_read(pb, pkt->data + 9, len);
648  return 0;
649  }
650  //now we have to deal with single slice
651 
652  *pseq = seq;
653  if((seq & 0x7F) == 1 || vst->curpic_num != pic_num){
654  vst->slices = ((hdr & 0x3F) << 1) + 1;
655  vst->videobufsize = len2 + 8*vst->slices + 1;
656  av_free_packet(&vst->pkt); //FIXME this should be output.
657  if(av_new_packet(&vst->pkt, vst->videobufsize) < 0)
658  return AVERROR(ENOMEM);
659  vst->videobufpos = 8*vst->slices + 1;
660  vst->cur_slice = 0;
661  vst->curpic_num = pic_num;
662  vst->pktpos = avio_tell(pb);
663  }
664  if(type == 2)
665  len = FFMIN(len, pos);
666 
667  if(++vst->cur_slice > vst->slices)
668  return 1;
669  AV_WL32(vst->pkt.data - 7 + 8*vst->cur_slice, 1);
670  AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1);
671  if(vst->videobufpos + len > vst->videobufsize)
672  return 1;
673  if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len)
674  return AVERROR(EIO);
675  vst->videobufpos += len;
676  rm->remaining_len-= len;
677 
678  if (type == 2 || vst->videobufpos == vst->videobufsize) {
679  vst->pkt.data[0] = vst->cur_slice-1;
680  *pkt= vst->pkt;
681  vst->pkt.data= NULL;
682  vst->pkt.size= 0;
683  vst->pkt.buf = NULL;
684 #if FF_API_DESTRUCT_PACKET
686  vst->pkt.destruct = NULL;
688 #endif
689  if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin
690  memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices,
691  vst->videobufpos - 1 - 8*vst->slices);
692  pkt->size = vst->videobufpos + 8*(vst->cur_slice - vst->slices);
693  pkt->pts = AV_NOPTS_VALUE;
694  pkt->pos = vst->pktpos;
695  vst->slices = 0;
696  return 0;
697  }
698 
699  return 1;
700 }
701 
702 static inline void
704 {
705  uint8_t *ptr;
706  int j;
707 
708  if (st->codec->codec_id == AV_CODEC_ID_AC3) {
709  ptr = pkt->data;
710  for (j=0;j<pkt->size;j+=2) {
711  FFSWAP(int, ptr[0], ptr[1]);
712  ptr += 2;
713  }
714  }
715 }
716 
717 int
719  AVStream *st, RMStream *ast, int len, AVPacket *pkt,
720  int *seq, int flags, int64_t timestamp)
721 {
722  RMDemuxContext *rm = s->priv_data;
723  int ret;
724 
725  if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
726  rm->current_stream= st->id;
727  if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp))
728  return -1; //got partial frame
729  } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
730  if ((ast->deint_id == DEINT_ID_GENR) ||
731  (ast->deint_id == DEINT_ID_INT4) ||
732  (ast->deint_id == DEINT_ID_SIPR)) {
733  int x;
734  int sps = ast->sub_packet_size;
735  int cfs = ast->coded_framesize;
736  int h = ast->sub_packet_h;
737  int y = ast->sub_packet_cnt;
738  int w = ast->audio_framesize;
739 
740  if (flags & 2)
741  y = ast->sub_packet_cnt = 0;
742  if (!y)
743  ast->audiotimestamp = timestamp;
744 
745  switch (ast->deint_id) {
746  case DEINT_ID_INT4:
747  for (x = 0; x < h/2; x++)
748  avio_read(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
749  break;
750  case DEINT_ID_GENR:
751  for (x = 0; x < w/sps; x++)
752  avio_read(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
753  break;
754  case DEINT_ID_SIPR:
755  avio_read(pb, ast->pkt.data + y * w, w);
756  break;
757  }
758 
759  if (++(ast->sub_packet_cnt) < h)
760  return -1;
761  if (ast->deint_id == DEINT_ID_SIPR)
762  ff_rm_reorder_sipr_data(ast->pkt.data, h, w);
763 
764  ast->sub_packet_cnt = 0;
765  rm->audio_stream_num = st->index;
766  rm->audio_pkt_cnt = h * w / st->codec->block_align;
767  } else if ((ast->deint_id == DEINT_ID_VBRF) ||
768  (ast->deint_id == DEINT_ID_VBRS)) {
769  int x;
770  rm->audio_stream_num = st->index;
771  ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4;
772  if (ast->sub_packet_cnt) {
773  for (x = 0; x < ast->sub_packet_cnt; x++)
774  ast->sub_packet_lengths[x] = avio_rb16(pb);
775  rm->audio_pkt_cnt = ast->sub_packet_cnt;
776  ast->audiotimestamp = timestamp;
777  } else
778  return -1;
779  } else {
780  ret = av_get_packet(pb, pkt, len);
781  if (ret < 0)
782  return ret;
783  rm_ac3_swap_bytes(st, pkt);
784  }
785  } else {
786  ret = av_get_packet(pb, pkt, len);
787  if (ret < 0)
788  return ret;
789  }
790 
791  pkt->stream_index = st->index;
792 
793 #if 0
794  if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
795  if(st->codec->codec_id == AV_CODEC_ID_RV20){
796  int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
797  av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq);
798 
799  seq |= (timestamp&~0x3FFF);
800  if(seq - timestamp > 0x2000) seq -= 0x4000;
801  if(seq - timestamp < -0x2000) seq += 0x4000;
802  }
803  }
804 #endif
805 
806  pkt->pts = timestamp;
807  if (flags & 2)
808  pkt->flags |= AV_PKT_FLAG_KEY;
809 
810  return st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0;
811 }
812 
813 int
815  AVStream *st, RMStream *ast, AVPacket *pkt)
816 {
817  RMDemuxContext *rm = s->priv_data;
818  int ret;
819 
820  assert (rm->audio_pkt_cnt > 0);
821 
822  if (ast->deint_id == DEINT_ID_VBRF ||
823  ast->deint_id == DEINT_ID_VBRS) {
824  ret = av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]);
825  if (ret < 0)
826  return ret;
827  }
828  else {
829  ret = av_new_packet(pkt, st->codec->block_align);
830  if (ret < 0)
831  return ret;
832  memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME avoid this
833  (ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt),
834  st->codec->block_align);
835  }
836  rm->audio_pkt_cnt--;
837  if ((pkt->pts = ast->audiotimestamp) != AV_NOPTS_VALUE) {
839  pkt->flags = AV_PKT_FLAG_KEY;
840  } else
841  pkt->flags = 0;
842  pkt->stream_index = st->index;
843 
844  return rm->audio_pkt_cnt;
845 }
846 
848 {
849  RMDemuxContext *rm = s->priv_data;
850  AVStream *st;
851  int i, len, res, seq = 1;
852  int64_t timestamp, pos;
853  int flags;
854 
855  for (;;) {
856  if (rm->audio_pkt_cnt) {
857  // If there are queued audio packet return them first
858  st = s->streams[rm->audio_stream_num];
859  ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
860  flags = 0;
861  } else {
862  if (rm->old_format) {
863  RMStream *ast;
864 
865  st = s->streams[0];
866  ast = st->priv_data;
867  timestamp = AV_NOPTS_VALUE;
868  len = !ast->audio_framesize ? RAW_PACKET_SIZE :
869  ast->coded_framesize * ast->sub_packet_h / 2;
870  flags = (seq++ == 1) ? 2 : 0;
871  pos = avio_tell(s->pb);
872  } else {
873  len=sync(s, &timestamp, &flags, &i, &pos);
874  if (len > 0)
875  st = s->streams[i];
876  }
877 
878  if(len<0 || s->pb->eof_reached)
879  return AVERROR(EIO);
880 
881  res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
882  &seq, flags, timestamp);
883  if((flags&2) && (seq&0x7F) == 1)
884  av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
885  if (res)
886  continue;
887  }
888 
889  if( (st->discard >= AVDISCARD_NONKEY && !(flags&2))
890  || st->discard >= AVDISCARD_ALL){
891  av_free_packet(pkt);
892  } else
893  break;
894  }
895 
896  return 0;
897 }
898 
900 {
901  int i;
902 
903  for (i=0;i<s->nb_streams;i++)
905 
906  return 0;
907 }
908 
909 static int rm_probe(AVProbeData *p)
910 {
911  /* check file header */
912  if ((p->buf[0] == '.' && p->buf[1] == 'R' &&
913  p->buf[2] == 'M' && p->buf[3] == 'F' &&
914  p->buf[4] == 0 && p->buf[5] == 0) ||
915  (p->buf[0] == '.' && p->buf[1] == 'r' &&
916  p->buf[2] == 'a' && p->buf[3] == 0xfd))
917  return AVPROBE_SCORE_MAX;
918  else
919  return 0;
920 }
921 
922 static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
923  int64_t *ppos, int64_t pos_limit)
924 {
925  RMDemuxContext *rm = s->priv_data;
926  int64_t pos, dts;
927  int stream_index2, flags, len, h;
928 
929  pos = *ppos;
930 
931  if(rm->old_format)
932  return AV_NOPTS_VALUE;
933 
934  avio_seek(s->pb, pos, SEEK_SET);
935  rm->remaining_len=0;
936  for(;;){
937  int seq=1;
938  AVStream *st;
939 
940  len=sync(s, &dts, &flags, &stream_index2, &pos);
941  if(len<0)
942  return AV_NOPTS_VALUE;
943 
944  st = s->streams[stream_index2];
945  if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
946  h= avio_r8(s->pb); len--;
947  if(!(h & 0x40)){
948  seq = avio_r8(s->pb); len--;
949  }
950  }
951 
952  if((flags&2) && (seq&0x7F) == 1){
953  av_dlog(s, "%d %d-%d %"PRId64" %d\n",
954  flags, stream_index2, stream_index, dts, seq);
955  av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
956  if(stream_index2 == stream_index)
957  break;
958  }
959 
960  avio_skip(s->pb, len);
961  }
962  *ppos = pos;
963  return dts;
964 }
965 
967  .name = "rm",
968  .long_name = NULL_IF_CONFIG_SMALL("RealMedia"),
969  .priv_data_size = sizeof(RMDemuxContext),
970  .read_probe = rm_probe,
974  .read_timestamp = rm_read_dts,
975 };
976 
978  .name = "rdt",
979  .long_name = NULL_IF_CONFIG_SMALL("RDT demuxer"),
980  .priv_data_size = sizeof(RMDemuxContext),
982  .flags = AVFMT_NOFILE,
983 };
static int get_num(AVIOContext *pb, int *len)
Definition: rmdec.c:525
full parsing and interpolation of timestamps for frames not starting on a packet boundary ...
Definition: avformat.h:655
#define RAW_PACKET_SIZE
Definition: rmdec.c:542
int remaining_len
Definition: rmdec.c:61
discard all frames except keyframes
Definition: avcodec.h:567
Bytestream IO Context.
Definition: avio.h:68
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:54
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:241
int size
void av_free_packet(AVPacket *pkt)
Free a packet.
Definition: avpacket.c:243
#define DEINT_ID_INT0
no interleaving needed
Definition: rmdec.c:35
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.
Definition: utils.c:1181
static void get_strl(AVIOContext *pb, char *buf, int buf_size, int len)
Definition: rmdec.c:66
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition: utils.c:1943
static int64_t rm_read_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
Definition: rmdec.c:922
const unsigned char ff_sipr_subpk_size[4]
Definition: rmsipr.c:25
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:129
int64_t pos
byte position in stream, -1 if unknown
Definition: avcodec.h:998
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:2829
int num
numerator
Definition: rational.h:44
int index
stream index in AVFormatContext
Definition: avformat.h:700
int size
Definition: avcodec.h:974
Definition: rmdec.c:41
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:186
int cur_slice
Definition: rmdec.c:46
void * priv_data
Definition: avformat.h:719
#define FF_ARRAY_ELEMS(a)
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
static int rm_read_header(AVFormatContext *s)
Definition: rmdec.c:422
discard all
Definition: avcodec.h:568
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:580
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:1844
static int64_t duration
Definition: avplay.c:246
#define DEINT_ID_VBRS
VBR case for AAC.
Definition: rmdec.c:39
int videobufpos
position for the next slice in the video buffer
Definition: rmdec.c:44
Format I/O context.
Definition: avformat.h:922
int audio_stream_num
Stream number for audio packets.
Definition: rmdec.c:62
#define AVFMT_FLAG_IGNIDX
Ignore index.
Definition: avformat.h:1035
Public dictionary API.
uint8_t
Opaque data information usually continuous.
Definition: avutil.h:189
int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, unsigned int codec_data_size)
Read the MDPR chunk, which contains stream-specific codec initialization parameters.
Definition: rmdec.c:285
attribute_deprecated void(* destruct)(struct AVPacket *)
Definition: avcodec.h:994
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:595
int id
Format-specific stream ID.
Definition: avformat.h:706
enum AVStreamParseType need_parsing
Definition: avformat.h:867
#define AV_WL32(p, d)
Definition: intreadwrite.h:255
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1164
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:2521
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:990
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1033
uint8_t * data
Definition: avcodec.h:973
static int flags
Definition: log.c:44
uint32_t tag
Definition: movenc.c:844
int curpic_num
picture number of current frame
Definition: rmdec.c:45
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:117
static int rm_read_index(AVFormatContext *s)
this function assumes that the demuxer has already seeked to the start of the INDX chunk...
Definition: rmdec.c:353
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:219
#define DEINT_ID_GENR
interleaving for Cooker/ATRAC
Definition: rmdec.c:34
static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, RMDemuxContext *rm, RMStream *vst, AVPacket *pkt, int len, int *pseq, int64_t *timestamp)
Definition: rmdec.c:612
static void get_str8(AVIOContext *pb, char *buf, int buf_size)
Definition: rmdec.c:80
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:452
#define r
Definition: input.c:51
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1019
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:81
#define AVINDEX_KEYFRAME
Definition: avformat.h:662
static int64_t start_time
Definition: avplay.c:245
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1130
static int rm_read_close(AVFormatContext *s)
Definition: rmdec.c:899
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:564
#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:145
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:144
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: avcodec.h:956
#define DEINT_ID_VBRF
VBR case for AAC.
Definition: rmdec.c:38
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
int64_t pktpos
first slice position in file
Definition: rmdec.c:47
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:780
RMStream * ff_rm_alloc_rmstream(void)
Definition: rmdec.c:109
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:979
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1868
Only parse headers, do not repack.
Definition: avformat.h:654
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:443
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:718
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:397
common internal API header
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
Definition: avcodec.h:531
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:978
AVPacket pkt
place to store merged video frame / reordered audio data
Definition: rmdec.c:42
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
int bit_rate
the average bitrate
Definition: avcodec.h:1114
audio channel layout utility functions
#define FFMIN(a, b)
Definition: common.h:57
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
int width
picture width / height.
Definition: avcodec.h:1229
AVInputFormat ff_rm_demuxer
Definition: rmdec.c:966
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: avio.h:210
int32_t
#define DEINT_ID_INT4
interleaving for 28.8
Definition: rmdec.c:36
#define AV_RL32
Definition: intreadwrite.h:146
#define AV_EF_EXPLODE
Definition: avcodec.h:2433
int sub_packet_cnt
Definition: rmdec.c:50
int coded_framesize
Descrambling parameters from container.
Definition: rmdec.c:51
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:544
int audio_framesize
Definition: rmdec.c:52
Stream structure.
Definition: avformat.h:699
static void rm_ac3_swap_bytes(AVStream *st, AVPacket *pkt)
Definition: rmdec.c:703
const AVCodecTag ff_rm_codec_tags[]
Definition: rm.c:31
NULL
Definition: eval.c:55
enum AVMediaType codec_type
Definition: avcodec.h:1058
version
Definition: ffv1enc.c:1080
enum AVCodecID codec_id
Definition: avcodec.h:1067
#define DEINT_ID_SIPR
interleaving for Sipro
Definition: rmdec.c:37
int sample_rate
samples per second
Definition: avcodec.h:1807
AVIOContext * pb
I/O context.
Definition: avformat.h:964
main external API structure.
Definition: avcodec.h:1050
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1082
static int rm_probe(AVProbeData *p)
Definition: rmdec.c:909
int extradata_size
Definition: avcodec.h:1165
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
int ff_rm_parse_packet(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp)
Parse one rm-stream packet from the input bytestream.
Definition: rmdec.c:718
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:68
int current_stream
Definition: rmdec.c:60
int old_format
Definition: rmdec.c:59
This structure contains the data a format has to probe a file.
Definition: avformat.h:395
int audio_pkt_cnt
Output packet counter.
Definition: rmdec.c:63
int nb_packets
Definition: rmdec.c:58
static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos)
Definition: rmdec.c:544
static uint32_t state
Definition: trasher.c:27
const char *const ff_rm_metadata[4]
Definition: rm.c:24
AVInputFormat ff_rdt_demuxer
Definition: rmdec.c:977
void ff_rm_free_rmstream(RMStream *rms)
Definition: rmdec.c:116
int sub_packet_h
Definition: rmdec.c:51
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:756
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:404
full parsing and repack
Definition: avformat.h:653
void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
Perform 4-bit block reordering for SIPR data.
Definition: rmsipr.c:41
Main libavformat public API header.
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:76
int32_t deint_id
Length of each subpacket.
Definition: rmdec.c:54
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:409
int64_t start_time
Decoding: pts of the first frame of the stream, in stream time base.
Definition: avformat.h:749
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
Definition: avformat.h:1152
int ff_rm_retrieve_cache(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, AVPacket *pkt)
Retrieve one cached packet from the rm-context.
Definition: rmdec.c:814
int den
denominator
Definition: rational.h:45
static int rm_read_header_old(AVFormatContext *s)
Definition: rmdec.c:409
#define MKBETAG(a, b, c, d)
Definition: common.h:239
int slices
Definition: rmdec.c:46
int eof_reached
true if eof reached
Definition: avio.h:96
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:77
int len
int channels
number of audio channels
Definition: avcodec.h:1808
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: rmdec.c:847
static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int read_all)
Definition: rmdec.c:121
void * priv_data
Format private data.
Definition: avformat.h:950
static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size)
Definition: rmdec.c:85
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:525
int64_t audiotimestamp
Audio descrambling matrix parameters.
Definition: rmdec.c:49
#define FFSWAP(type, a, b)
Definition: common.h:60
int stream_index
Definition: avcodec.h:975
int videobufsize
current assembled frame size
Definition: rmdec.c:43
#define AV_CH_LAYOUT_MONO
#define MKTAG(a, b, c, d)
Definition: common.h:238
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition: avformat.h:762
int sub_packet_lengths[16]
Audio frame size from container.
Definition: rmdec.c:53
This structure stores compressed data.
Definition: avcodec.h:950
static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide)
Definition: rmdec.c:98
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:966
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:228
int sub_packet_size
Definition: rmdec.c:51