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) {
529 int64_t *min_ts, int64_t *ts, int64_t *max_ts)
539 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
545 min_ts = min_ts == INT64_MIN ? INT64_MIN : min_ts -
t0;
546 max_ts = max_ts == INT64_MAX ? INT64_MAX : max_ts -
t0;
551 &min_ts, &ts, &max_ts);
557 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
560 int ret, left, right;
566 &min_ts, &ts, &max_ts);
571 while (right - left > 1) {
572 int mid = (left + right) / 2;
582 ret =
try_seek(avf, stream, min_ts, ts, max_ts, flags);
584 left < cat->nb_files - 1 &&
586 if ((ret =
open_file(avf, left + 1)) < 0)
588 ret =
try_seek(avf, stream, min_ts, ts, max_ts, flags);
594 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
606 if ((ret =
real_seek(avf, stream, min_ts, ts, max_ts, flags)) < 0) {
609 cat->
avf = cur_avf_saved;
617 #define OFFSET(x) offsetof(ConcatContext, x)
618 #define DEC AV_OPT_FLAG_DECODING_PARAM
621 {
"safe",
"enable safe mode",
623 {
"auto_convert",
"automatically convert bitstream format",
645 .priv_class = &concat_class,