concatdec.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Nicolas George
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/avstring.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/parseutils.h"
24 #include "avformat.h"
25 #include "internal.h"
26 
27 typedef struct {
28  char *url;
29  int64_t start_time;
30  int64_t duration;
31 } ConcatFile;
32 
33 typedef struct {
34  AVClass *class;
37  unsigned nb_files;
39  int safe;
40  int seekable;
42 
44 {
45  return memcmp(probe->buf, "ffconcat version 1.0", 20) ?
47 }
48 
49 static char *get_keyword(uint8_t **cursor)
50 {
51  char *ret = *cursor += strspn(*cursor, SPACE_CHARS);
52  *cursor += strcspn(*cursor, SPACE_CHARS);
53  if (**cursor) {
54  *((*cursor)++) = 0;
55  *cursor += strspn(*cursor, SPACE_CHARS);
56  }
57  return ret;
58 }
59 
60 static int safe_filename(const char *f)
61 {
62  const char *start = f;
63 
64  for (; *f; f++) {
65  /* A-Za-z0-9_- */
66  if (!((unsigned)((*f | 32) - 'a') < 26 ||
67  (unsigned)(*f - '0') < 10 || *f == '_' || *f == '-')) {
68  if (f == start)
69  return 0;
70  else if (*f == '/')
71  start = f + 1;
72  else if (*f != '.')
73  return 0;
74  }
75  }
76  return 1;
77 }
78 
79 #define FAIL(retcode) do { ret = (retcode); goto fail; } while(0)
80 
81 static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
82  unsigned *nb_files_alloc)
83 {
84  ConcatContext *cat = avf->priv_data;
86  char *url = NULL;
87  size_t url_len;
88  int ret;
89 
90  if (cat->safe > 0 && !safe_filename(filename)) {
91  av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename);
92  FAIL(AVERROR(EPERM));
93  }
94  url_len = strlen(avf->filename) + strlen(filename) + 16;
95  if (!(url = av_malloc(url_len)))
96  FAIL(AVERROR(ENOMEM));
97  ff_make_absolute_url(url, url_len, avf->filename, filename);
98  av_freep(&filename);
99 
100  if (cat->nb_files >= *nb_files_alloc) {
101  size_t n = FFMAX(*nb_files_alloc * 2, 16);
102  ConcatFile *new_files;
103  if (n <= cat->nb_files || n > SIZE_MAX / sizeof(*cat->files) ||
104  !(new_files = av_realloc(cat->files, n * sizeof(*cat->files))))
105  FAIL(AVERROR(ENOMEM));
106  cat->files = new_files;
107  *nb_files_alloc = n;
108  }
109 
110  file = &cat->files[cat->nb_files++];
111  memset(file, 0, sizeof(*file));
112  *rfile = file;
113 
114  file->url = url;
115  file->start_time = AV_NOPTS_VALUE;
116  file->duration = AV_NOPTS_VALUE;
117 
118  return 0;
119 
120 fail:
121  av_free(url);
122  av_free(filename);
123  return ret;
124 }
125 
126 static int open_file(AVFormatContext *avf, unsigned fileno)
127 {
128  ConcatContext *cat = avf->priv_data;
129  ConcatFile *file = &cat->files[fileno];
130  int ret;
131 
132  if (cat->avf)
133  avformat_close_input(&cat->avf);
134  if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 ||
135  (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) {
136  av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url);
137  return ret;
138  }
139  cat->cur_file = file;
140  if (file->start_time == AV_NOPTS_VALUE)
141  file->start_time = !fileno ? 0 :
142  cat->files[fileno - 1].start_time +
143  cat->files[fileno - 1].duration;
144  return 0;
145 }
146 
148 {
149  ConcatContext *cat = avf->priv_data;
150  unsigned i;
151 
152  if (cat->avf)
153  avformat_close_input(&cat->avf);
154  for (i = 0; i < cat->nb_files; i++)
155  av_freep(&cat->files[i].url);
156  av_freep(&cat->files);
157  return 0;
158 }
159 
161 {
162  ConcatContext *cat = avf->priv_data;
163  uint8_t buf[4096];
164  uint8_t *cursor, *keyword;
165  int ret, line = 0, i;
166  unsigned nb_files_alloc = 0;
167  ConcatFile *file = NULL;
168  AVStream *st, *source_st;
169  int64_t time = 0;
170 
171  while (1) {
172  if ((ret = ff_get_line(avf->pb, buf, sizeof(buf))) <= 0)
173  break;
174  line++;
175  cursor = buf;
176  keyword = get_keyword(&cursor);
177  if (!*keyword || *keyword == '#')
178  continue;
179 
180  if (!strcmp(keyword, "file")) {
181  char *filename = av_get_token((const char **)&cursor, SPACE_CHARS);
182  if (!filename) {
183  av_log(avf, AV_LOG_ERROR, "Line %d: filename required\n", line);
185  }
186  if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0)
187  FAIL(ret);
188  } else if (!strcmp(keyword, "duration")) {
189  char *dur_str = get_keyword(&cursor);
190  int64_t dur;
191  if (!file) {
192  av_log(avf, AV_LOG_ERROR, "Line %d: duration without file\n",
193  line);
195  }
196  if ((ret = av_parse_time(&dur, dur_str, 1)) < 0) {
197  av_log(avf, AV_LOG_ERROR, "Line %d: invalid duration '%s'\n",
198  line, dur_str);
199  FAIL(ret);
200  }
201  file->duration = dur;
202  } else if (!strcmp(keyword, "ffconcat")) {
203  char *ver_kw = get_keyword(&cursor);
204  char *ver_val = get_keyword(&cursor);
205  if (strcmp(ver_kw, "version") || strcmp(ver_val, "1.0")) {
206  av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line);
208  }
209  if (cat->safe < 0)
210  cat->safe = 1;
211  } else {
212  av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n",
213  line, keyword);
215  }
216  }
217  if (ret < 0)
218  FAIL(ret);
219 
220  for (i = 0; i < cat->nb_files; i++) {
221  if (cat->files[i].start_time == AV_NOPTS_VALUE)
222  cat->files[i].start_time = time;
223  else
224  time = cat->files[i].start_time;
225  if (cat->files[i].duration == AV_NOPTS_VALUE)
226  break;
227  time += cat->files[i].duration;
228  }
229  if (i == cat->nb_files) {
230  avf->duration = time;
231  cat->seekable = 1;
232  }
233 
234  if ((ret = open_file(avf, 0)) < 0)
235  FAIL(ret);
236  for (i = 0; i < cat->avf->nb_streams; i++) {
237  if (!(st = avformat_new_stream(avf, NULL)))
238  FAIL(AVERROR(ENOMEM));
239  source_st = cat->avf->streams[i];
240  if ((ret = avcodec_copy_context(st->codec, source_st->codec)) < 0)
241  FAIL(ret);
242  st->r_frame_rate = source_st->r_frame_rate;
243  st->avg_frame_rate = source_st->avg_frame_rate;
244  st->time_base = source_st->time_base;
245  st->sample_aspect_ratio = source_st->sample_aspect_ratio;
246  }
247 
248  return 0;
249 
250 fail:
251  concat_read_close(avf);
252  return ret;
253 }
254 
256 {
257  ConcatContext *cat = avf->priv_data;
258  unsigned fileno = cat->cur_file - cat->files;
259 
260  if (cat->cur_file->duration == AV_NOPTS_VALUE)
261  cat->cur_file->duration = cat->avf->duration;
262 
263  if (++fileno >= cat->nb_files)
264  return AVERROR_EOF;
265  return open_file(avf, fileno);
266 }
267 
269 {
270  ConcatContext *cat = avf->priv_data;
271  int ret;
272  int64_t delta;
273 
274  while (1) {
275  if ((ret = av_read_frame(cat->avf, pkt)) != AVERROR_EOF ||
276  (ret = open_next_file(avf)) < 0)
277  break;
278  }
279  delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time,
281  cat->avf->streams[pkt->stream_index]->time_base);
282  if (pkt->pts != AV_NOPTS_VALUE)
283  pkt->pts += delta;
284  if (pkt->dts != AV_NOPTS_VALUE)
285  pkt->dts += delta;
286  return ret;
287 }
288 
289 static void rescale_interval(AVRational tb_in, AVRational tb_out,
290  int64_t *min_ts, int64_t *ts, int64_t *max_ts)
291 {
292  *ts = av_rescale_q (* ts, tb_in, tb_out);
293  *min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out,
295  *max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out,
297 }
298 
299 static int try_seek(AVFormatContext *avf, int stream,
300  int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
301 {
302  ConcatContext *cat = avf->priv_data;
303  int64_t t0 = cat->cur_file->start_time - cat->avf->start_time;
304 
305  ts -= t0;
306  min_ts = min_ts == INT64_MIN ? INT64_MIN : min_ts - t0;
307  max_ts = max_ts == INT64_MAX ? INT64_MAX : max_ts - t0;
308  if (stream >= 0) {
309  if (stream >= cat->avf->nb_streams)
310  return AVERROR(EIO);
312  &min_ts, &ts, &max_ts);
313  }
314  return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags);
315 }
316 
317 static int real_seek(AVFormatContext *avf, int stream,
318  int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
319 {
320  ConcatContext *cat = avf->priv_data;
321  int ret, left, right;
322 
323  if (stream >= 0) {
324  if (stream >= avf->nb_streams)
325  return AVERROR(EINVAL);
327  &min_ts, &ts, &max_ts);
328  }
329 
330  left = 0;
331  right = cat->nb_files;
332  while (right - left > 1) {
333  int mid = (left + right) / 2;
334  if (ts < cat->files[mid].start_time)
335  right = mid;
336  else
337  left = mid;
338  }
339 
340  if ((ret = open_file(avf, left)) < 0)
341  return ret;
342 
343  ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
344  if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) &&
345  left < cat->nb_files - 1 &&
346  cat->files[left + 1].start_time < max_ts) {
347  if ((ret = open_file(avf, left + 1)) < 0)
348  return ret;
349  ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
350  }
351  return ret;
352 }
353 
354 static int concat_seek(AVFormatContext *avf, int stream,
355  int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
356 {
357  ConcatContext *cat = avf->priv_data;
358  ConcatFile *cur_file_saved = cat->cur_file;
359  AVFormatContext *cur_avf_saved = cat->avf;
360  int ret;
361 
362  if (!cat->seekable)
363  return AVERROR(ESPIPE); /* XXX: can we use it? */
364  if (flags & (AVSEEK_FLAG_BYTE | AVSEEK_FLAG_FRAME))
365  return AVERROR(ENOSYS);
366  cat->avf = NULL;
367  if ((ret = real_seek(avf, stream, min_ts, ts, max_ts, flags)) < 0) {
368  if (cat->avf)
369  avformat_close_input(&cat->avf);
370  cat->avf = cur_avf_saved;
371  cat->cur_file = cur_file_saved;
372  } else {
373  avformat_close_input(&cur_avf_saved);
374  }
375  return ret;
376 }
377 
378 #define OFFSET(x) offsetof(ConcatContext, x)
379 #define DEC AV_OPT_FLAG_DECODING_PARAM
380 
381 static const AVOption options[] = {
382  { "safe", "enable safe mode",
383  OFFSET(safe), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, DEC },
384  { NULL }
385 };
386 
387 static const AVClass concat_class = {
388  .class_name = "concat demuxer",
389  .item_name = av_default_item_name,
390  .option = options,
391  .version = LIBAVUTIL_VERSION_INT,
392 };
393 
394 
396  .name = "concat",
397  .long_name = NULL_IF_CONFIG_SMALL("Virtual concatenation script"),
398  .priv_data_size = sizeof(ConcatContext),
403  .read_seek2 = concat_seek,
404  .priv_class = &concat_class,
405 };
#define AVSEEK_FLAG_BACKWARD
Definition: avformat.h:1743
Definition: start.py:1
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
AVOption.
Definition: opt.h:251
static int concat_read_close(AVFormatContext *avf)
Definition: concatdec.c:147
av_default_item_name
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
#define DEC
Definition: concatdec.c:379
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
Definition: parseutils.c:530
#define FAIL(retcode)
Definition: concatdec.c:79
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:709
static void rescale_interval(AVRational tb_in, AVRational tb_out, int64_t *min_ts, int64_t *ts, int64_t *max_ts)
Definition: concatdec.c:289
Sinusoidal phase f
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
Definition: mem.c:141
static const AVOption options[]
Definition: concatdec.c:381
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
Copy the settings of the source AVCodecContext into the destination AVCodecContext.
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:944
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:55
static int concat_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Definition: concatdec.c:354
static int64_t start_time
Definition: ffplay.c:293
uint8_t
Round toward +infinity.
Definition: mathematics.h:71
float delta
AVOptions.
static AVPacket pkt
Definition: demuxing.c:56
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
Definition: avformat.h:992
#define t0
Definition: regdef.h:28
AVInputFormat ff_concat_demuxer
Definition: concatdec.c:395
#define AVERROR_EOF
End of file.
Definition: error.h:55
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
static int probe(AVProbeData *p)
Definition: act.c:36
static int concat_read_header(AVFormatContext *avf)
Definition: concatdec.c:160
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:130
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:183
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int concat_probe(AVProbeData *probe)
Definition: concatdec.c:43
Definition: graph2dot.c:48
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:716
#define FFMAX(a, b)
Definition: common.h:56
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
Definition: avstring.c:148
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:662
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip please avoid problems through this extra level of scrutiny For cosmetics only commits you should e g by running git config global user name My Name git config global user email my email which is either set in your personal configuration file through git config core editor or set by one of the following environment VISUAL or EDITOR Log messages should be concise but descriptive Explain why you made a what you did will be obvious from the changes themselves most of the time Saying just bug fix or is bad Remember that people of varying skill levels look at and educate themselves while reading through your code Don t include filenames in log Git provides that information Possibly make the commit message have a descriptive first an empty line and then a full description The first line will be used to name the patch by git format patch Renaming moving copying files or contents of files
Definition: git-howto.txt:153
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:336
unsigned int nb_streams
A list of all streams in the file.
Definition: avformat.h:991
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding rnd)
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
Definition: mathematics.c:122
static int try_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Definition: concatdec.c:299
char filename[1024]
input or output filename
Definition: avformat.h:994
static int read_probe(AVProbeData *pd)
ret
Definition: avfilter.c:821
FFmpeg Automated Testing Environment ************************************Table of Contents *****************FFmpeg Automated Testing Environment Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass target exec to configure or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script tests fate sh from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at doc fate_config sh template Create a configuration that suits your based on the configuration template The slot configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern< arch >< os >< compiler >< compiler version > The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the fate_recv variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration file
Definition: fate.txt:34
static const AVClass concat_class
Definition: concatdec.c:387
static int open_file(AVFormatContext *avf, unsigned fileno)
Definition: concatdec.c:126
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
Definition: aviobuf.c:618
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:517
Stream structure.
Definition: avformat.h:643
ConcatFile * cur_file
Definition: concatdec.c:36
NULL
Definition: eval.c:55
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:202
AVIOContext * pb
I/O context.
Definition: avformat.h:977
ConcatFile * files
Definition: concatdec.c:35
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:148
void * buf
Definition: avisynth_c.h:594
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
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:73
Describe the class of an AVClass context structure.
Definition: log.h:50
synthesis window for stochastic i
#define SPACE_CHARS
rational number numerator/denominator
Definition: rational.h:43
#define AVSEEK_FLAG_BYTE
seeking based on position in bytes
Definition: avformat.h:1744
unsigned nb_files
Definition: concatdec.c:37
This structure contains the data a format has to probe a file.
Definition: avformat.h:334
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
misc parsing utilities
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Round toward -infinity.
Definition: mathematics.h:70
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
int64_t start_time
Definition: concatdec.c:29
static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
Definition: concatdec.c:268
static int flags
Definition: cpu.c:23
int64_t start_time
Decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds...
Definition: avformat.h:1001
char * url
Definition: concatdec.c:28
#define AVPROBE_SCORE_MAX
maximum score, half of that is used for file-extension-based detection
Definition: avformat.h:340
Main libavformat public API header.
static char * get_keyword(uint8_t **cursor)
Definition: concatdec.c:49
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE...
Definition: mathematics.h:73
static int open_next_file(AVFormatContext *avf)
Definition: concatdec.c:255
int64_t duration
Definition: concatdec.c:30
static int real_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Definition: concatdec.c:317
void * priv_data
Format private data.
Definition: avformat.h:964
#define AVSEEK_FLAG_FRAME
seeking based on frame number
Definition: avformat.h:1746
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
#define OFFSET(x)
Definition: concatdec.c:378
int64_t duration
Decoding: duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1009
static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, unsigned *nb_files_alloc)
Definition: concatdec.c:81
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:461
static int safe_filename(const char *f)
Definition: concatdec.c:60
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:679
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:738
This structure stores compressed data.
void ff_make_absolute_url(char *buf, int size, const char *base, const char *rel)
Convert a relative url into an absolute url, given a base url.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:190
AVFormatContext * avf
Definition: concatdec.c:38