[vlc-devel] [PATCH] dcp: Command-line option to choose a CPL
Valentin Vetter
vvetter at outlook.com
Thu Feb 6 20:46:45 CET 2014
We can now use `./vlc --cpl N ...` to choose a CPL number
---
modules/access/dcp/dcp.cpp | 7 +++++++
modules/access/dcp/dcpparser.cpp | 10 +++++++++-
modules/access/dcp/dcpparser.h | 7 +++++--
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index 36516eb..6e7eee1 100644
--- a/modules/access/dcp/dcp.cpp
+++ b/modules/access/dcp/dcp.cpp
@@ -62,6 +62,10 @@ static int Open( vlc_object_t * );
static void Close( vlc_object_t * );
/* Module descriptor */
+#define DCP_CPL_TEXT N_("CPL number.")
+#define DCP_CPL_LONGTEXT N_("Plays the media associated to"\
+ "the CPL number.")
+
vlc_module_begin()
set_shortname( N_( "DCP" ) )
add_shortcut( "dcp" )
@@ -69,6 +73,7 @@ vlc_module_begin()
set_capability( "access_demux", 0 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACCESS )
+ add_integer( "cpl_num", 0, DCP_CPL_TEXT, DCP_CPL_LONGTEXT, false )
set_callbacks( Open, Close )
vlc_module_end()
@@ -279,6 +284,8 @@ static int Open( vlc_object_t *obj )
}
p_sys->p_dcp = p_dcp;
+ p_sys->p_dcp->i_cpl_num = var_InheritInteger( p_demux, "cpl_num" );
+
/* handle the DCP directory, saving the paths for audio and video file, returning error if unsuccessful */
if( ( retval = dcpInit( p_demux ) ) )
diff --git a/modules/access/dcp/dcpparser.cpp b/modules/access/dcp/dcpparser.cpp
index 4dc1cda..cfa3bb6 100644
--- a/modules/access/dcp/dcpparser.cpp
+++ b/modules/access/dcp/dcpparser.cpp
@@ -316,8 +316,8 @@ int AssetMap::Parse ( )
/* TODO: Only one CPL managed.
* Future work needed for managing severals
*/
+ cpl = pkl->getCPL(p_dcp->i_cpl_num);
- cpl = pkl->getCPL(0);
if( cpl == NULL ) {
msg_Err(p_demux, " No CPL found");
this->CloseXml();
@@ -833,6 +833,14 @@ int PKL::FindCPLs()
return this->vec_cpl.size();
}
+CPL * PKL::getCPL(int pos)
+{
+ if( pos < 0 || this->vec_cpl.size() <= pos )
+ return NULL;
+ else
+ return this->vec_cpl[pos];
+}
+
int PKL::ParseAssetList(string p_node, int p_type) {
string node;
diff --git a/modules/access/dcp/dcpparser.h b/modules/access/dcp/dcpparser.h
index e3a6a6a..1447fb6 100644
--- a/modules/access/dcp/dcpparser.h
+++ b/modules/access/dcp/dcpparser.h
@@ -77,10 +77,13 @@ struct dcp_t
int i_video_entry; /* Picture entry point */
int i_audio_entry; /* Sound entry point */
+ int i_cpl_num; /* number of the CPL we will read */
+
dcp_t():
p_asset_list(NULL),
i_video_entry(0),
- i_audio_entry(0) {};
+ i_audio_entry(0),
+ i_cpl_num(0) {};
~dcp_t( ) {
vlc_delete_all(pkls);
@@ -265,7 +268,7 @@ public:
virtual int Parse();
int FindCPLs();
- CPL *getCPL(int pos) { return this->vec_cpl[pos]; };
+ CPL *getCPL(int pos);
private:
AssetList *asset_list;
--
1.7.9.5
More information about the vlc-devel
mailing list