diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-03 04:08:04 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-03 04:08:09 +0100 |
commit | 983778f1f68a12b1e307572f48390428c0421a8e (patch) | |
tree | 4bd953ce2d75214302b16549548f4cc44495fe9c /libavformat/dashenc.c | |
parent | b0ba8a23b61506766f8497e2bf972da2077d235a (diff) | |
parent | c5e7ea13d2d4da0c5da91973a547afff6fe9e011 (diff) | |
download | ffmpeg-983778f1f68a12b1e307572f48390428c0421a8e.tar.gz |
Merge commit 'c5e7ea13d2d4da0c5da91973a547afff6fe9e011'
* commit 'c5e7ea13d2d4da0c5da91973a547afff6fe9e011':
dashenc: Use delay_moov
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r-- | libavformat/dashenc.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 7a0486f628..b3454688e5 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -628,7 +628,7 @@ static int dash_write_header(AVFormatContext *s) goto fail; os->init_start_pos = 0; - av_dict_set(&opts, "movflags", "frag_custom+dash", 0); + av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0); if ((ret = avformat_write_header(ctx, &opts)) < 0) { goto fail; } @@ -636,13 +636,7 @@ static int dash_write_header(AVFormatContext *s) avio_flush(ctx->pb); av_dict_free(&opts); - if (c->single_file) { - os->init_range_length = avio_tell(ctx->pb); - } else { - ffurl_close(os->out); - os->out = NULL; - } - av_log(s, AV_LOG_VERBOSE, "Representation %d init segment written to: %s\n", i, filename); + av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be written to: %s\n", i, filename); s->streams[i]->time_base = st->time_base; // If the muxer wants to shift timestamps, request to have them shifted @@ -748,7 +742,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; char filename[1024] = "", full_path[1024], temp_path[1024]; - int64_t start_pos = avio_tell(os->ctx->pb); + int64_t start_pos; int range_length, index_length = 0; if (!os->packets_written) @@ -766,6 +760,17 @@ static int dash_flush(AVFormatContext *s, int final, int stream) continue; } + if (!os->init_range_length) { + av_write_frame(os->ctx, NULL); + os->init_range_length = avio_tell(os->ctx->pb); + if (!c->single_file) { + ffurl_close(os->out); + os->out = NULL; + } + } + + start_pos = avio_tell(os->ctx->pb); + if (!c->single_file) { dash_fill_tmpl_params(filename, sizeof(filename), c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_dts); snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, filename); |