Libav
r3d.c
Go to the documentation of this file.
1 /*
2  * R3D REDCODE demuxer
3  * Copyright (c) 2008 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
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 "libavutil/intreadwrite.h"
23 #include "libavutil/dict.h"
24 #include "libavutil/mathematics.h"
25 #include "avformat.h"
26 #include "internal.h"
27 
28 typedef struct {
30  unsigned *video_offsets;
31  unsigned rdvo_offset;
32 } R3DContext;
33 
34 typedef struct {
35  unsigned size;
36  uint32_t tag;
37  uint64_t offset;
38 } Atom;
39 
40 static int read_atom(AVFormatContext *s, Atom *atom)
41 {
42  atom->offset = avio_tell(s->pb);
43  atom->size = avio_rb32(s->pb);
44  if (atom->size < 8)
45  return -1;
46  atom->tag = avio_rl32(s->pb);
47  av_dlog(s, "atom %u %.4s offset %#"PRIx64"\n",
48  atom->size, (char*)&atom->tag, atom->offset);
49  return atom->size;
50 }
51 
53 {
55  char filename[258];
56  int tmp;
57  int av_unused tmp2;
58  AVRational framerate;
59 
60  if (!st)
61  return AVERROR(ENOMEM);
64 
65  tmp = avio_r8(s->pb); // major version
66  tmp2 = avio_r8(s->pb); // minor version
67  av_dlog(s, "version %d.%d\n", tmp, tmp2);
68 
69  tmp = avio_rb16(s->pb); // unknown
70  av_dlog(s, "unknown1 %d\n", tmp);
71 
72  tmp = avio_rb32(s->pb);
73  avpriv_set_pts_info(st, 32, 1, tmp);
74 
75  tmp = avio_rb32(s->pb); // filenum
76  av_dlog(s, "filenum %d\n", tmp);
77 
78  avio_skip(s->pb, 32); // unknown
79 
80  st->codec->width = avio_rb32(s->pb);
81  st->codec->height = avio_rb32(s->pb);
82 
83  tmp = avio_rb16(s->pb); // unknown
84  av_dlog(s, "unknown2 %d\n", tmp);
85 
86  framerate.num = avio_rb16(s->pb);
87  framerate.den = avio_rb16(s->pb);
88  if (framerate.num > 0 && framerate.den > 0) {
89  st->avg_frame_rate = framerate;
90  }
91 
92  tmp = avio_r8(s->pb); // audio channels
93  av_dlog(s, "audio channels %d\n", tmp);
94  if (tmp > 0) {
96  if (!ast)
97  return AVERROR(ENOMEM);
100  ast->codec->channels = tmp;
101  avpriv_set_pts_info(ast, 32, 1, st->time_base.den);
102  }
103 
104  avio_read(s->pb, filename, 257);
105  filename[sizeof(filename)-1] = 0;
106  av_dict_set(&st->metadata, "filename", filename, 0);
107 
108  av_dlog(s, "filename %s\n", filename);
109  av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
110  av_dlog(s, "timescale %d\n", st->time_base.den);
111  av_dlog(s, "frame rate %d/%d\n",
112  framerate.num, framerate.den);
113 
114  return 0;
115 }
116 
117 static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
118 {
119  R3DContext *r3d = s->priv_data;
120  AVStream *st = s->streams[0];
121  int i;
122 
123  r3d->video_offsets_count = (atom->size - 8) / 4;
124  r3d->video_offsets = av_malloc(atom->size);
125  if (!r3d->video_offsets)
126  return AVERROR(ENOMEM);
127 
128  for (i = 0; i < r3d->video_offsets_count; i++) {
129  r3d->video_offsets[i] = avio_rb32(s->pb);
130  if (!r3d->video_offsets[i]) {
131  r3d->video_offsets_count = i;
132  break;
133  }
134  av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
135  }
136 
137  if (st->avg_frame_rate.num)
139  (AVRational){st->avg_frame_rate.den,
140  st->avg_frame_rate.num},
141  st->time_base);
142  av_dlog(s, "duration %"PRId64"\n", st->duration);
143 
144  return 0;
145 }
146 
148 {
149  R3DContext *r3d = s->priv_data;
150  int av_unused tmp;
151 
152  r3d->rdvo_offset = avio_rb32(s->pb);
153  avio_rb32(s->pb); // rdvs offset
154  avio_rb32(s->pb); // rdao offset
155  avio_rb32(s->pb); // rdas offset
156 
157  tmp = avio_rb32(s->pb);
158  av_dlog(s, "num video chunks %d\n", tmp);
159 
160  tmp = avio_rb32(s->pb);
161  av_dlog(s, "num audio chunks %d\n", tmp);
162 
163  avio_skip(s->pb, 6*4);
164 }
165 
167 {
168  R3DContext *r3d = s->priv_data;
169  Atom atom;
170  int ret;
171 
172  if (read_atom(s, &atom) < 0) {
173  av_log(s, AV_LOG_ERROR, "error reading atom\n");
174  return -1;
175  }
176  if (atom.tag == MKTAG('R','E','D','1')) {
177  if ((ret = r3d_read_red1(s)) < 0) {
178  av_log(s, AV_LOG_ERROR, "error parsing 'red1' atom\n");
179  return ret;
180  }
181  } else {
182  av_log(s, AV_LOG_ERROR, "could not find 'red1' atom\n");
183  return -1;
184  }
185 
186  s->data_offset = avio_tell(s->pb);
187  av_dlog(s, "data offset %#"PRIx64"\n", s->data_offset);
188  if (!s->pb->seekable)
189  return 0;
190  // find REOB/REOF/REOS to load index
191  avio_seek(s->pb, avio_size(s->pb)-48-8, SEEK_SET);
192  if (read_atom(s, &atom) < 0)
193  av_log(s, AV_LOG_ERROR, "error reading end atom\n");
194 
195  if (atom.tag != MKTAG('R','E','O','B') &&
196  atom.tag != MKTAG('R','E','O','F') &&
197  atom.tag != MKTAG('R','E','O','S'))
198  goto out;
199 
200  r3d_read_reos(s);
201 
202  if (r3d->rdvo_offset) {
203  avio_seek(s->pb, r3d->rdvo_offset, SEEK_SET);
204  if (read_atom(s, &atom) < 0)
205  av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n");
206  if (atom.tag == MKTAG('R','D','V','O')) {
207  if (r3d_read_rdvo(s, &atom) < 0)
208  av_log(s, AV_LOG_ERROR, "error parsing 'rdvo' atom\n");
209  }
210  }
211 
212  out:
213  avio_seek(s->pb, s->data_offset, SEEK_SET);
214  return 0;
215 }
216 
217 static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
218 {
219  AVStream *st = s->streams[0];
220  int tmp;
221  int av_unused tmp2;
222  uint64_t pos = avio_tell(s->pb);
223  unsigned dts;
224  int ret;
225 
226  dts = avio_rb32(s->pb);
227 
228  tmp = avio_rb32(s->pb);
229  av_dlog(s, "frame num %d\n", tmp);
230 
231  tmp = avio_r8(s->pb); // major version
232  tmp2 = avio_r8(s->pb); // minor version
233  av_dlog(s, "version %d.%d\n", tmp, tmp2);
234 
235  tmp = avio_rb16(s->pb); // unknown
236  av_dlog(s, "unknown %d\n", tmp);
237 
238  if (tmp > 4) {
239  tmp = avio_rb16(s->pb); // unknown
240  av_dlog(s, "unknown %d\n", tmp);
241 
242  tmp = avio_rb16(s->pb); // unknown
243  av_dlog(s, "unknown %d\n", tmp);
244 
245  tmp = avio_rb32(s->pb);
246  av_dlog(s, "width %d\n", tmp);
247  tmp = avio_rb32(s->pb);
248  av_dlog(s, "height %d\n", tmp);
249 
250  tmp = avio_rb32(s->pb);
251  av_dlog(s, "metadata len %d\n", tmp);
252  }
253  tmp = atom->size - 8 - (avio_tell(s->pb) - pos);
254  if (tmp < 0)
255  return -1;
256  ret = av_get_packet(s->pb, pkt, tmp);
257  if (ret < 0) {
258  av_log(s, AV_LOG_ERROR, "error reading video packet\n");
259  return -1;
260  }
261 
262  pkt->stream_index = 0;
263  pkt->dts = dts;
264  if (st->avg_frame_rate.num)
265  pkt->duration = (uint64_t)st->time_base.den*
267  av_dlog(s, "pkt dts %"PRId64" duration %d\n", pkt->dts, pkt->duration);
268 
269  return 0;
270 }
271 
272 static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
273 {
274  AVStream *st = s->streams[1];
275  int av_unused tmp, tmp2;
276  int samples, size;
277  uint64_t pos = avio_tell(s->pb);
278  unsigned dts;
279  int ret;
280 
281  dts = avio_rb32(s->pb);
282 
283  st->codec->sample_rate = avio_rb32(s->pb);
284  if (st->codec->sample_rate <= 0) {
285  av_log(s, AV_LOG_ERROR, "Bad sample rate\n");
286  return AVERROR_INVALIDDATA;
287  }
288 
289  samples = avio_rb32(s->pb);
290 
291  tmp = avio_rb32(s->pb);
292  av_dlog(s, "packet num %d\n", tmp);
293 
294  tmp = avio_rb16(s->pb); // unknown
295  av_dlog(s, "unknown %d\n", tmp);
296 
297  tmp = avio_r8(s->pb); // major version
298  tmp2 = avio_r8(s->pb); // minor version
299  av_dlog(s, "version %d.%d\n", tmp, tmp2);
300 
301  tmp = avio_rb32(s->pb); // unknown
302  av_dlog(s, "unknown %d\n", tmp);
303 
304  size = atom->size - 8 - (avio_tell(s->pb) - pos);
305  if (size < 0)
306  return -1;
307  ret = av_get_packet(s->pb, pkt, size);
308  if (ret < 0) {
309  av_log(s, AV_LOG_ERROR, "error reading audio packet\n");
310  return ret;
311  }
312 
313  pkt->stream_index = 1;
314  pkt->dts = dts;
315  pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
316  av_dlog(s, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n",
317  pkt->dts, pkt->duration, samples, st->codec->sample_rate);
318 
319  return 0;
320 }
321 
323 {
324  Atom atom;
325  int err = 0;
326 
327  while (!err) {
328  if (read_atom(s, &atom) < 0) {
329  err = -1;
330  break;
331  }
332  switch (atom.tag) {
333  case MKTAG('R','E','D','V'):
334  if (s->streams[0]->discard == AVDISCARD_ALL)
335  goto skip;
336  if (!(err = r3d_read_redv(s, pkt, &atom)))
337  return 0;
338  break;
339  case MKTAG('R','E','D','A'):
340  if (s->nb_streams < 2)
341  return -1;
342  if (s->streams[1]->discard == AVDISCARD_ALL)
343  goto skip;
344  if (!(err = r3d_read_reda(s, pkt, &atom)))
345  return 0;
346  break;
347  default:
348  skip:
349  avio_skip(s->pb, atom.size-8);
350  }
351  }
352  return err;
353 }
354 
355 static int r3d_probe(AVProbeData *p)
356 {
357  if (AV_RL32(p->buf + 4) == MKTAG('R','E','D','1'))
358  return AVPROBE_SCORE_MAX;
359  return 0;
360 }
361 
362 static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
363 {
364  AVStream *st = s->streams[0]; // video stream
365  R3DContext *r3d = s->priv_data;
366  int frame_num;
367 
368  if (!st->avg_frame_rate.num)
369  return -1;
370 
371  frame_num = av_rescale_q(sample_time, st->time_base,
372  (AVRational){st->avg_frame_rate.den, st->avg_frame_rate.num});
373  av_dlog(s, "seek frame num %d timestamp %"PRId64"\n",
374  frame_num, sample_time);
375 
376  if (frame_num < r3d->video_offsets_count) {
377  if (avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET) < 0)
378  return -1;
379  } else {
380  av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
381  return -1;
382  }
383 
384  return 0;
385 }
386 
388 {
389  R3DContext *r3d = s->priv_data;
390 
391  av_freep(&r3d->video_offsets);
392 
393  return 0;
394 }
395 
397  .name = "r3d",
398  .long_name = NULL_IF_CONFIG_SMALL("REDCODE R3D"),
399  .priv_data_size = sizeof(R3DContext),
404  .read_seek = r3d_seek,
405 };
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:62
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:54
uint64_t offset
Definition: r3d.c:37
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:241
int size
uint32_t tag
Definition: r3d.c:36
unsigned video_offsets_count
Definition: r3d.c:29
static int read_atom(AVFormatContext *s, Atom *atom)
Definition: r3d.c:40
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
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
static int r3d_close(AVFormatContext *s)
Definition: r3d.c:387
int num
numerator
Definition: rational.h:44
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:186
unsigned size
Definition: r3d.c:35
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)
int64_t data_offset
offset of the first packet
Definition: avformat.h:1220
discard all
Definition: avcodec.h:568
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:580
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
Format I/O context.
Definition: avformat.h:922
Public dictionary API.
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:595
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
static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
Definition: r3d.c:272
static int flags
Definition: log.c:44
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 av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:219
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:991
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:452
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:129
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
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:150
static void r3d_read_reos(AVFormatContext *s)
Definition: r3d.c:147
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
Definition: r3d.c:34
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:780
Definition: r3d.c:28
unsigned rdvo_offset
Definition: r3d.c:31
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:443
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:718
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:397
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:978
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
AVInputFormat ff_r3d_demuxer
Definition: r3d.c:396
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:116
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
int width
picture width / height.
Definition: avcodec.h:1224
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: avio.h:210
#define AV_RL32
Definition: intreadwrite.h:146
AVDictionary * metadata
Definition: avformat.h:771
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:544
Stream structure.
Definition: avformat.h:699
NULL
Definition: eval.c:55
enum AVMediaType codec_type
Definition: avcodec.h:1058
enum AVCodecID codec_id
Definition: avcodec.h:1067
int sample_rate
samples per second
Definition: avcodec.h:1791
AVIOContext * pb
I/O context.
Definition: avformat.h:964
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
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
static int r3d_probe(AVProbeData *p)
Definition: r3d.c:355
rational number numerator/denominator
Definition: rational.h:43
static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
Definition: r3d.c:117
This structure contains the data a format has to probe a file.
Definition: avformat.h:395
unsigned * video_offsets
Definition: r3d.c:30
static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
Definition: r3d.c:362
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:756
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:404
Main libavformat public API header.
static int r3d_read_header(AVFormatContext *s)
Definition: r3d.c:166
static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: r3d.c:322
int den
denominator
Definition: rational.h:45
int channels
number of audio channels
Definition: avcodec.h:1792
void * priv_data
Format private data.
Definition: avformat.h:950
static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
Definition: r3d.c:217
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:972
static int r3d_read_red1(AVFormatContext *s)
Definition: r3d.c:52
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:525
int stream_index
Definition: avcodec.h:975
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:741
#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
This structure stores compressed data.
Definition: avcodec.h:950
#define av_unused
Definition: attributes.h:86