]> git.sesse.net Git - vlc/commitdiff
demux: dash: return meta from manifest
authorFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 24 Dec 2014 21:31:35 +0000 (22:31 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 24 Dec 2014 21:35:26 +0000 (22:35 +0100)
modules/stream_filter/dash/dash.cpp
modules/stream_filter/dash/mpd/ProgramInformation.cpp

index b0b2c29f31aec8f93203148a049aae9e4c5b043a..8d397f7b90b535a02eaec4cfb2758025384d509d 100644 (file)
@@ -36,6 +36,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
+#include <vlc_meta.h>
 
 #include <errno.h>
 
@@ -226,6 +227,33 @@ static int  Control         (demux_t *p_demux, int i_query, va_list args)
                 var_InheritInteger(p_demux, "network-caching");
              break;
 
+        case DEMUX_GET_META:
+        {
+            if(!p_sys->p_mpd->getProgramInformation())
+                break;
+
+            vlc_meta_t *p_meta = (vlc_meta_t *) va_arg (args, vlc_meta_t*);
+            vlc_meta_t *meta = vlc_meta_New();
+            if (meta == NULL)
+                return VLC_EGENERIC;
+
+            if(!p_sys->p_mpd->getProgramInformation()->getTitle().empty())
+                vlc_meta_SetTitle(meta, p_sys->p_mpd->getProgramInformation()->getTitle().c_str());
+
+            if(!p_sys->p_mpd->getProgramInformation()->getSource().empty())
+                vlc_meta_SetPublisher(meta, p_sys->p_mpd->getProgramInformation()->getSource().c_str());
+
+            if(!p_sys->p_mpd->getProgramInformation()->getCopyright().empty())
+                vlc_meta_SetCopyright(meta, p_sys->p_mpd->getProgramInformation()->getCopyright().c_str());
+
+            if(!p_sys->p_mpd->getProgramInformation()->getMoreInformationUrl().empty())
+                vlc_meta_SetURL(meta, p_sys->p_mpd->getProgramInformation()->getMoreInformationUrl().c_str());
+
+            vlc_meta_Merge(p_meta, meta);
+            vlc_meta_Delete(meta);
+            break;
+        }
+
         default:
             return VLC_EGENERIC;
     }
index b0aa5d975359369250fac1cc058521defe4962af..5731bd9f457899a989d90e61844730128f7219f1 100644 (file)
@@ -36,8 +36,7 @@ const std::string &ProgramInformation::getSource() const
 
 void ProgramInformation::setSource(const std::string &source)
 {
-    if ( source.empty() == false )
-        this->source = source;
+    this->source = source;
 }
 
 const std::string &ProgramInformation::getCopyright() const
@@ -47,14 +46,17 @@ const std::string &ProgramInformation::getCopyright() const
 
 void ProgramInformation::setCopyright(const std::string &copyright)
 {
-    if ( copyright.empty() == false )
-        this->copyright = copyright;
+    this->copyright = copyright;
 }
 
 void ProgramInformation::setMoreInformationUrl(const std::string &url)
 {
-    if ( url.empty() == false )
-        this->moreInformationUrl = url;
+    this->moreInformationUrl = url;
+}
+
+const std::string & ProgramInformation::getMoreInformationUrl() const
+{
+    return moreInformationUrl;
 }
 
 const std::string &ProgramInformation::getTitle() const
@@ -64,6 +66,5 @@ const std::string &ProgramInformation::getTitle() const
 
 void        ProgramInformation::setTitle                (const std::string &title)
 {
-    if ( title.empty() == false )
-        this->title = title;
+    this->title = title;
 }