22 #include "libavutil/intreadwrite.h"
23 #include "libavutil/dict.h"
24 #include "libavutil/mathematics.h"
47 av_dlog(s,
"atom %u %.4s offset %#"PRIx64
"\n",
67 av_dlog(s,
"version %d.%d\n", tmp, tmp2);
70 av_dlog(s,
"unknown1 %d\n", tmp);
76 av_dlog(s,
"filenum %d\n", tmp);
84 av_dlog(s,
"unknown2 %d\n", tmp);
88 if (framerate.
num > 0 && framerate.
den > 0) {
93 av_dlog(s,
"audio channels %d\n", tmp);
105 filename[
sizeof(filename)-1] = 0;
108 av_dlog(s,
"filename %s\n", filename);
111 av_dlog(s,
"frame rate %d/%d\n",
112 framerate.
num, framerate.
den);
140 st->avg_frame_rate.num},
158 av_dlog(s,
"num video chunks %d\n", tmp);
161 av_dlog(s,
"num audio chunks %d\n", tmp);
176 if (atom.
tag ==
MKTAG(
'R',
'E',
'D',
'1')) {
195 if (atom.
tag !=
MKTAG(
'R',
'E',
'O',
'B') &&
196 atom.
tag !=
MKTAG(
'R',
'E',
'O',
'F') &&
206 if (atom.
tag ==
MKTAG(
'R',
'D',
'V',
'O')) {
229 av_dlog(s,
"frame num %d\n", tmp);
233 av_dlog(s,
"version %d.%d\n", tmp, tmp2);
236 av_dlog(s,
"unknown %d\n", tmp);
240 av_dlog(s,
"unknown %d\n", tmp);
243 av_dlog(s,
"unknown %d\n", tmp);
248 av_dlog(s,
"height %d\n", tmp);
251 av_dlog(s,
"metadata len %d\n", tmp);
292 av_dlog(s,
"packet num %d\n", tmp);
295 av_dlog(s,
"unknown %d\n", tmp);
299 av_dlog(s,
"version %d.%d\n", tmp, tmp2);
302 av_dlog(s,
"unknown %d\n", tmp);
316 av_dlog(s,
"pkt dts %"PRId64
" duration %d samples %d sample rate %d\n",
333 case MKTAG(
'R',
'E',
'D',
'V'):
339 case MKTAG(
'R',
'E',
'D',
'A'):
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);
376 if (frame_num < r3d->video_offsets_count) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
unsigned video_offsets_count
static int read_atom(AVFormatContext *s, Atom *atom)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
static int r3d_close(AVFormatContext *s)
AVCodecContext * codec
Codec context associated with this stream.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
static av_cold int read_close(AVFormatContext *ctx)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const
Rescale a 64-bit integer by 2 rational numbers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void r3d_read_reos(AVFormatContext *s)
AVRational avg_frame_rate
Average framerate.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
AVInputFormat ff_r3d_demuxer
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const
Rescale a 64-bit integer with rounding to nearest.
int width
picture width / height.
AVStream ** streams
A list of all streams in the file.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static int r3d_probe(AVProbeData *p)
rational number numerator/denominator
static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
This structure contains the data a format has to probe a file.
#define MKTAG(a, b, c, d)
static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
int64_t duration
Decoding: duration of the stream, in stream time base.
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
static int r3d_read_header(AVFormatContext *s)
static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
int channels
number of audio channels
static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static int r3d_read_red1(AVFormatContext *s)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
This structure stores compressed data.