]> git.sesse.net Git - casparcg/blobdiff - modules/flash/producer/FlashAxContainer.cpp
Move most template host logging that is not interesting during day to day operation...
[casparcg] / modules / flash / producer / FlashAxContainer.cpp
index 7d7e93c8161bd853a5750b782981eaac3b2de0c3..d011cc41987caeba4d0f1537f72bf440d2ffa73e 100644 (file)
@@ -25,6 +25,7 @@
 #include "../interop/TimerHelper.h"
 
 #include <common/log.h>
+#include <common/os/general_protection_fault.h>
 
 #if defined(_MSC_VER)
 #pragma warning (push, 2) // TODO
@@ -47,7 +48,7 @@ FlashAxContainer::~FlashAxContainer()
        if(m_lpDD4)
        {
                m_lpDD4->Release();
-               m_lpDD4 = nullptr;
+               delete m_lpDD4;
        }
 
        if(pTimerHelper != 0)
@@ -453,6 +454,7 @@ DEFINE_GUID2(IID_IDirectDraw7,0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,
 /////////
 HRESULT STDMETHODCALLTYPE FlashAxContainer::QueryService( REFGUID rsid, REFIID riid, void** ppvObj) 
 {
+       ensure_gpf_handler_installed_for_thread("flash-player-thread");
 //     ATLTRACE(_T("IServiceProvider::QueryService\n"));
        //the flashcontrol asks for an interface {618F8AD4-8B7A-11D0-8FCC-00C04FD9189D}, this is IID for a DirectDraw3 object
 
@@ -600,23 +602,24 @@ void FlashAxContainer::EnterFullscreen()
 
 void STDMETHODCALLTYPE FlashAxContainer::OnFlashCall(BSTR request)
 {
+       ensure_gpf_handler_installed_for_thread("flash-player-thread");
        std::wstring str(request);
-       if(str.find(TEXT("DisplayedTemplate")) != std::wstring::npos)
+       if(str.find(L"DisplayedTemplate") != std::wstring::npos)
        {
                ATLTRACE(_T("ShockwaveFlash::DisplayedTemplate\n"));
                bReadyToRender_ = true;
        }
-       else if(str.find(TEXT("OnCommand")) != std::wstring::npos) {
+       else if(str.find(L"OnCommand") != std::wstring::npos) {
                //this is how templatehost 1.8 reports that a command has been received
                CASPAR_LOG(debug)  << print_()  << L" [command]      " << str;
                bCallSuccessful_ = true;
        }
-       else if(str.find(TEXT("Activity")) != std::wstring::npos)
+       else if(str.find(L"Activity") != std::wstring::npos)
        {
                CASPAR_LOG(debug) << print_() << L" [activity]     " << str;
 
                //this is how templatehost 1.7 reports that a command has been received
-               if(str.find(TEXT("Command recieved")) != std::wstring::npos)
+               if(str.find(L"Command recieved") != std::wstring::npos)
                        bCallSuccessful_ = true;
 
                /*if(pFlashProducer_ != 0 && pFlashProducer_->pMonitor_) {
@@ -625,7 +628,7 @@ void STDMETHODCALLTYPE FlashAxContainer::OnFlashCall(BSTR request)
                                pFlashProducer_->pMonitor_->Inform(str.substr(pos, str.find(TEXT('<'), pos)-pos));
                }*/
        }
-       else if(str.find(TEXT("OnNotify")) != std::wstring::npos)
+       else if(str.find(L"OnNotify") != std::wstring::npos)
        {
                CASPAR_LOG(info) << print_() << L" [notification] " << str;
 
@@ -635,17 +638,17 @@ void STDMETHODCALLTYPE FlashAxContainer::OnFlashCall(BSTR request)
                //              pFlashProducer_->pMonitor_->Inform(str.substr(pos, str.find(TEXT('<'), pos)-pos));
                //}
        }
-       else if(str.find(TEXT("IsEmpty")) != std::wstring::npos)
+       else if(str.find(L"IsEmpty") != std::wstring::npos)
        {
-               CASPAR_LOG(trace) << print_() << L" Empty.";
+               CASPAR_LOG(debug) << print_() << L" Empty.";
                ATLTRACE(_T("ShockwaveFlash::IsEmpty\n"));
                bIsEmpty_ = true;
        }
-       else if(str.find(TEXT("OnError")) != std::wstring::npos)
+       else if(str.find(L"OnError") != std::wstring::npos)
        {
                CASPAR_LOG(error) << print_() << L" [error]        " << str;
        }
-       else if(str.find(TEXT("OnDebug")) != std::wstring::npos)
+       else if(str.find(L"OnDebug") != std::wstring::npos)
        {
                CASPAR_LOG(debug) << print_() << L" [debug]        " << str;
        }
@@ -666,18 +669,14 @@ void STDMETHODCALLTYPE FlashAxContainer::OnFlashCall(BSTR request)
        HRESULT hr = m_spOleObject->QueryInterface(__uuidof(IShockwaveFlash), (void**) &spFlash);
        if(hr == S_OK && spFlash)
        {
-               hr = spFlash->SetReturnValue(TEXT("<null/>"));
+               hr = spFlash->SetReturnValue(L"<null/>");
        }
 }
 
 void STDMETHODCALLTYPE FlashAxContainer::OnReadyStateChange(long newState)
 {
        if(newState == 4)
-       {
                bReadyToRender_ = true;
-       }
-       else
-               bReadyToRender_ = false;
 }
 
 void FlashAxContainer::DestroyAxControl()
@@ -772,10 +771,10 @@ HRESULT FlashAxContainer::CreateAxControl()
                        HRESULT hr2 = m_spOleObject->QueryInterface(__uuidof(IShockwaveFlash), (void**) &spFlash);
                        if(hr2 == S_OK && spFlash)
                        {
-                               if(FAILED(spFlash->put_WMode(TEXT("Transparent"))))
+                               if(FAILED(spFlash->put_WMode(L"Transparent")))
                                        CASPAR_LOG(warning) << print_() << L" Failed to set flash container to transparent mode.";
                                //spFlash->put_WMode(TEXT("ogl"));
-                               hResultQuality = spFlash->put_Quality2(TEXT("Best"));
+                               hResultQuality = spFlash->put_Quality2(L"Best");
                        }
                        if(SUCCEEDED(DispEventAdvise(spFlash, &DIID__IShockwaveFlashEvents)))
                        {