summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-05-01 10:09:07 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-05-01 10:09:07 (GMT)
commit1924a61a0a39dfb216f09a6d4d3cb9a1f8a758b4 (patch)
tree6c48c88fbca967a08bd43c8ceae6dc8234713f2e
parent3319679d0a36bec3e78f639d6f9fbbe596f6eec3 (diff)
parent3d624420086ed3cd0c74f4510f0285968e21c117 (diff)
downloadffmpeg-1924a61a0a39dfb216f09a6d4d3cb9a1f8a758b4.zip
ffmpeg-1924a61a0a39dfb216f09a6d4d3cb9a1f8a758b4.tar.gz
ffmpeg-1924a61a0a39dfb216f09a6d4d3cb9a1f8a758b4.tar.bz2
Merge commit '3d624420086ed3cd0c74f4510f0285968e21c117'
* commit '3d624420086ed3cd0c74f4510f0285968e21c117': avconv_opt: allocate an OutputFile before the streams. Conflicts: ffmpeg_opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--ffmpeg_opt.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index f03f29b..b27a2c3 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -986,7 +986,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit(1);
output_streams[nb_output_streams - 1] = ost;
- ost->file_index = nb_output_files;
+ ost->file_index = nb_output_files - 1;
ost->index = idx;
ost->st = st;
st->codec->codec_type = type;
@@ -1573,6 +1573,33 @@ static int open_output_file(OptionsContext *o, const char *filename)
exit(1);
}
+ if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
+ o->stop_time = INT64_MAX;
+ av_log(NULL, AV_LOG_WARNING, "-t and -to cannot be used together; using -t.\n");
+ }
+
+ if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) {
+ if (o->stop_time <= o->start_time) {
+ av_log(NULL, AV_LOG_WARNING, "-to value smaller than -ss; ignoring -to.\n");
+ o->stop_time = INT64_MAX;
+ } else {
+ o->recording_time = o->stop_time - o->start_time;
+ }
+ }
+
+ GROW_ARRAY(output_files, nb_output_files);
+ of = av_mallocz(sizeof(*of));
+ if (!of)
+ exit(1);
+ output_files[nb_output_files - 1] = of;
+
+ of->ost_index = nb_output_streams;
+ of->recording_time = o->recording_time;
+ of->start_time = o->start_time;
+ of->limit_filesize = o->limit_filesize;
+ of->shortest = o->shortest;
+ av_dict_copy(&of->opts, o->g->format_opts, 0);
+
if (!strcmp(filename, "-"))
filename = "pipe:";
@@ -1581,6 +1608,11 @@ static int open_output_file(OptionsContext *o, const char *filename)
print_error(filename, err);
exit(1);
}
+
+ of->ctx = oc;
+ if (o->recording_time != INT64_MAX)
+ oc->duration = o->recording_time;
+
file_oformat= oc->oformat;
oc->interrupt_callback = int_cb;
@@ -1786,37 +1818,6 @@ loop_end:
exit(1);
}
- if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
- o->stop_time = INT64_MAX;
- av_log(NULL, AV_LOG_WARNING, "-t and -to cannot be used together; using -t.\n");
- }
-
- if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) {
- if (o->stop_time <= o->start_time) {
- av_log(NULL, AV_LOG_WARNING, "-to value smaller than -ss; ignoring -to.\n");
- o->stop_time = INT64_MAX;
- } else {
- o->recording_time = o->stop_time - o->start_time;
- }
- }
-
- GROW_ARRAY(output_files, nb_output_files);
- of = av_mallocz(sizeof(*of));
- if (!of)
- exit(1);
- output_files[nb_output_files - 1] = of;
-
- of->ctx = oc;
- of->ost_index = nb_output_streams - oc->nb_streams;
- of->recording_time = o->recording_time;
- if (o->recording_time != INT64_MAX)
- oc->duration = o->recording_time;
- of->start_time = o->start_time;
- of->limit_filesize = o->limit_filesize;
- of->shortest = o->shortest;
- av_dict_copy(&of->opts, o->g->format_opts, 0);
-
-
/* check if all codec options have been used */
unused_opts = strip_specifiers(o->g->codec_opts);
for (i = of->ost_index; i < nb_output_streams; i++) {