63 return memcmp(probe->
buf,
"ffconcat version 1.0", 20) ?
80 const char *
start = f;
84 if (!((
unsigned)((*f | 32) -
'a') < 26 ||
85 (
unsigned)(*f -
'0') < 10 || *f ==
'_' || *f ==
'-')) {
97 #define FAIL(retcode) do { ret = (retcode); goto fail; } while(0)
100 unsigned *nb_files_alloc)
106 size_t url_len, proto_len;
115 proto_len = proto ? strlen(proto) : 0;
116 if (!memcmp(filename, proto, proto_len) &&
117 (filename[proto_len] ==
':' || filename[proto_len] ==
',')) {
121 url_len = strlen(avf->
filename) + strlen(filename) + 16;
128 if (cat->
nb_files >= *nb_files_alloc) {
129 size_t n =
FFMAX(*nb_files_alloc * 2, 16);
131 if (n <= cat->nb_files || n > SIZE_MAX /
sizeof(*cat->
files) ||
134 cat->
files = new_files;
139 memset(file, 0,
sizeof(*file));
188 "Auto-inserting h264_mp4toannexb bitstream filter\n");
191 "required for H.264 streams\n");
230 "Match slave stream #%d with stream #%d id 0x%x\n",
319 for (i = 0; i < cat->
nb_files; i++) {
333 unsigned nb_files_alloc = 0;
343 if (!*keyword || *keyword ==
'#')
346 if (!strcmp(keyword,
"file")) {
352 if ((ret =
add_file(avf, filename, &file, &nb_files_alloc)) < 0)
354 }
else if (!strcmp(keyword,
"duration")) {
368 }
else if (!strcmp(keyword,
"stream")) {
371 }
else if (!strcmp(keyword,
"exact_stream_id")) {
379 }
else if (!strcmp(keyword,
"ffconcat")) {
382 if (strcmp(ver_kw,
"version") || strcmp(ver_val,
"1.0")) {
399 for (i = 0; i < cat->
nb_files; i++) {
445 for (bsf = cs->
bsf; bsf; bsf = bsf->
next) {
456 if (ret == 0 && pkt2.
data != pkt->
data) {
481 int64_t file_start_time,
delta;
535 int64_t *min_ts, int64_t *ts, int64_t *max_ts)
545 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
551 min_ts = min_ts == INT64_MIN ? INT64_MIN : min_ts -
t0;
552 max_ts = max_ts == INT64_MAX ? INT64_MAX : max_ts -
t0;
557 &min_ts, &ts, &max_ts);
563 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
566 int ret, left, right;
572 &min_ts, &ts, &max_ts);
577 while (right - left > 1) {
578 int mid = (left + right) / 2;
588 ret =
try_seek(avf, stream, min_ts, ts, max_ts, flags);
590 left < cat->nb_files - 1 &&
592 if ((ret =
open_file(avf, left + 1)) < 0)
594 ret =
try_seek(avf, stream, min_ts, ts, max_ts, flags);
600 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
612 if ((ret =
real_seek(avf, stream, min_ts, ts, max_ts, flags)) < 0) {
615 cat->
avf = cur_avf_saved;
623 #define OFFSET(x) offsetof(ConcatContext, x)
624 #define DEC AV_OPT_FLAG_DECODING_PARAM
627 {
"safe",
"enable safe mode",
629 {
"auto_convert",
"automatically convert bitstream format",
651 .priv_class = &concat_class,