diff mbox

[FFmpeg-devel] Support signaling of last segment number

Message ID 1521748312-19232-1-git-send-email-raut.sanil@gmail.com
State New
Headers show

Commit Message

sanilraut March 22, 2018, 7:51 p.m. UTC
Last segment indicated by mpd is not parsed.
Example stream: http://dash.akamaized.net/dash264/TestCasesIOP41/LastSegmentNumber/1/manifest_last_segment_num.mpd

This patch supports parsing of Supplemental Descriptor with @schemeIdUri set to http://dashif.org/guide-
lines/last-segment-number with the @value set to the last segment number.

---
 libavformat/dashdec.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Comments

Jan Ekström March 22, 2018, 8:14 p.m. UTC | #1
On Thu, Mar 22, 2018 at 9:51 PM, sanilraut <raut.sanil@gmail.com> wrote:
> Last segment indicated by mpd is not parsed.
> Example stream: http://dash.akamaized.net/dash264/TestCasesIOP41/LastSegmentNumber/1/manifest_last_segment_num.mpd
>
> This patch supports parsing of Supplemental Descriptor with @schemeIdUri set to http://dashif.org/guide-
> lines/last-segment-number with the @value set to the last segment number.
>

Hi,

Just seeing the commit message, I don't remember if the MPEG-DASH
demuxer had any FATE tests, but this stuff sounds like something that
should be included as such. MPEG-DASH is quite complex and having
tests making sure that we get the same things out of the demuxer would
be quite helpful.

You can see for example tests/fate/mov.mak as an example of testing a demuxer.

Best regards,
Jan
Michael Niedermayer March 24, 2018, 12:24 a.m. UTC | #2
On Thu, Mar 22, 2018 at 10:14:36PM +0200, Jan Ekström wrote:
> On Thu, Mar 22, 2018 at 9:51 PM, sanilraut <raut.sanil@gmail.com> wrote:
> > Last segment indicated by mpd is not parsed.
> > Example stream: http://dash.akamaized.net/dash264/TestCasesIOP41/LastSegmentNumber/1/manifest_last_segment_num.mpd
> >
> > This patch supports parsing of Supplemental Descriptor with @schemeIdUri set to http://dashif.org/guide-
> > lines/last-segment-number with the @value set to the last segment number.
> >
> 
> Hi,
> 
> Just seeing the commit message, 

... i realize its missing the avformat / libavformat/dashdec prefix :)
very minor issue but it seems a common mistake
maybe something could test for this automatically so new people would
notice before git send mail
sanilraut March 25, 2018, 8:17 p.m. UTC | #3
Thanks.

@Jan: I will look into the FATE tests. I have emailed you a few questions
that I have about FATE. Looking forward to your reply.
@Michael: I have added the prefix and resubmitted the patch.

Regards,
Sanil


On Fri, Mar 23, 2018 at 5:24 PM, Michael Niedermayer <michael@niedermayer.cc
> wrote:

> On Thu, Mar 22, 2018 at 10:14:36PM +0200, Jan Ekström wrote:
> > On Thu, Mar 22, 2018 at 9:51 PM, sanilraut <raut.sanil@gmail.com> wrote:
> > > Last segment indicated by mpd is not parsed.
> > > Example stream: http://dash.akamaized.net/dash264/TestCasesIOP41/
> LastSegmentNumber/1/manifest_last_segment_num.mpd
> > >
> > > This patch supports parsing of Supplemental Descriptor with
> @schemeIdUri set to http://dashif.org/guide-
> > > lines/last-segment-number with the @value set to the last segment
> number.
> > >
> >
> > Hi,
> >
> > Just seeing the commit message,
>
> ... i realize its missing the avformat / libavformat/dashdec prefix :)
> very minor issue but it seems a common mistake
> maybe something could test for this automatically so new people would
> notice before git send mail
>
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Dictatorship naturally arises out of democracy, and the most aggravated
> form of tyranny and slavery out of the most extreme liberty. -- Plato
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
diff mbox

Patch

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 7b79b93..db63a99 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -805,7 +805,8 @@  static int parse_manifest_representation(AVFormatContext *s, const char *url,
                                          xmlNodePtr fragment_template_node,
                                          xmlNodePtr content_component_node,
                                          xmlNodePtr adaptionset_baseurl_node,
-                                         xmlNodePtr adaptionset_segmentlist_node)
+                                         xmlNodePtr adaptionset_segmentlist_node,
+                                         xmlNodePtr adaptionset_supplementalproperty_node)
 {
     int32_t ret = 0;
     int32_t audio_rep_idx = 0;
@@ -825,6 +826,7 @@  static int parse_manifest_representation(AVFormatContext *s, const char *url,
     char *timescale_val = NULL;
     char *initialization_val = NULL;
     char *media_val = NULL;
+    char *val = NULL;
     xmlNodePtr baseurl_nodes[4];
     xmlNodePtr representation_node = node;
     char *rep_id_val = xmlGetProp(representation_node, "id");
@@ -920,6 +922,13 @@  static int parse_manifest_representation(AVFormatContext *s, const char *url,
                 rep->first_seq_no = (int64_t) strtoll(startnumber_val, NULL, 10);
                 xmlFree(startnumber_val);
             }
+            if (adaptionset_supplementalproperty_node) {
+                if (!strcmp(xmlGetProp(adaptionset_supplementalproperty_node,"schemeIdUri"), "http://dashif.org/guidelines/last-segment-number")) {
+                    val = xmlGetProp(adaptionset_supplementalproperty_node,"value");
+                    rep->last_seq_no =(int64_t) strtoll(val, NULL, 10) - 1;
+                    xmlFree(val);
+                 }
+            }
 
             fragment_timeline_node = find_child_node_by_name(representation_segmenttemplate_node, "SegmentTimeline");
 
@@ -1054,6 +1063,7 @@  static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
     xmlNodePtr content_component_node = NULL;
     xmlNodePtr adaptionset_baseurl_node = NULL;
     xmlNodePtr adaptionset_segmentlist_node = NULL;
+    xmlNodePtr adaptionset_supplementalproperty_node = NULL;
     xmlNodePtr node = NULL;
 
     node = xmlFirstElementChild(adaptionset_node);
@@ -1066,6 +1076,8 @@  static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
             adaptionset_baseurl_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"SegmentList")) {
             adaptionset_segmentlist_node = node;
+        } else if (!av_strcasecmp(node->name, (const char *)"SupplementalProperty")) {
+            adaptionset_supplementalproperty_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"Representation")) {
             ret = parse_manifest_representation(s, url, node,
                                                 adaptionset_node,
@@ -1076,7 +1088,8 @@  static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
                                                 fragment_template_node,
                                                 content_component_node,
                                                 adaptionset_baseurl_node,
-                                                adaptionset_segmentlist_node);
+                                                adaptionset_segmentlist_node,
+                                                adaptionset_supplementalproperty_node);
             if (ret < 0) {
                 return ret;
             }
@@ -1819,7 +1832,10 @@  static int open_demux_for_component(AVFormatContext *s, struct representation *p
 
     pls->parent = s;
     pls->cur_seq_no  = calc_cur_seg_no(s, pls);
-    pls->last_seq_no = calc_max_seg_no(pls, s->priv_data);
+
+    if (!pls->last_seq_no) {
+        pls->last_seq_no = calc_max_seg_no(pls, s->priv_data);
+    }
 
     ret = reopen_demux_for_component(s, pls);
     if (ret < 0) {