• Home
  • Raw
  • Download

Lines Matching refs:avf

62     AVFormatContext *avf;  member
109 static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, in add_file() argument
112 ConcatContext *cat = avf->priv_data; in add_file()
121 av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename); in add_file()
131 url_len = strlen(avf->url) + strlen(filename) + 16; in add_file()
134 ff_make_absolute_url(url, url_len, avf->url, filename); in add_file()
194 static int detect_stream_specific(AVFormatContext *avf, int idx) in detect_stream_specific() argument
196 ConcatContext *cat = avf->priv_data; in detect_stream_specific()
197 AVStream *st = cat->avf->streams[idx]; in detect_stream_specific()
208 av_log(cat->avf, AV_LOG_INFO, in detect_stream_specific()
212 av_log(avf, AV_LOG_ERROR, "h264_mp4toannexb bitstream filter " in detect_stream_specific()
236 static int match_streams_one_to_one(AVFormatContext *avf) in match_streams_one_to_one() argument
238 ConcatContext *cat = avf->priv_data; in match_streams_one_to_one()
242 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++) { in match_streams_one_to_one()
243 if (i < avf->nb_streams) { in match_streams_one_to_one()
244 st = avf->streams[i]; in match_streams_one_to_one()
246 if (!(st = avformat_new_stream(avf, NULL))) in match_streams_one_to_one()
249 if ((ret = copy_stream_props(st, cat->avf->streams[i])) < 0) in match_streams_one_to_one()
256 static int match_streams_exact_id(AVFormatContext *avf) in match_streams_exact_id() argument
258 ConcatContext *cat = avf->priv_data; in match_streams_exact_id()
262 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++) { in match_streams_exact_id()
263 st = cat->avf->streams[i]; in match_streams_exact_id()
264 for (j = 0; j < avf->nb_streams; j++) { in match_streams_exact_id()
265 if (avf->streams[j]->id == st->id) { in match_streams_exact_id()
266 av_log(avf, AV_LOG_VERBOSE, in match_streams_exact_id()
269 if ((ret = copy_stream_props(avf->streams[j], st)) < 0) in match_streams_exact_id()
278 static int match_streams(AVFormatContext *avf) in match_streams() argument
280 ConcatContext *cat = avf->priv_data; in match_streams()
284 if (cat->cur_file->nb_streams >= cat->avf->nb_streams) in match_streams()
287 cat->avf->nb_streams * sizeof(*map)); in match_streams()
292 (cat->avf->nb_streams - cat->cur_file->nb_streams) * sizeof(*map)); in match_streams()
294 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++) { in match_streams()
296 if ((ret = detect_stream_specific(avf, i)) < 0) in match_streams()
301 ret = match_streams_one_to_one(avf); in match_streams()
304 ret = match_streams_exact_id(avf); in match_streams()
311 cat->cur_file->nb_streams = cat->avf->nb_streams; in match_streams()
315 static int64_t get_best_effort_duration(ConcatFile *file, AVFormatContext *avf) in get_best_effort_duration() argument
321 if (avf->duration > 0) in get_best_effort_duration()
322 return avf->duration - (file->file_inpoint - file->file_start_time); in get_best_effort_duration()
328 static int open_file(AVFormatContext *avf, unsigned fileno) in open_file() argument
330 ConcatContext *cat = avf->priv_data; in open_file()
334 if (cat->avf) in open_file()
335 avformat_close_input(&cat->avf); in open_file()
337 cat->avf = avformat_alloc_context(); in open_file()
338 if (!cat->avf) in open_file()
341 cat->avf->flags |= avf->flags & ~AVFMT_FLAG_CUSTOM_IO; in open_file()
342 cat->avf->interrupt_callback = avf->interrupt_callback; in open_file()
344 if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0) in open_file()
347 if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || in open_file()
348 (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { in open_file()
349 av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); in open_file()
350 avformat_close_input(&cat->avf); in open_file()
357 file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : cat->avf->start_time; in open_file()
359 file->duration = get_best_effort_duration(file, cat->avf); in open_file()
367 if ((ret = match_streams(avf)) < 0) in open_file()
370 if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, file->inpoint, file->inpoint, 0)) < 0) in open_file()
376 static int concat_read_close(AVFormatContext *avf) in concat_read_close() argument
378 ConcatContext *cat = avf->priv_data; in concat_read_close()
390 if (cat->avf) in concat_read_close()
391 avformat_close_input(&cat->avf); in concat_read_close()
396 static int concat_read_header(AVFormatContext *avf) in concat_read_header() argument
398 ConcatContext *cat = avf->priv_data; in concat_read_header()
408 while ((ret = ff_read_line_to_bprint_overwrite(avf->pb, &bp)) >= 0) { in concat_read_header()
418 av_log(avf, AV_LOG_ERROR, "Line %d: filename required\n", line); in concat_read_header()
421 if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0) in concat_read_header()
427 av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", in concat_read_header()
432 av_log(avf, AV_LOG_ERROR, "Line %d: invalid %s '%s'\n", in concat_read_header()
445 av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", in concat_read_header()
451 av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line); in concat_read_header()
455 av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line); in concat_read_header()
461 if (!avformat_new_stream(avf, NULL)) in concat_read_header()
464 if (!avf->nb_streams) { in concat_read_header()
465 av_log(avf, AV_LOG_ERROR, "Line %d: exact_stream_id without stream\n", in concat_read_header()
469 avf->streams[avf->nb_streams - 1]->id = in concat_read_header()
475 av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line); in concat_read_header()
481 av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", in concat_read_header()
505 avf->duration = time; in concat_read_header()
509 cat->stream_match_mode = avf->nb_streams ? MATCH_EXACT_ID : in concat_read_header()
511 if ((ret = open_file(avf, 0)) < 0) in concat_read_header()
518 concat_read_close(avf); in concat_read_header()
522 static int open_next_file(AVFormatContext *avf) in open_next_file() argument
524 ConcatContext *cat = avf->priv_data; in open_next_file()
527 cat->cur_file->duration = get_best_effort_duration(cat->cur_file, cat->avf); in open_next_file()
533 return open_file(avf, fileno); in open_next_file()
536 static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt) in filter_packet() argument
543 av_log(avf, AV_LOG_ERROR, "h264_mp4toannexb filter " in filter_packet()
552 av_log(avf, AV_LOG_ERROR, "h264_mp4toannexb filter " in filter_packet()
564 return av_compare_ts(pkt->dts, cat->avf->streams[pkt->stream_index]->time_base, in packet_after_outpoint()
570 static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) in concat_read_packet() argument
572 ConcatContext *cat = avf->priv_data; in concat_read_packet()
581 if (!cat->avf) in concat_read_packet()
585 ret = av_read_frame(cat->avf, pkt); in concat_read_packet()
587 if ((ret = open_next_file(avf)) < 0) in concat_read_packet()
593 if ((ret = match_streams(avf)) < 0) { in concat_read_packet()
598 if ((ret = open_next_file(avf)) < 0) in concat_read_packet()
609 if ((ret = filter_packet(avf, cs, pkt)) < 0) in concat_read_packet()
612 st = cat->avf->streams[pkt->stream_index]; in concat_read_packet()
613 av_log(avf, AV_LOG_DEBUG, "file:%d stream:%d pts:%s pts_time:%s dts:%s dts_time:%s", in concat_read_packet()
620 cat->avf->streams[pkt->stream_index]->time_base); in concat_read_packet()
625 av_log(avf, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n", in concat_read_packet()
662 static int try_seek(AVFormatContext *avf, int stream, in try_seek() argument
665 ConcatContext *cat = avf->priv_data; in try_seek()
672 if (stream >= cat->avf->nb_streams) in try_seek()
674 rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, in try_seek()
677 return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags); in try_seek()
680 static int real_seek(AVFormatContext *avf, int stream, in real_seek() argument
683 ConcatContext *cat = avf->priv_data; in real_seek()
687 if (stream >= avf->nb_streams) in real_seek()
689 rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, in real_seek()
711 if ((ret = open_file(avf, left)) < 0) in real_seek()
714 cat->avf = cur_avf; in real_seek()
717 ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); in real_seek()
722 cat->avf = NULL; in real_seek()
723 if ((ret = open_file(avf, left + 1)) < 0) in real_seek()
725 ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); in real_seek()
730 static int concat_seek(AVFormatContext *avf, int stream, in concat_seek() argument
733 ConcatContext *cat = avf->priv_data; in concat_seek()
735 AVFormatContext *cur_avf_saved = cat->avf; in concat_seek()
740 cat->avf = NULL; in concat_seek()
741 if ((ret = real_seek(avf, stream, min_ts, ts, max_ts, flags, cur_avf_saved)) < 0) { in concat_seek()
743 if (cat->avf) in concat_seek()
744 avformat_close_input(&cat->avf); in concat_seek()
746 cat->avf = cur_avf_saved; in concat_seek()