MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / open_output_file

Function open_output_file

ffmpeg-single-cmd/src/main/cpp/ffmpeg_opt.c:2016–2683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2014}
2015
2016static int open_output_file(OptionsContext *o, const char *filename)
2017{
2018 AVFormatContext *oc;
2019 int i, j, err;
2020 AVOutputFormat *file_oformat;
2021 OutputFile *of;
2022 OutputStream *ost;
2023 InputStream *ist;
2024 AVDictionary *unused_opts = NULL;
2025 AVDictionaryEntry *e = NULL;
2026 int format_flags = 0;
2027
2028 if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
2029 o->stop_time = INT64_MAX;
2030 av_log(NULL, AV_LOG_WARNING, "-t and -to cannot be used together; using -t.\n");
2031 }
2032
2033 if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) {
2034 int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : o->start_time;
2035 if (o->stop_time <= start_time) {
2036 av_log(NULL, AV_LOG_ERROR, "-to value smaller than -ss; aborting.\n");
2037 exit_program(1);
2038 } else {
2039 o->recording_time = o->stop_time - start_time;
2040 }
2041 }
2042
2043 GROW_ARRAY(output_files, nb_output_files);
2044 of = av_mallocz(sizeof(*of));
2045 if (!of)
2046 exit_program(1);
2047 output_files[nb_output_files - 1] = of;
2048
2049 of->ost_index = nb_output_streams;
2050 of->recording_time = o->recording_time;
2051 of->start_time = o->start_time;
2052 of->limit_filesize = o->limit_filesize;
2053 of->shortest = o->shortest;
2054 av_dict_copy(&of->opts, o->g->format_opts, 0);
2055
2056 if (!strcmp(filename, "-"))
2057 filename = "pipe:";
2058
2059 err = avformat_alloc_output_context2(&oc, NULL, o->format, filename);
2060 if (!oc) {
2061 print_error(filename, err);
2062 exit_program(1);
2063 }
2064
2065 of->ctx = oc;
2066 if (o->recording_time != INT64_MAX)
2067 oc->duration = o->recording_time;
2068
2069 file_oformat= oc->oformat;
2070 oc->interrupt_callback = int_cb;
2071
2072 e = av_dict_get(o->g->format_opts, "fflags", NULL, 0);
2073 if (e) {

Callers

nothing calls this directly

Calls 15

exit_programFunction · 0.85
print_errorFunction · 0.85
init_output_filterFunction · 0.85
parse_optionFunction · 0.85
read_ffserver_streamsFunction · 0.85
new_video_streamFunction · 0.85
new_audio_streamFunction · 0.85
new_subtitle_streamFunction · 0.85
new_data_streamFunction · 0.85
new_attachment_streamFunction · 0.85
new_unknown_streamFunction · 0.85
check_stream_specifierFunction · 0.85

Tested by

no test coverage detected