FFmpeg: libavformat/ifv.c Source File
Go to the documentation of this file. 1 /*
2 * IFV demuxer
3 *
4 * Copyright (c) 2019 Swaraj Hota
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
28
34
38
42
44 {
45 static const uint8_t ifv_magic[] = {0x11, 0xd2, 0xd3, 0xab, 0xba, 0xa9,
46 0xcf, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65, 0x44};
47
48 if (!memcmp(p->
buf, ifv_magic,
sizeof(ifv_magic)))
50
51 return 0;
52 }
53
56 uint32_t start_index)
57 {
61 uint32_t end_index,
i;
63
67 } else {
70 }
71
72 for (
i = start_index;
i < end_index;
i++) {
77
80
84
86 }
87
88 return 0;
89 }
90
92 {
94 uint32_t aud_magic;
95 uint32_t vid_magic;
96
100
103
106
107 if (vid_magic !=
MKTAG(
'H',
'2',
'6',
'4'))
109
113
114 if (aud_magic ==
MKTAG(
'G',
'R',
'A',
'W')) {
116 }
else if (aud_magic ==
MKTAG(
'P',
'C',
'M',
'U')) {
118 } else {
120 }
121
125
126 return 0;
127 }
128
130 {
134
138
140 if (!st)
142
149
151
154 if (!st)
156
162
164 }
165
166 /*read video index*/
168
172
174 /*read audio index*/
176
180 }
181
184
185 return 0;
186 }
187
189 {
193
194 ev = ea = e_next =
NULL;
195
199
202 }
203
208
212 e_next = ea;
213 }
214 }
215
216 if (!ev) {
217 uint64_t vframes, aframes;
219 /*read new video and audio indexes*/
220
223
227 if (vframes > INT_MAX || aframes > INT_MAX)
232
235
239
243
244 return 0;
245
247 /*read new video index*/
248
250
253 if (vframes > INT_MAX)
257
260
264
265 return 0;
266 }
267 }
268
270
275
276 if (e_next == ev) {
279 } else {
282 }
283
286
287 return 0;
288 }
289
291 {
293
294 for (
unsigned i = 0;
i <
s->nb_streams;
i++) {
299 return 0;
300 }
301
304 } else {
306 }
307 }
308
309 return 0;
310 }
311
316 .extensions = "ifv",
321 };
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
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
enum AVMediaType codec_type
General type of the encoded data.
#define AVERROR_EOF
End of file.
static int read_index(AVFormatContext *s, enum AVMediaType frame_type, uint32_t start_index)
uint32_t next_audio_index
uint32_t next_video_index
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
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.
unsigned int avio_rl16(AVIOContext *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int parse_header(AVFormatContext *s)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
static int ifv_read_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
static int ifv_read_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int read_header(FFV1Context *f)
static int ifv_probe(const AVProbeData *p)
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
int sample_rate
Audio only.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
static int ifv_read_header(AVFormatContext *s)
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const AVInputFormat ff_ifv_demuxer
int index
stream index in AVFormatContext
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
static int read_probe(const AVProbeData *p)
#define avpriv_request_sample(...)
#define AV_CHANNEL_LAYOUT_MONO
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
#define flags(name, subs,...)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
Set a dictionary value to an ISO-8601 compliant timestamp string.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Generated on Tue Feb 28 2023 21:34:05 for FFmpeg by
doxygen
1.8.17