diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 519f9c4..ea96f71 100644
|
a
|
b
|
static int write_manifest(AVFormatContext *s, int final)
|
| 498 | 498 | OutputStream *os = &c->streams[0]; |
| 499 | 499 | int start_index = FFMAX(os->nb_segments - c->window_size, 0); |
| 500 | 500 | int64_t start_time = av_rescale_q(os->segments[start_index]->time, s->streams[0]->time_base, AV_TIME_BASE_Q); |
| 501 | | avio_printf(out, "\t<Period start=\""); |
| | 501 | avio_printf(out, "\t<Period%s start=\"",final?"":" id=\"0\""); |
| 502 | 502 | write_time(out, start_time); |
| 503 | 503 | avio_printf(out, "\">\n"); |
| 504 | 504 | } else { |
| 505 | | avio_printf(out, "\t<Period start=\"PT0.0S\">\n"); |
| | 505 | avio_printf(out, "\t<Period%s start=\"PT0.0S\">\n",final?"":" id=\"0\""); |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | if (c->has_video) { |
| 509 | 509 | avio_printf(out, "\t\t<AdaptationSet contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\""); |
| 510 | | if (c->max_frame_rate.num && !c->ambiguous_frame_rate) |
| 511 | | avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); |
| 512 | 510 | avio_printf(out, ">\n"); |
| 513 | 511 | |
| 514 | 512 | for (i = 0; i < s->nb_streams; i++) { |
| … |
… |
static int dash_write_header(AVFormatContext *s)
|
| 598 | 596 | AVDictionary *opts = NULL; |
| 599 | 597 | char filename[1024]; |
| 600 | 598 | |
| 601 | | os->bit_rate = s->streams[i]->codecpar->bit_rate; |
| | 599 | os->bit_rate = s->streams[i]->codecpar->bit_rate ? s->streams[i]->codecpar->bit_rate : s->bit_rate; |
| | 600 | |
| 602 | 601 | if (os->bit_rate) { |
| 603 | 602 | snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), |
| 604 | 603 | " bandwidth=\"%d\"", os->bit_rate); |
| 605 | 604 | } else { |
| | 605 | snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), |
| | 606 | " bandwidth=\"%d\"", 0); |
| | 607 | |
| 606 | 608 | int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ? |
| 607 | 609 | AV_LOG_ERROR : AV_LOG_WARNING; |
| 608 | 610 | av_log(s, level, "No bit rate set for stream %d\n", i); |
| … |
… |
static int dash_write_header(AVFormatContext *s)
|
| 654 | 656 | goto fail; |
| 655 | 657 | os->init_start_pos = 0; |
| 656 | 658 | |
| 657 | | av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0); |
| | 659 | av_dict_set(&opts, "movflags", "dash+frag_keyframe+empty_moov+separate_moof+delay_moov", 0); |
| 658 | 660 | if ((ret = avformat_write_header(ctx, &opts)) < 0) { |
| 659 | 661 | goto fail; |
| 660 | 662 | } |
| … |
… |
static int dash_flush(AVFormatContext *s, int final, int stream)
|
| 858 | 860 | if (ret < 0) |
| 859 | 861 | break; |
| 860 | 862 | } |
| | 863 | |
| | 864 | os->bit_rate = (int)( (float)range_length*8 / ((float)(os->max_pts - os->start_pts) / 10000) ); |
| | 865 | snprintf(os->bandwidth_str, sizeof(os->bandwidth_str)," bandwidth=\"%i\"", os->bit_rate); |
| | 866 | |
| 861 | 867 | add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, start_pos, range_length, index_length); |
| 862 | 868 | av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, full_path); |
| 863 | 869 | } |