Message ID | 1492789235-55398-1-git-send-email-derek.buitenhuis@gmail.com |
---|---|
State | Accepted |
Commit | 6ba1c9bf7e8a92cf1977ca11ce595a5872d0ce40 |
Headers | show |
On 4/21/2017 4:40 PM, Derek Buitenhuis wrote: > The WebM DASH spec states: > The Initialization Segment shall not contain Clusters or Cues. > The Segment Index corresponds to the Cues. > > Previously, it included the cues if they were at the front. > > Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> > --- > libavformat/matroskadec.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) Ping. - Derek
On Sun, 23 Apr 2017 14:08:18 +0100 Derek Buitenhuis <derek.buitenhuis@gmail.com> wrote: > On 4/21/2017 4:40 PM, Derek Buitenhuis wrote: > > The WebM DASH spec states: > > The Initialization Segment shall not contain Clusters or Cues. > > The Segment Index corresponds to the Cues. > > > > Previously, it included the cues if they were at the front. > > > > Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> > > --- > > libavformat/matroskadec.c | 13 ++++++++++--- > > 1 file changed, 10 insertions(+), 3 deletions(-) > > Ping. Same as with the other patch, just push it.
On Fri, Apr 21, 2017 at 8:40 AM, Derek Buitenhuis <derek.buitenhuis@gmail.com> wrote: > The WebM DASH spec states: > The Initialization Segment shall not contain Clusters or Cues. > The Segment Index corresponds to the Cues. > > Previously, it included the cues if they were at the front. Looks good. Thanks. > > Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> > --- > libavformat/matroskadec.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > index 9adca8d..b3f68d3 100644 > --- a/libavformat/matroskadec.c > +++ b/libavformat/matroskadec.c > @@ -3815,7 +3815,7 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t > return (int64_t)bandwidth; > } > > -static int webm_dash_manifest_cues(AVFormatContext *s) > +static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) > { > MatroskaDemuxContext *matroska = s->priv_data; > EbmlList *seekhead_list = &matroska->seekhead; > @@ -3854,6 +3854,11 @@ static int webm_dash_manifest_cues(AVFormatContext *s) > // cues end > av_dict_set_int(&s->streams[0]->metadata, CUES_END, cues_end, 0); > > + // if the file has cues at the start, fix up the init range so tht *that > + // it does not include it > + if (cues_start <= init_range) > + av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, cues_start - 1, 0); > + > // bandwidth > bandwidth = webm_dash_manifest_compute_bandwidth(s, cues_start); > if (bandwidth < 0) return -1; > @@ -3883,6 +3888,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) > { > char *buf; > int ret = matroska_read_header(s); > + int64_t init_range; > MatroskaTrack *tracks; > MatroskaDemuxContext *matroska = s->priv_data; > if (ret) { > @@ -3903,7 +3909,8 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) > > // initialization range > // 5 is the offset of Cluster ID. > - av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(s->pb) - 5, 0); > + init_range = avio_tell(s->pb) - 5; > + av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, init_range, 0); > } > > // basename of the file > @@ -3916,7 +3923,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) > > // parse the cues and populate Cue related fields > if (!matroska->is_live) { > - ret = webm_dash_manifest_cues(s); > + ret = webm_dash_manifest_cues(s, init_range); > if (ret < 0) { > av_log(s, AV_LOG_ERROR, "Error parsing Cues\n"); > return ret; > -- > 1.8.3.1 >
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9adca8d..b3f68d3 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3815,7 +3815,7 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t return (int64_t)bandwidth; } -static int webm_dash_manifest_cues(AVFormatContext *s) +static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) { MatroskaDemuxContext *matroska = s->priv_data; EbmlList *seekhead_list = &matroska->seekhead; @@ -3854,6 +3854,11 @@ static int webm_dash_manifest_cues(AVFormatContext *s) // cues end av_dict_set_int(&s->streams[0]->metadata, CUES_END, cues_end, 0); + // if the file has cues at the start, fix up the init range so tht + // it does not include it + if (cues_start <= init_range) + av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, cues_start - 1, 0); + // bandwidth bandwidth = webm_dash_manifest_compute_bandwidth(s, cues_start); if (bandwidth < 0) return -1; @@ -3883,6 +3888,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) { char *buf; int ret = matroska_read_header(s); + int64_t init_range; MatroskaTrack *tracks; MatroskaDemuxContext *matroska = s->priv_data; if (ret) { @@ -3903,7 +3909,8 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) // initialization range // 5 is the offset of Cluster ID. - av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(s->pb) - 5, 0); + init_range = avio_tell(s->pb) - 5; + av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, init_range, 0); } // basename of the file @@ -3916,7 +3923,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) // parse the cues and populate Cue related fields if (!matroska->is_live) { - ret = webm_dash_manifest_cues(s); + ret = webm_dash_manifest_cues(s, init_range); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error parsing Cues\n"); return ret;
The WebM DASH spec states: The Initialization Segment shall not contain Clusters or Cues. The Segment Index corresponds to the Cues. Previously, it included the cues if they were at the front. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> --- libavformat/matroskadec.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)