FFmpeg: libavformat/ffmetadec.c Source File
Go to the documentation of this file. 1 /*
2 * Metadata demuxer
3 * Copyright (c) 2010 Anton Khirnov
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
30 {
33 return 0;
34 }
35
37 {
39 int64_t read = 0;
42 char prev = ' ';
43
44 do {
46 do {
48 end = prev !=
'\\' && (
c ==
'\r' ||
c ==
'\n' ||
c ==
'0円');
49 if (!end)
52 }
while (!end &&
len <
sizeof(
tmp));
55 } while (!end);
56
59
62
65
66 return read;
67 }
68
70 {
71
72 do {
75 }
while (!
avio_feof(
s) && (bp->str[0] ==
';' || bp->str[0] ==
'#' || bp->str[0] == 0));
76 }
77
79 {
80 do {
83
90 break;
91
94 }
96 }
while (!
avio_feof(
s) && (buf[0] ==
';' || buf[0] ==
'#' || buf[0] == 0));
97 }
98
100 {
102 int64_t start, end;
105
107
108 if (sscanf(
line,
"TIMEBASE=%d/%d", &
tb.num, &
tb.den))
110 ret = sscanf(
line,
"START=%"SCNd64, &start);
113 start = (
s->nb_chapters &&
s->chapters[
s->nb_chapters - 1]->end !=
AV_NOPTS_VALUE) ?
114 s->chapters[
s->nb_chapters - 1]->end : 0;
115 } else
117
118 ret = sscanf(
line,
"END=%"SCNd64, &end);
122 }
123
125 }
126
128 {
131 const uint8_t *p2 = buf;
132
135
136 while (p2 < buf +
size) {
137 if (*p2 == '\\')
138 p2++;
139 *p1++ = *p2++;
140 }
141 *p1 = 0;
143 }
144
146 {
148 const uint8_t *p =
line;
149
150 /* find first not escaped '=' */
151 while (1) {
152 if (*p == '=')
153 break;
154 else if (*p == '\\')
155 p++;
156
157 if (*p++)
158 continue;
159
160 return 0;
161 }
162
168 }
169
171 return 0;
172 }
173
175 {
177 AVBPrint bp;
178
180
183
186
187 if (!st)
188 goto nomem;
189
192
196
197 if (!ch)
198 goto nomem;
199
201 } else
203 }
204
206
210 s->chapters[
s->nb_chapters - 1]->time_base,
212
213 return 0;
214 nomem:
216
218 }
219
221 {
223 }
224
226 .
name =
"ffmetadata",
231 };
AVChapter * avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
Add a new chapter.
#define AV_BPRINT_SIZE_UNLIMITED
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.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AVERROR_EOF
End of file.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
@ AV_CODEC_ID_FFMETADATA
Dummy codec for streams containing only metadata information.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_NOPTS_VALUE
Undefined timestamp value.
int avio_r8(AVIOContext *s)
#define i(width, name, range_min, range_max)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
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.
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Generated on Wed Aug 24 2022 21:42:14 for FFmpeg by
doxygen
1.8.17