Click here to Skip to main content
16,010,876 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalmultithreaded sockets bollocks ;) Pin
bryce30-Dec-03 17:14
bryce30-Dec-03 17:14 
GeneralRe: multithreaded sockets bollocks ;) Pin
Johnny ²30-Dec-03 22:00
Johnny ²30-Dec-03 22:00 
GeneralRe: multithreaded sockets bollocks ;) Pin
bryce31-Dec-03 11:51
bryce31-Dec-03 11:51 
GeneralRe: multithreaded sockets bollocks ;) Pin
valikac31-Dec-03 5:39
valikac31-Dec-03 5:39 
GeneralRe: multithreaded sockets bollocks ;) Pin
bryce31-Dec-03 11:56
bryce31-Dec-03 11:56 
GeneralRe: multithreaded sockets bollocks ;) Pin
valikac1-Jan-04 5:43
valikac1-Jan-04 5:43 
GeneralRe: multithreaded sockets bollocks ;) Pin
bryce5-Jan-04 0:25
bryce5-Jan-04 0:25 
GeneralQuestions about DirectShow programming Pin
youken30-Dec-03 16:58
youken30-Dec-03 16:58 
I'm programming an application that can grab a frame from a video. DirectShow can help me to realize this function. 2 days ago I found an article named Extracting Bitmaps From Movies Using DirectShow (Written by Markus Axelsson) and downloaded its source code for reference, and then some problems accured. The source code could be built successfully in the environment of VC 6.0 and DirectX 9.0b, but could not execute properly. The application could not grab a frame from a MPEG file at all. In order to find the reason, I made test. Firstly, I ran the program in another computer, and its DirectX version was the same as my own computer's. The result was failure. Then I ran the program in a computer which DirectX version was 8.1, and I found surprisedly that a frame did have been extracted successfully from the MPEG file. The following test was to run the program in the environment of DirectX 6.4. The result was still failure. So my conclusion is that the program is only compatible with DirectX 8. The following code fragment is extracted from that source code I've downloaded. Through debug, I find the sentence "pMediaControl->Run()" will be wrong in DirectX 9. The return value of the function Run() is not 0 but 1. So my questions are:
Why does the error occur?
How to resolve the error?


>> Appendix 1:
The code fragment--
// Create graph builder
CComPtr<igraphbuilder> pGraphBuilder;
HRESULT hr = ::CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER, IID_IGraphBuilder,
(void**)&pGraphBuilder);
if (FAILED(hr)) return hr;
ASSERT(pGraphBuilder != NULL);

// Create Grabber filter
CComPtr<ibasefilter> pGrabberBaseFilter;
CComPtr<isamplegrabber> pSampleGrabber;
AM_MEDIA_TYPE mt;
hr = ::CoCreateInstance(CLSID_SampleGrabber, NULL,
CLSCTX_INPROC_SERVER, IID_IBaseFilter,
(LPVOID *)&pGrabberBaseFilter);
if (FAILED(hr)) return hr;
pGrabberBaseFilter->QueryInterface(IID_ISampleGrabber,
(void**)&pSampleGrabber);
if (pSampleGrabber == NULL) return E_NOINTERFACE;
hr = pGraphBuilder->AddFilter(pGrabberBaseFilter,L"Grabber");
if (FAILED(hr)) return hr;

// Set media type
ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_RGB24;
mt.formattype = FORMAT_VideoInfo;
hr = pSampleGrabber->SetMediaType(&mt);
if (FAILED(hr)) return hr;

hr = pGraphBuilder->RenderFile(wFile,NULL);
if (FAILED(hr)) return hr;

CComPtr<imediacontrol> pMediaControl;
CComPtr<imediaevent> pMediaEventEx;
// QueryInterface for some basic interfaces
pGraphBuilder->QueryInterface(IID_IMediaControl,
(void **)&pMediaControl);
pGraphBuilder->QueryInterface(IID_IMediaEvent,
(void **)&pMediaEventEx);

if (pMediaControl == NULL || pMediaEventEx == NULL)
return E_NOINTERFACE;

// Set up one-shot mode.
hr = pSampleGrabber->SetBufferSamples(TRUE);
if (FAILED(hr)) return hr;

hr = pSampleGrabber->SetOneShot(TRUE);
if (FAILED(hr)) return hr;

CComQIPtr<imediaseeking> pSeek = pMediaControl;
if (pSeek == NULL)
return E_NOINTERFACE;
LONGLONG Duration;
hr = pSeek->GetDuration(&Duration);
if (FAILED(hr)) return hr;
int NumSecs = int(Duration/10000000);

REFERENCE_TIME rtStart = 1 * 10000000;
if (NumSecs < 1)
rtStart = 0;
REFERENCE_TIME rtStop = rtStart;

hr = pSeek->SetPositions(&rtStart, AM_SEEKING_AbsolutePositioning,
&rtStop, AM_SEEKING_AbsolutePositioning);
if (FAILED(hr)) return hr;

CComQIPtr<ivideowindow> pVideoWindow = pGraphBuilder;

hr = pVideoWindow->put_AutoShow(OAFALSE);
if (FAILED(hr)) return hr;

// Run the graph and wait for completion.
hr = pMediaControl->Run();
if (FAILED(hr)) return hr;



>> Appendix 2:
URL of the source article--
http://www.codeproject.com/audio/framegrabber.asp
QuestionCannot access the ClassView information file???? Pin
wow999930-Dec-03 15:17
wow999930-Dec-03 15:17 
AnswerRe: Cannot access the ClassView information file???? Pin
Monty230-Dec-03 16:17
Monty230-Dec-03 16:17 
GeneralRe: Cannot access the ClassView information file???? Pin
Balkrishna Talele30-Dec-03 21:51
Balkrishna Talele30-Dec-03 21:51 
AnswerRe: Cannot access the ClassView information file???? Pin
Anonymous30-Dec-03 16:18
Anonymous30-Dec-03 16:18 
QuestionHow can i get this event what the virtual address of my process be changed by the windows?? Pin
zx_sanjin30-Dec-03 14:57
zx_sanjin30-Dec-03 14:57 
QuestionHow can i get this event what the virtual address of my process be changed by the windows?? Pin
zx_sanjin30-Dec-03 14:54
zx_sanjin30-Dec-03 14:54 
QuestionHow to develop pluggable application? Pin
Anonymous30-Dec-03 14:53
Anonymous30-Dec-03 14:53 
AnswerRe: How to develop pluggable application? Pin
Monty230-Dec-03 18:47
Monty230-Dec-03 18:47 
GeneralRe: How to develop pluggable application? Pin
Anonymous31-Dec-03 3:55
Anonymous31-Dec-03 3:55 
AnswerRe: How to develop pluggable application? Pin
Roger Allen1-Jan-04 23:51
Roger Allen1-Jan-04 23:51 
GeneralWindow background subclassing Pin
mdb30-Dec-03 11:24
mdb30-Dec-03 11:24 
Generaldialog boxes Pin
HackerBoy30-Dec-03 10:45
HackerBoy30-Dec-03 10:45 
GeneralRe: dialog boxes Pin
yodlee9930-Dec-03 11:37
yodlee9930-Dec-03 11:37 
GeneralRe: dialog boxes Pin
Ravi Bhavnani30-Dec-03 11:59
professionalRavi Bhavnani30-Dec-03 11:59 
GeneralAmount of RAM on a remote machine Pin
orcun colak30-Dec-03 10:38
orcun colak30-Dec-03 10:38 
GeneralRe: Amount of RAM on a remote machine Pin
Balkrishna Talele30-Dec-03 21:45
Balkrishna Talele30-Dec-03 21:45 
Generalblt and directx Pin
ns30-Dec-03 9:33
ns30-Dec-03 9:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.