[vlc-commits] demux: dash: return meta from manifest

Francois Cartegnie git at videolan.org
Wed Dec 24 22:38:14 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 24 22:31:35 2014 +0100| [5e3944b44e735a207d975d079d4dd5f1d4cf1a3b] | committer: Francois Cartegnie

demux: dash: return meta from manifest

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e3944b44e735a207d975d079d4dd5f1d4cf1a3b
---

 modules/stream_filter/dash/dash.cpp                |   28 ++++++++++++++++++++
 .../stream_filter/dash/mpd/ProgramInformation.cpp  |   17 ++++++------
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
index b0b2c29..8d397f7 100644
--- a/modules/stream_filter/dash/dash.cpp
+++ b/modules/stream_filter/dash/dash.cpp
@@ -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;
     }
diff --git a/modules/stream_filter/dash/mpd/ProgramInformation.cpp b/modules/stream_filter/dash/mpd/ProgramInformation.cpp
index b0aa5d9..5731bd9 100644
--- a/modules/stream_filter/dash/mpd/ProgramInformation.cpp
+++ b/modules/stream_filter/dash/mpd/ProgramInformation.cpp
@@ -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;
 }



More information about the vlc-commits mailing list