I am using the following sample code for rendering a video stream directly
from the camera. I am getting an error "HRESULT: 0x0004027e (262782) " in
RenderStream API call. How do I make a work around to this problem ? I am
sure there is a way to do this.. please help. My Smartphone device is a Qtek
8310.
GetFirstCameraDriver(szCameraName);
HRESULT rslt = InitCaptureGraphBuilder(&pGraph,&pCaptureGraph);
if(rslt == S_OK)
{
CComPtr<IBaseFilter> m_pVideoCaptureFilter;
CComPtr<IPersistPropertyBag> pPropertyBag;
m_pVideoCaptureFilter.CoCreateInstance( CLSID_VideoCapture );
m_pVideoCaptureFilter.QueryInterface( &pPropertyBag );
varCamName = szCameraName;
if( varCamName.vt != VT_BSTR )
{
return E_OUTOFMEMORY;
}
PropBag.Write( L"VCapName", &varCamName );
pPropertyBag->Load( &PropBag, NULL ); // pPropertyBag.Release();rslt =
262782
pGraph->AddFilter( m_pVideoCaptureFilter, L"Video capture source" );
rslt = pCaptureGraph->RenderStream(&PIN_CATEGORY_PREVIEW,
&MEDIATYPE_Video, m_pVideoCaptureFilter, NULL, NULL);
}
Thanks in Advance
Still no success.
I have noticed in other posts that the first or the default video capture
device's name is "CAM1:" when enumerated. How come I am getting "CAP1:" ??
Also When I use CLSID_VideoRendered for "
m_pVideoCaptureFilter.CoCreateInstance( CLSID_VideoCapture ); " I am geting
"there is no source code available for the current location". Folks.. I am
lost in this directshow .. ? please show me some pointers..
Best
Try setting up the video renderer window location and running the graph, i
believe everything will work fine.
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
"Vishuonline" <Vishu...@discussions.microsoft.com> wrote in message
news:F245E10D-91C9-43D0...@microsoft.com...
Also I am in the need of a custom grabber that gives me access to the raw
image data that is being rendered live on to the screen. This I need to
perform some image processing in realtime. Is there any way of getting this
accomplished without writing a custom filter?? I am not very experienced with
DirectShow programming and COM/ActiveX. Is there any sample filter code for
the CE or Sp or PPC platforms? I tried to create a filter following your
previous responses to another post on this forum. But I am stuck in the mire
of link errors. It will be of much help if you could give me some pointers.
Best Regards,
The bulk of the code below is to handle the registration of the filter via
RegSvr. If you were to manually create the registry keys for the filter
instead of relying on com to register it for you all you would need is the
CNullRend class.
This should give you something to work with, you'll have to figure out what
base class functionality you need to override and what other interfaces your
filter needs to implement. For starters you'll most likely need to implement
some class that handles retrieving whatever information you need from the
filter and the NonDelegatingQueryInterface method on the filter in order to
retrieve the pointer to the interface to use in your application.
LIBRARIES ===
You need to link to these libraries in order to compile.
TARGETLIBS are strmiids.lib, uuid.lib, ole32.lib, mmtimer.lib, and
coredll.lib
SOURCELIBS is strmbase.lib
End LIBRARIES ====
NULLREND.def ==========
// These exports are necessary in order for com to register the filter
LIBRARY nullrend.dll
EXPORTS
DllMain PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
End NULLREND.DEF ===================
NULLREND.CPP ====================================
#include <windows.h>
#include <streams.h>
#include <initguid.h>
// this is needed for COM to register the component with RegSvr
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
STDAPI DllRegisterServer() { return AMovieDllRegisterServer2( TRUE ); }
STDAPI DllUnregisterServer() { return AMovieDllRegisterServer2( FALSE ); }
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{ return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved); }
// Define your filter guid here
DEFINE_GUID(CLSID_NullRend,
0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
// Fill in media type information below, this information is used when
registering the filter with dshow
const AMOVIESETUP_MEDIATYPE sudPinTypes =
{ &MEDIATYPE_NULL, &MEDIASUBTYPE_NULL };
const AMOVIESETUP_PIN sudPins =
{ L"Null", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, 1, &sudPinTypes };
const AMOVIESETUP_FILTER sudNULL =
{ &CLSID_NullRend, L"NullRend", MERIT_DO_NOT_USE, 1, &sudPins };
// this filter is based off of the base renderer, so it has 1 input pin and
no output pins.
// It's currently a no-op renderer which will connect to anything
(CheckMediaType always
// succeeds and DoRenderSample does nothing with the sample.
class CNullRend : public CBaseRenderer
{
public:
DECLARE_IUNKNOWN;
CNullRend(LPUNKNOWN pUnk, HRESULT *phr) :
CBaseRenderer(CLSID_NullRend, NAME("CNullRend"), pUnk, phr) {}
static CUnknown* WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr)
{ return
new CNullRend(punk, phr); }
HRESULT CheckMediaType(const CMediaType *pMT) { return S_OK; }
// This is called for each media sample received.
HRESULT DoRenderSample(IMediaSample *pMediaSample) { return S_OK; }
// this is necessary for automatic registration of the filter when doing
a regsvr32.
AMOVIESETUP_FILTER *GetSetupData() { return((AMOVIESETUP_FILTER
*)&sudNULL); }
private:
};
CFactoryTemplate g_Templates[] =
{ L"NullRend", &CLSID_NullRend, CNullRend::CreateInstance, NULL, &sudNULL };
int g_cTemplates = 1;
End NULLREND.cpp =================================
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
"Vishuonline" <Vishu...@discussions.microsoft.com> wrote in message
news:EECF9E39-D13F-4AC4...@microsoft.com...
Can you give me some pointers ?
Best,
I belive you'll end up with an RGB16 format instead of RGB8 or 24, I know
YV12 to RGB16 is a valid color conversion. The color converter doesn't
support all possible color conversions (it would be way too large to be used
on an embedded device if it did). It must support the conversion from the
camera driver format to an RGB format because the video renderer requires
that conversion to be available to render the preview window.
You could try not setting any format with IAMStreamConfig and have your
CheckMediaType fail everything, and then inspect all of the formats that are
tried. I suspect you'll find an RGB format in there.
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
"Vishuonline" <Vishu...@discussions.microsoft.com> wrote in message
news:7FB64306-CD27-4FA4...@microsoft.com...
Thanks!! Seems like my camera does not support RGB capture. Strange though,
because in the native video/camera control there is an option to capture
grayscale content.. maybe it is also using some custom transform filters for
transforming the stream received from the control. When I run though the
CheckMediaType function in the debugger, I do have a check for RGB and the
code block does gets executed(several times) when the filter connection is
happening; but the connect function always fails..!!
In anycase, I Looked into the yuv12 to RGB conversion and it is seemless, i
mean no extra cost. The video frame size I am getting is 176x144. And of the
buffer of (176x144X1.5) the first (176x144) bytes contain the information I
need!. The rest of the buffer contains hue and saturation information, that I
dont need for my processing ! I have come a long way from.. the start..
I still have 1 major/small issue, if you can add comments:
1. In my null renderer filter, I added a function to hold the pointer for a
callback funtion from my application. OK, this function does get a valid
pointer for the callback funtion and saves it; but when it comes to invoke
the callback in the DoRenderSample, it simply does not and in my debugger
window the pointer basically resolves to point to CBaseRenderer::Stop().
I had this callback working for couple of hours in the beginning. This is
the state of the app when my callback function was working. The filter is
registered and my application is built with the lib file from the filter
project. I did not have to transfer the filter dll and place it the windows
or my application's directory; even then it worked. Then I was shuffling
between some modifications in the application and the filter, and then I
started getting a message that the one of the components needed for my
application to function is not present. From this point my callback stopped
wokring. I am trying all ways to traceback my steps.. but it has been
terribly elusive. Any suggestions??
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
"Vishuonline" <Vishu...@discussions.microsoft.com> wrote in message
news:B4407804-E904-4195...@microsoft.com...
My requirement is that the custom rendering filter that I have in place,
should be able to stop the graph when it finds an "interesting" frame. (Oh,,,
btw my application is primarily performing image processing on the frames it
receives..) So to achieve this, this is what I am doing. In the Callback
function, I do the image processing and I set the return value of the
callback to indicate if the frame received was "interesting" or not. If the
frame is "interesting", then the DoRenderSample invokes the
Notify(EC_COMPLETE,0,0) call to notify the graph manager it does not want any
more frames. {Is there any more elegant way of performing this, without
worrying about frames in the queue or threads etc?}Then my Applications's
Notify function receives a graph event of the type EC_COMPLETE and in that
function I invoke iMediaControl->Stop(). My graph stops and I "Release()"
the ComPtrs of the various filters and interfaces. But I am facing an issue
when I am restarting the graph. My connect function for connecting the
videocapturefilter and the smarttee filter, fails.
Can anyone throw some light on this?
Please throw some light.
Regards,
The Zoom camera control property is an LTK required feature which is used by
the Windows Mobile camera application, have you tried zooming? If you can
get Zoom to work then all of the other properties are used done the same. If
you can get Zoom to work, but brightness/contrast/etc. do not, then this may
be a camera driver bug.
A NULL camera driver framework is provided to the OEM's for developing their
camera driver. If the OEM didn't adjust the supported properties then the
driver would claim to support something which it doesn't actually support,
the member variable containing the requested property value would be set but
never used.
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
"Vishuonline" <Vishu...@discussions.microsoft.com> wrote in message
news:070A4326-A5B5-4BE0...@microsoft.com...
LoadLibrary("MyFilter.ax") failed.GetLastError return 7e.
Although MyFilter.ax is available on the device.
What could be the reason for this behaviour? Does anybody else facing
such problem also?
I had build my own too it's working , but now I'd like to have more
info on how to reimplement this method ISampleGrabber::GetCurrentBuffer
which does not appear in the gabber sample.
How is it buffered, how to pull data using the Recieve method, is a
callback used ? well any tracks is welcome