Update pluginDirectShow to build under x64

This commit is contained in:
bossiel 2015-03-03 00:45:57 +00:00
parent 24e1eba626
commit b4c9b4bd25
7 changed files with 42 additions and 27 deletions

View File

@ -21,8 +21,12 @@
#include <uuids.h>
#include <mtype.h>
#if defined (_WIN32_WCE)
#include <atlbase.h>
#include <atlstr.h>
#else
#include <atlconv.h>
#endif
#include <iostream>
#include <assert.h>

View File

@ -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;

View File

@ -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);

View File

@ -17,9 +17,11 @@
*/
#include "internals/DSUtils.h"
#if defined (_WIN32_WCE)
#include <atlbase.h>
#include <atlstr.h>
#if !defined(_WIN32_WCE)
#else
#include <atlconv.h>
#include <d3d9.h>
#endif
@ -199,26 +201,30 @@ HRESULT DisconnectFilters(IGraphBuilder *graphBuilder, IBaseFilter *source, IBas
bool DisconnectAllFilters(IGraphBuilder *graphBuilder)
{
CComPtr<IEnumFilters> filterEnum = NULL;
CComPtr<IBaseFilter> 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, &currentFilter, &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<IEnumFilters> filterEnum = NULL;
CComPtr<IBaseFilter> currentFilter = NULL;
IEnumFilters* filterEnum = NULL;
IBaseFilter* currentFilter = NULL;
ULONG fetched;
HRESULT hr;
@ -228,14 +234,15 @@ bool RemoveAllFilters(IGraphBuilder *graphBuilder)
while(filterEnum->Next(1, &currentFilter, &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;
}

View File

@ -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

View File

@ -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

View File

@ -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