From b4c9b4bd2520c2eb373824f3fc99c905bd2e02d4 Mon Sep 17 00:00:00 2001 From: bossiel Date: Tue, 3 Mar 2015 00:45:57 +0000 Subject: [PATCH] Update pluginDirectShow to build under x64 --- .../internals/DSCaptureUtils.cxx | 4 +++ .../pluginDirectShow/internals/DSDisplay.cxx | 8 +++-- .../internals/DSOutputStream.cxx | 2 +- .../pluginDirectShow/internals/DSUtils.cxx | 29 ++++++++++++------- .../plugin_screencast_dshow_producer.cxx | 4 +-- .../plugin_video_dshow_consumer.cxx | 16 +++++----- .../plugin_video_dshow_producer.cxx | 6 ++-- 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSCaptureUtils.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSCaptureUtils.cxx index 1e6c4eb5..35ca420c 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSCaptureUtils.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSCaptureUtils.cxx @@ -21,8 +21,12 @@ #include #include +#if defined (_WIN32_WCE) #include #include +#else +#include +#endif #include #include diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSDisplay.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSDisplay.cxx index aa5ef42d..a5c62001 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSDisplay.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSDisplay.cxx @@ -55,7 +55,9 @@ static int __pred_find_display_by_hwnd(const tsk_list_item_t *item, const void * { if(item && item->data){ const tdshow_display_t *display = (const tdshow_display_t *)item->data; - return (display->hwnd - *((HWND*)hWnd)); + int ret = 0; + tsk_subsat_int32_ptr(display->hwnd, *((HWND*)hWnd), &ret); + return ret; } return -1; } @@ -602,7 +604,9 @@ static int tdshow_display_cmp(const tsk_object_t *_d1, const tsk_object_t *_d2) const tdshow_display_t *d2 = (const tdshow_display_t *)_d2; if(d1 && d2){ - return (d1->hwnd - d2->hwnd); + int ret = 0; + tsk_subsat_int32_ptr(d1->hwnd, d2->hwnd, &ret); + return ret; } else if(!d1 && !d2) return 0; else return -1; diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSOutputStream.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSOutputStream.cxx index b561a500..70f6b1d5 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSOutputStream.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSOutputStream.cxx @@ -220,7 +220,7 @@ inline HRESULT DSOutputStream::DrawOverLay(void *pBuffer, long lSize) #ifdef _WIN32_WCE #else - if( !TextOut( paintDC, 0, 0, OVERLAY_TEXT, _tcslen( OVERLAY_TEXT ) ) ) return E_FAIL; + if( !TextOut( paintDC, 0, 0, OVERLAY_TEXT, (int)_tcslen( OVERLAY_TEXT ) ) ) return E_FAIL; #endif CopyMemory(pBuffer, paintBuffer, lSize); diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSUtils.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSUtils.cxx index 04344f5b..9e9d25dc 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSUtils.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/internals/DSUtils.cxx @@ -17,9 +17,11 @@ */ #include "internals/DSUtils.h" +#if defined (_WIN32_WCE) #include #include -#if !defined(_WIN32_WCE) +#else +#include #include #endif @@ -199,26 +201,30 @@ HRESULT DisconnectFilters(IGraphBuilder *graphBuilder, IBaseFilter *source, IBas bool DisconnectAllFilters(IGraphBuilder *graphBuilder) { - CComPtr filterEnum = NULL; - CComPtr currentFilter = NULL; + IEnumFilters* filterEnum = NULL; + IBaseFilter* currentFilter = NULL; ULONG fetched; HRESULT hr; hr = graphBuilder->EnumFilters(&filterEnum); - if (FAILED(hr)) return false; + if (FAILED(hr)) { + SAFE_RELEASE(filterEnum); + return false; + } while(filterEnum->Next(1, ¤tFilter, &fetched) == S_OK){ hr = DisconnectFilters(graphBuilder, currentFilter, currentFilter); + SAFE_RELEASE(currentFilter); } - - filterEnum.Release(); + SAFE_RELEASE(filterEnum); + SAFE_RELEASE(currentFilter); return true; } bool RemoveAllFilters(IGraphBuilder *graphBuilder) { - CComPtr filterEnum = NULL; - CComPtr currentFilter = NULL; + IEnumFilters* filterEnum = NULL; + IBaseFilter* currentFilter = NULL; ULONG fetched; HRESULT hr; @@ -228,14 +234,15 @@ bool RemoveAllFilters(IGraphBuilder *graphBuilder) while(filterEnum->Next(1, ¤tFilter, &fetched) == S_OK){ hr = graphBuilder->RemoveFilter(currentFilter); if (FAILED(hr)){ - filterEnum.Release(); + SAFE_RELEASE(filterEnum); return false; } - currentFilter.Release(); + SAFE_RELEASE(currentFilter); filterEnum->Reset(); } - filterEnum.Release(); + SAFE_RELEASE(filterEnum); + SAFE_RELEASE(currentFilter); return true; } diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/plugin_screencast_dshow_producer.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/plugin_screencast_dshow_producer.cxx index efc99e6a..43062263 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/plugin_screencast_dshow_producer.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/plugin_screencast_dshow_producer.cxx @@ -137,7 +137,7 @@ static int plugin_screencast_dshow_producer_start(tmedia_producer_t* self) } // set parameters - producer->grabber->setCaptureParameters(TMEDIA_PRODUCER(producer)->video.width, TMEDIA_PRODUCER(producer)->video.height, TMEDIA_PRODUCER(producer)->video.fps); + producer->grabber->setCaptureParameters((int)TMEDIA_PRODUCER(producer)->video.width, (int)TMEDIA_PRODUCER(producer)->video.height, TMEDIA_PRODUCER(producer)->video.fps); // set callback function producer->grabber->setCallback(plugin_video_dshow_plugin_cb, producer); @@ -147,7 +147,7 @@ static int plugin_screencast_dshow_producer_start(tmedia_producer_t* self) if (producer->previewHwnd) { producer->grabber->preview->attach(producer->previewHwnd); } - producer->grabber->preview->setSize(TMEDIA_PRODUCER(producer)->video.width, TMEDIA_PRODUCER(producer)->video.height); + producer->grabber->preview->setSize((int)TMEDIA_PRODUCER(producer)->video.width, (int)TMEDIA_PRODUCER(producer)->video.height); } // start grabber diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_consumer.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_consumer.cxx index 1b84b078..1fe2d2cb 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_consumer.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_consumer.cxx @@ -213,9 +213,9 @@ static int plugin_video_dshow_consumer_prepare(tmedia_consumer_t* self, const tm TMEDIA_CONSUMER(pSelf)->video.display.height = TMEDIA_CONSUMER(pSelf)->video.in.height; } - pSelf->nNegFps = TMEDIA_CONSUMER(pSelf)->video.fps; - pSelf->nNegWidth = TMEDIA_CONSUMER(pSelf)->video.display.width; - pSelf->nNegHeight = TMEDIA_CONSUMER(pSelf)->video.display.height; + pSelf->nNegFps = (UINT32)TMEDIA_CONSUMER(pSelf)->video.fps; + pSelf->nNegWidth = (UINT32)TMEDIA_CONSUMER(pSelf)->video.display.width; + pSelf->nNegHeight = (UINT32)TMEDIA_CONSUMER(pSelf)->video.display.height; TSK_DEBUG_INFO("D3D9 video consumer: fps=%d, width=%d, height=%d", pSelf->nNegFps, @@ -326,8 +326,8 @@ static int plugin_video_dshow_consumer_consume(tmedia_consumer_t* self, const vo if(hWnd) { // means HWND was not set but defined now - pSelf->nNegWidth = TMEDIA_CONSUMER(pSelf)->video.in.width; - pSelf->nNegHeight = TMEDIA_CONSUMER(pSelf)->video.in.height; + pSelf->nNegWidth = (UINT32)TMEDIA_CONSUMER(pSelf)->video.in.width; + pSelf->nNegHeight = (UINT32)TMEDIA_CONSUMER(pSelf)->video.in.height; CHECK_HR(hr = CreateDeviceD3D9(hWnd, &pSelf->pDevice, &pSelf->pD3D, pSelf->d3dpp)); CHECK_HR(hr = CreateSwapChain(hWnd, pSelf->nNegWidth, pSelf->nNegHeight, pSelf->pDevice, &pSelf->pSwapChain)); @@ -341,10 +341,10 @@ static int plugin_video_dshow_consumer_consume(tmedia_consumer_t* self, const vo // Update media type SafeRelease(&pSelf->pSwapChain); - CHECK_HR(hr = CreateSwapChain(hWnd, TMEDIA_CONSUMER(pSelf)->video.in.width, TMEDIA_CONSUMER(pSelf)->video.in.height, pSelf->pDevice, &pSelf->pSwapChain)); + CHECK_HR(hr = CreateSwapChain(hWnd, (UINT32)TMEDIA_CONSUMER(pSelf)->video.in.width, (UINT32)TMEDIA_CONSUMER(pSelf)->video.in.height, pSelf->pDevice, &pSelf->pSwapChain)); - pSelf->nNegWidth = TMEDIA_CONSUMER(pSelf)->video.in.width; - pSelf->nNegHeight = TMEDIA_CONSUMER(pSelf)->video.in.height; + pSelf->nNegWidth = (UINT32)TMEDIA_CONSUMER(pSelf)->video.in.width; + pSelf->nNegHeight = (UINT32)TMEDIA_CONSUMER(pSelf)->video.in.height; // Update Destination will do noting if the window size haven't changed. // Force updating the destination rect if negotiated size change diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_producer.cxx b/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_producer.cxx index 616ca1a5..d0044ac7 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_producer.cxx +++ b/branches/2.0/doubango/plugins/pluginDirectShow/plugin_video_dshow_producer.cxx @@ -73,7 +73,7 @@ static int plugin_video_dshow_producer_set(tmedia_producer_t *self, const tmedia } } else if(param->value_type == tmedia_pvt_int32){ - if(tsk_striequals(param->key, "mute")){ + if(tsk_striequals(param->key, "mute")){ producer->mute = (TSK_TO_INT32((uint8_t*)param->value) != 0); if(producer->started){ if (producer->mute) { @@ -144,7 +144,7 @@ static int plugin_video_dshow_producer_start(tmedia_producer_t* self) producer->grabber->setCaptureDevice("Null"); // set parameters - producer->grabber->setCaptureParameters(TMEDIA_PRODUCER(producer)->video.width, TMEDIA_PRODUCER(producer)->video.height, TMEDIA_PRODUCER(producer)->video.fps); + producer->grabber->setCaptureParameters((int)TMEDIA_PRODUCER(producer)->video.width, (int)TMEDIA_PRODUCER(producer)->video.height, TMEDIA_PRODUCER(producer)->video.fps); // set callback function producer->grabber->setCallback(plugin_video_dshow_plugin_cb, producer); @@ -154,7 +154,7 @@ static int plugin_video_dshow_producer_start(tmedia_producer_t* self) if(producer->previewHwnd){ producer->grabber->preview->attach(producer->previewHwnd); } - producer->grabber->preview->setSize(TMEDIA_PRODUCER(producer)->video.width, TMEDIA_PRODUCER(producer)->video.height); + producer->grabber->preview->setSize((int)TMEDIA_PRODUCER(producer)->video.width, (int)TMEDIA_PRODUCER(producer)->video.height); } // start grabber