[vlc-commits] commit: Add Clear QAM to BDA (Manol Manolov )

git at videolan.org git at videolan.org
Thu Jul 22 17:30:59 CEST 2010


vlc | branch: master | Manol Manolov <man40dev at gmail.com> | Wed Jul 21 11:51:06 2010 -0400| [39e9eba7db526f6a6518b80cae5c2a98a3605286] | committer: Jean-Baptiste Kempf 

Add Clear QAM to BDA

North America cable network.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/access/bda/bda.c        |    9 +++-
 modules/access/bda/bda.h        |    1 +
 modules/access/bda/bdadefs.h    |   35 ++++++++++++++
 modules/access/bda/bdagraph.cpp |  100 +++++++++++++++++++++++++++++++++++++++
 modules/access/bda/bdagraph.h   |    1 +
 5 files changed, 145 insertions(+), 1 deletions(-)

diff --git a/modules/access/bda/bda.c b/modules/access/bda/bda.c
index 548a14b..064f12b 100644
--- a/modules/access/bda/bda.c
+++ b/modules/access/bda/bda.c
@@ -297,7 +297,8 @@ vlc_module_begin ()
                   "dvb-s", "dvbs",        /* Satellite */
                   "dvb-c", "dvbc",        /* Cable */
                   "dvb-t", "dvbt",        /* Terrestrial */
-                  "atsc" )                /* Atsc */
+                  "atsc",                 /* Atsc */
+                  "cqam",)                /* Clear QAM */
 
     set_callbacks( Open, Close )
 vlc_module_end ()
@@ -387,6 +388,10 @@ static int Open( vlc_object_t *p_this )
     {
         i_ret = dvb_SubmitATSCTuneRequest( p_access );
     }
+    if( strncmp( p_access->psz_access, "cqam", 4 ) == 0 )
+    {
+        i_ret = dvb_SubmitCQAMTuneRequest( p_access );
+    }
     if( !strcmp( p_access->psz_access, "dvb" ) )
     {
         /* Try to auto detect */
@@ -398,6 +403,8 @@ static int Open( vlc_object_t *p_this )
             i_ret = dvb_SubmitDVBTTuneRequest( p_access );
         if( i_ret )
             i_ret = dvb_SubmitATSCTuneRequest( p_access );
+        if( i_ret )
+            i_ret = dvb_SubmitCQAMTuneRequest( p_access );
     }
 
     if( !i_ret )
diff --git a/modules/access/bda/bda.h b/modules/access/bda/bda.h
index b043f64..609cf69 100644
--- a/modules/access/bda/bda.h
+++ b/modules/access/bda/bda.h
@@ -63,6 +63,7 @@ typedef struct BDAGraph BDAGraph;
 
 void dvb_newBDAGraph( access_t* p_access );
 void dvb_deleteBDAGraph( access_t* p_access );
+int dvb_SubmitCQAMTuneRequest( access_t* p_access );
 int dvb_SubmitATSCTuneRequest( access_t* p_access );
 int dvb_SubmitDVBTTuneRequest( access_t* p_access );
 int dvb_SubmitDVBCTuneRequest( access_t* p_access );
diff --git a/modules/access/bda/bdadefs.h b/modules/access/bda/bdadefs.h
index 9df57d3..931326c 100644
--- a/modules/access/bda/bdadefs.h
+++ b/modules/access/bda/bdadefs.h
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+class IDigitalCableTuneRequest;
+class IDigitalCableLocator;
 class IATSCChannelTuneRequest;
 class IATSCLocator;
 class IBDA_DeviceControl;
@@ -391,6 +393,15 @@ public:
     virtual HRESULT __stdcall put_MinorChannel( long l_minor_channel )=0;
 };
 
+class IDigitalCableTuneRequest : public IATSCChannelTuneRequest
+{
+public:
+    virtual HRESULT __stdcall get_MajorChannel( long* pl_major_channel )=0;
+    virtual HRESULT __stdcall put_MajorChannel( long l_major_channel )=0;
+    virtual HRESULT __stdcall get_SourceID( long* pl_source_id )=0;
+    virtual HRESULT __stdcall put_SourceID( long l_source_id )=0;
+};
+
 class IDVBTuneRequest : public ITuneRequest
 {
 public:
@@ -435,6 +446,18 @@ public:
     virtual HRESULT __stdcall put_TSID( long l_tsid )=0;
 };
 
+class IATSCLocator2 : public IATSCLocator
+{
+public:
+    virtual HRESULT __stdcall get_ProgramNumber( long* pl_prog_number )=0;
+    virtual HRESULT __stdcall put_ProgramNumber( long l_prog_number )=0;
+};
+
+class IDigitalCableLocator : public IATSCLocator2
+{
+public:
+};
+
 class IDVBCLocator : public ILocator
 {
 public:
@@ -919,6 +942,18 @@ extern "C" {
 const CLSID CLSID_NetworkProvider =
     {0xB2F3A67C,0x29DA,0x4C78,{0x88,0x31,0x09,0x1E,0xD5,0x09,0xA4,0x75}};
 
+/* Win 7 - Digital Cable - North America Clear QAM */
+const CLSID CLSID_DigitalCableTuningSpace =
+    {0xD9BB4CEE,0xB87A,0x47F1,{0xAC,0xF1,0xB0,0x8D,0x9C,0x78,0x13,0xFC}};
+const CLSID CLSID_DigitalCableLocator =
+    {0x03C06416,0xD127,0x407A,{0xAB,0x4C,0xFD,0xD2,0x79,0xAB,0xBE,0x5D}};
+const CLSID CLSID_DigitalCableNetworkType =
+    {0x143827AB,0xF77B,0x498d,{0x81,0xCA,0x5A,0x00,0x7A,0xEC,0x28,0xBF}};
+const IID IID_IDigitalCableTuneRequest =
+    {0xBAD7753B,0x6B37,0x4810,{0xAE,0x57,0x3C,0xE0,0xC4,0xA9,0xE6,0xCB}};
+const IID IID_IDigitalCableLocator =
+    {0x48F66A11,0x171A,0x419A,{0x95,0x25,0xBE,0xEE,0xCD,0x51,0x58,0x4C}};
+
 extern const CLSID CLSID_ATSCLocator;
 extern const CLSID CLSID_ATSCNetworkProvider;
 extern const CLSID CLSID_ATSCTuningSpace;
diff --git a/modules/access/bda/bdagraph.cpp b/modules/access/bda/bdagraph.cpp
index f34799d..4864d22 100644
--- a/modules/access/bda/bdagraph.cpp
+++ b/modules/access/bda/bdagraph.cpp
@@ -41,6 +41,13 @@ extern "C" {
         delete p_access->p_sys->p_bda_module;
     };
 
+    int dvb_SubmitCQAMTuneRequest( access_t* p_access )
+    {
+        if( p_access->p_sys->p_bda_module )
+            return p_access->p_sys->p_bda_module->SubmitCQAMTuneRequest();
+        return VLC_EGENERIC;
+    };
+
     int dvb_SubmitATSCTuneRequest( access_t* p_access )
     {
         if( p_access->p_sys->p_bda_module )
@@ -158,6 +165,99 @@ BDAGraph::~BDAGraph()
 }
 
 /*****************************************************************************
+* Submit an Clear QAM Tune Request (US Cable Shit)
+*****************************************************************************/
+int BDAGraph::SubmitCQAMTuneRequest()
+{
+    HRESULT hr = S_OK;
+    class localComPtr
+    {
+        public:
+        IDigitalCableTuneRequest* p_cqam_tune_request;
+        IDigitalCableLocator* p_cqam_locator;
+        localComPtr(): p_cqam_tune_request(NULL), p_cqam_locator(NULL) {};
+        ~localComPtr()
+        {
+            if( p_cqam_tune_request )
+                p_cqam_tune_request->Release();
+            if( p_cqam_locator )
+                p_cqam_locator->Release();
+        }
+    } l;
+    long l_minor_channel, l_physical_channel, l_frequency;
+
+    l_physical_channel = var_GetInteger( p_access, "dvb-physical-channel" );
+    l_minor_channel    = var_GetInteger( p_access, "dvb-minor-channel" );
+    l_frequency        = var_GetInteger( p_access, "dvb-frequency" );
+
+    guid_network_type = CLSID_DigitalCableNetworkType;
+    hr = CreateTuneRequest();
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "SubmitCQAMTuneRequest: "\
+            "Cannot create Tuning Space: hr=0x%8lx", hr );
+        return VLC_EGENERIC;
+    }
+
+    hr = p_tune_request->QueryInterface( IID_IDigitalCableTuneRequest,
+        (void**)&l.p_cqam_tune_request );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "SubmitCQAMTuneRequest: "\
+            "Cannot QI for IDigitalCableTuneRequest: hr=0x%8lx", hr );
+        return VLC_EGENERIC;
+    }
+    hr = ::CoCreateInstance( CLSID_DigitalCableLocator, 0, CLSCTX_INPROC,
+                             IID_IDigitalCableLocator, (void**)&l.p_cqam_locator );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "SubmitCQAMTuneRequest: "\
+            "Cannot create the CQAM locator: hr=0x%8lx", hr );
+        return VLC_EGENERIC;
+    }
+
+    hr = S_OK;
+    if( SUCCEEDED( hr ) && l_physical_channel > 0 )
+        hr = l.p_cqam_locator->put_PhysicalChannel( l_physical_channel );
+    if( SUCCEEDED( hr ) && l_frequency > 0 )
+        hr = l.p_cqam_locator->put_CarrierFrequency( l_frequency );
+    if( SUCCEEDED( hr ) && l_minor_channel > 0 )
+        hr = l.p_cqam_tune_request->put_MinorChannel( l_minor_channel );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "SubmitCQAMTuneRequest: "\
+            "Cannot set tuning parameters: hr=0x%8lx", hr );
+        return VLC_EGENERIC;
+    }
+
+    hr = p_tune_request->put_Locator( l.p_cqam_locator );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "SubmitCQAMTuneRequest: "\
+            "Cannot put the locator: hr=0x%8lx", hr );
+        return VLC_EGENERIC;
+    }
+
+    /* Build and Run the Graph. If a Tuner device is in use the graph will
+     * fail to run. Repeated calls to build will check successive tuner
+     * devices */
+    do
+    {
+        hr = Build();
+        if( FAILED( hr ) )
+        {
+            msg_Warn( p_access, "SubmitCQAMTuneRequest: "\
+                "Cannot Build the Graph: hr=0x%8lx", hr );
+            return VLC_EGENERIC;
+        }
+        hr = Start();
+    }
+    while( hr != S_OK );
+
+    return VLC_SUCCESS;
+}
+
+/*****************************************************************************
 * Submit an ATSC Tune Request
 *****************************************************************************/
 int BDAGraph::SubmitATSCTuneRequest()
diff --git a/modules/access/bda/bdagraph.h b/modules/access/bda/bdagraph.h
index d6c7e2f..3b1b50d 100644
--- a/modules/access/bda/bdagraph.h
+++ b/modules/access/bda/bdagraph.h
@@ -78,6 +78,7 @@ public:
     virtual ~BDAGraph();
 
     /* */
+    int SubmitCQAMTuneRequest();
     int SubmitATSCTuneRequest();
     int SubmitDVBTTuneRequest();
     int SubmitDVBCTuneRequest();



More information about the vlc-commits mailing list