62 return memcmp(probe->
buf,
"ffconcat version 1.0", 20) ?
79 const char *
start = f;
83 if (!((
unsigned)((*f | 32) -
'a') < 26 ||
84 (
unsigned)(*f -
'0') < 10 || *f ==
'_' || *f ==
'-')) {
96 #define FAIL(retcode) do { ret = (retcode); goto fail; } while(0)
99 unsigned *nb_files_alloc)
105 size_t url_len, proto_len;
114 proto_len = proto ? strlen(proto) : 0;
115 if (!memcmp(filename, proto, proto_len) &&
116 (filename[proto_len] ==
':' || filename[proto_len] ==
',')) {
120 url_len = strlen(avf->
filename) + strlen(filename) + 16;
127 if (cat->
nb_files >= *nb_files_alloc) {
128 size_t n =
FFMAX(*nb_files_alloc * 2, 16);
130 if (n <= cat->nb_files || n > SIZE_MAX /
sizeof(*cat->
files) ||
133 cat->
files = new_files;
138 memset(file, 0,
sizeof(*file));
187 "Auto-inserting h264_mp4toannexb bitstream filter\n");
190 "required for H.264 streams\n");
229 "Match slave stream #%d with stream #%d id 0x%x\n",
314 for (i = 0; i < cat->
nb_files; i++) {
328 unsigned nb_files_alloc = 0;
338 if (!*keyword || *keyword ==
'#')
341 if (!strcmp(keyword,
"file")) {
347 if ((ret =
add_file(avf, filename, &file, &nb_files_alloc)) < 0)
349 }
else if (!strcmp(keyword,
"duration")) {
363 }
else if (!strcmp(keyword,
"stream")) {
366 }
else if (!strcmp(keyword,
"exact_stream_id")) {
374 }
else if (!strcmp(keyword,
"ffconcat")) {
377 if (strcmp(ver_kw,
"version") || strcmp(ver_val,
"1.0")) {
394 for (i = 0; i < cat->
nb_files; i++) {
440 for (bsf = cs->
bsf; bsf; bsf = bsf->
next) {
451 if (ret == 0 && pkt2.
data != pkt->
data) {
514 int64_t *min_ts, int64_t *ts, int64_t *max_ts)
524 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
530 min_ts = min_ts == INT64_MIN ? INT64_MIN : min_ts -
t0;
531 max_ts = max_ts == INT64_MAX ? INT64_MAX : max_ts -
t0;
536 &min_ts, &ts, &max_ts);
542 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
545 int ret, left, right;
551 &min_ts, &ts, &max_ts);
556 while (right - left > 1) {
557 int mid = (left + right) / 2;
567 ret =
try_seek(avf, stream, min_ts, ts, max_ts, flags);
569 left < cat->nb_files - 1 &&
571 if ((ret =
open_file(avf, left + 1)) < 0)
573 ret =
try_seek(avf, stream, min_ts, ts, max_ts, flags);
579 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
591 if ((ret =
real_seek(avf, stream, min_ts, ts, max_ts, flags)) < 0) {
594 cat->
avf = cur_avf_saved;
602 #define OFFSET(x) offsetof(ConcatContext, x)
603 #define DEC AV_OPT_FLAG_DECODING_PARAM
606 {
"safe",
"enable safe mode",
608 {
"auto_convert",
"automatically convert bitstream format",
630 .priv_class = &concat_class,