]> Some of my projects - aniplayer2.git/commitdiff
Force loading of vobsub.
authorAPTX <marek321@gmail.com>
Sun, 16 Feb 2014 13:05:29 +0000 (14:05 +0100)
committerAPTX <marek321@gmail.com>
Sun, 16 Feb 2014 13:05:29 +0000 (14:05 +0100)
aniplayer_dshow/aniplayerdshowinternal.cpp
aniplayer_dshow/aniplayerdshowinternal.h

index 5f88bccc2eca4fc31d3d34878952b00d2e3f9510..d0f301e577bcfdf83c32002bc5afde39d0b49a15 100644 (file)
@@ -20,6 +20,8 @@ void _FreeMediaType(AM_MEDIA_TYPE& mt);
 void _DeleteMediaType(AM_MEDIA_TYPE *pmt);
 
 DEFINE_GUID(MEDIATYPE_Subtitle, 0xE487EB08, 0x6B26, 0x4be9, 0x9D, 0xD3, 0x99, 0x34, 0x34, 0xD3, 0x13, 0xFD);
+DEFINE_GUID(CLSID_VSFilter, 0x9852A670, 0xF845, 0x491B, 0x9B, 0xE6, 0xEB, 0xD8, 0x41, 0xB8, 0xA6, 0x13);
+DEFINE_GUID(CLSID_VSFilter_no_autoload, 0x93A22E7A, 0x5091, 0x45EF, 0xBA, 0x61, 0x6D, 0xA2, 0x61, 0x56, 0xA5, 0xD0);
 
 AniPlayerDShowInternal::AniPlayerDShowInternal(AniPlayerDShow *player_) : player(player_)
 {
@@ -33,6 +35,8 @@ AniPlayerDShowInternal::AniPlayerDShowInternal(AniPlayerDShow *player_) : player
 
        pAudioControl = 0;
 
+       vobsub = 0;
+
        mutedVolume = -1;
 
        HRESULT hr;
@@ -296,6 +300,29 @@ HRESULT AniPlayerDShowInternal::InitializeGraph()
                goto done;
        }
 
+       IGraphConfig *pConfig = NULL;
+       {
+               HRESULT hr = pGraph->QueryInterface(IID_PPV_ARGS(&pConfig));
+               if (FAILED(hr))
+               {
+                       goto done;
+               }
+
+               hr = CoCreateInstance(CLSID_VSFilter, NULL, CLSCTX_INPROC_SERVER,
+                               IID_PPV_ARGS(&vobsub));
+               if (FAILED(hr))
+               {
+                       goto done;
+               }
+
+               hr = pConfig->AddFilterToCache(vobsub);
+               if (FAILED(hr))
+               {
+                       goto done;
+               }
+
+       }
+       SafeRelease(&pConfig);
 //     m_state = STATE_STOPPED;
 
 done:
@@ -319,6 +346,7 @@ void AniPlayerDShowInternal::TearDownGraph()
        SafeRelease(&pEvent);
        SafeRelease(&pSeeking);
        SafeRelease(&pAudioControl);
+       SafeRelease(&vobsub);
 
 //     delete m_pVideo;
 //     pVideo = NULL;
index ea8523189d648e7fe17f54d8748c5fc9d8f140b7..998349f3a22cbc9938cd647cc026d73b467deffc 100644 (file)
@@ -78,6 +78,7 @@ public:
        AniPlayerDShow *player;
 
        QList<IBaseFilter *> streamFilters;
+       IBaseFilter *vobsub;
 
        double mutedVolume;
 };