FFmpeg: libavformat/r3d.c Source File
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 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
28
32
35
41
43 {
47 return -1;
52 }
53
55 {
58 char filename[258];
63
64 if (!st)
68
70 tmp2 =
avio_r8(
s->pb);
// minor version
72
75
78
81
83
86
89
93 #if FF_API_R_FRAME_RATE
95 #endif
97 }
98
101
105 filename[sizeof(filename)-1] = 0;
107
113
114 return 0;
115 }
116
118 {
122
124
127 if (!video_offset) {
129 break;
130 }
132 }
133
139
140 return 0;
141 }
142
144 {
147
152
155
158
160 }
161
163 {
168
171 return -1;
172 }
173 if (atom.
tag ==
MKTAG(
'R',
'E',
'D',
'1')) {
177 }
178 } else {
180 return -1;
181 }
182
183 /* we cannot create the audio stream now because we do not know the
184 * sample rate */
187
191 return 0;
192 // find REOB/REOF/REOS to load index
196
197 if (atom.
tag !=
MKTAG(
'R',
'E',
'O',
'B') &&
198 atom.
tag !=
MKTAG(
'R',
'E',
'O',
'F') &&
201
203
208 if (atom.
tag ==
MKTAG(
'R',
'D',
'V',
'O')) {
211 }
212 }
213
216 return 0;
217 }
218
220 {
225 unsigned dts;
227
229
232
234 tmp2 =
avio_r8(
s->pb);
// minor version
236
239
243
246
251
254 }
257 return -1;
261 return -1;
262 }
263
270
271 return 0;
272 }
273
275 {
281 unsigned dts;
283
284 if (
s->nb_streams < 2) {
286 if (!st)
292 } else {
294 }
295
297
302 }
303
305
308
311
313 tmp2 =
avio_r8(
s->pb);
// minor version
315
318
321 return -1;
326 }
327
330
333 av_log(
s,
AV_LOG_TRACE,
"pkt dts %"PRId64
" duration %"PRId64
" samples %d sample rate %d\n",
335
336 return 0;
337 }
338
340 {
343 int err = 0;
344
345 while (!err) {
347 err = -1;
348 break;
349 }
351 case MKTAG(
'R',
'E',
'D',
'V'):
355 return 0;
356 break;
357 case MKTAG(
'R',
'E',
'D',
'A'):
359 return -1;
363 return 0;
364 break;
365 default:
368 }
369 }
370 return err;
371 }
372
374 {
377 return 0;
378 }
379
381 {
382 AVStream *st =
s->streams[0];
// video stream
384 int frame_num;
385
387 return -1;
388
392 frame_num, sample_time);
393
394 if (frame_num < r3d->video_offsets_count) {
396 return -1;
397 } else {
399 return -1;
400 }
401
402 return 0;
403 }
404
413 };
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
static int r3d_read_red1(AVFormatContext *s)
static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
AVRational avg_frame_rate
Average framerate.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int nb_channels
Number of channels in this layout.
int64_t avio_size(AVIOContext *s)
Get the filesize.
static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static void r3d_read_reos(AVFormatContext *s)
int64_t data_offset
offset of the first packet
static int read_atom(AVFormatContext *s, Atom *atom)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static int r3d_probe(const AVProbeData *p)
@ AVDISCARD_ALL
discard all
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
int sample_rate
Audio only.
unsigned video_offsets_count
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int avio_r8(AVIOContext *s)
static int read_header(FFV1Context *f, RangeCoder *c)
static int r3d_read_header(AVFormatContext *s)
static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
#define i(width, name, range_min, range_max)
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
unsigned int avio_rb16(AVIOContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
const FFInputFormat ff_r3d_demuxer
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
AVRational r_frame_rate
Real base framerate of the stream.
Filter the word "frame" indicates either a video frame or a group of audio samples
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
static int read_probe(const AVProbeData *p)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
Generated on Sat Oct 18 2025 19:23:27 for FFmpeg by
doxygen
1.8.17