|
LITTLEBLACKDOG.COM
|
| Author |
Message |
hohlecow
Tail-Wagger


Joined: 17 May 2002 Posts: 2151
Location: hungary for turkey and chile
|
Posted:
Tue Apr 08, 2003 5:49 am Post subject: DirectShow Linking Error |
|
I'm working on a DirectShow render filter and i'm getting a linking error:
unresolved external symbol "public: virtual unsigned long __stdcall CBaseFilter::NonDelegatingRelease(void)" (?NonDelegatingRelease@CBaseFilter@@UAGKXZ)
using visual studio .net. i have strmbase.lib included properly in the project, and have sreams.h included in my render filter header file. The sample app from the DirectX 8 SDK compiles fine with no linking errors of this kind, and i've been careful to make sure my project has the same include directories and the libraries that i need.
BTW - if the DirectShow examples are any sign of how MS writes code, it's a wonder they have anything that works. It seems real convolotuded and hard to follow, especially for example apps. |
_________________ give as much as you can, and take nothing
sometimes i think if zombies were attacking us, liberals would be fighting for thier rights, "they eat brains for fuel, it's part of who they are" or "we can't descriminate against them, that's just the way they were reanimated."
trying it again: POTD (picture of the day)
|
|
|
|
|
Lycander
Lead Dog


Joined: 24 May 2002 Age: 25 Posts: 12198
Location: The Constitution State
|
Posted:
Tue Apr 08, 2003 6:29 am Post subject: |
|
I did a search and found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedshow/htm/_cxconsettingupbuildenvironment.asp
But before that I found:
Quote:
DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.
"See Setting Up the Build Environment for more information" is the first link above. Good luck to ya. |
_________________ To the top of hunger mountain
I found my solitary ways
Where I could live on nuts and honey
And take my shelter in a cave
|
|
|
|
|
hohlecow
Tail-Wagger


Joined: 17 May 2002 Posts: 2151
Location: hungary for turkey and chile
|
Posted:
Tue Apr 08, 2003 6:52 am Post subject: |
|
sweet, i'll try that out when i get a chance, thanks! |
_________________ give as much as you can, and take nothing
sometimes i think if zombies were attacking us, liberals would be fighting for thier rights, "they eat brains for fuel, it's part of who they are" or "we can't descriminate against them, that's just the way they were reanimated."
trying it again: POTD (picture of the day)
|
|
|
|
|
brotherhobbes
Butt Sniffer

Joined: 06 May 2002 Posts: 1579
|
Posted:
Tue Apr 08, 2003 9:59 am Post subject: |
|
i'm looking at a directshow class i wrote awhile back and i didn't even have sreams.h included, i used dshow.h. for the lib i used strmiids.lib like:
#pragma comment (lib, "strmiids")
but you know what, this could be dx7. it's been so long i can't even remember. i know dx9 was in beta at the time and dx8 was out, but i'm not sure if i used it. |
|
|
|
|
|
|
brotherhobbes
Butt Sniffer

Joined: 06 May 2002 Posts: 1579
|
Posted:
Tue Apr 08, 2003 10:10 am Post subject: |
|
|
|
|
|
Lycander
Lead Dog


Joined: 24 May 2002 Age: 25 Posts: 12198
Location: The Constitution State
|
Posted:
Tue Apr 08, 2003 11:06 am Post subject: |
|
DOH! Didn't occur to me to check the platform. Nice catch brohobbes.
I'm a WinCE programmer, so I'm use to seeing it I take it as default.
Programming for PocketPC is a lot like programming for desktop Windows. |
_________________ To the top of hunger mountain
I found my solitary ways
Where I could live on nuts and honey
And take my shelter in a cave
|
|
|
|
|
brotherhobbes
Butt Sniffer

Joined: 06 May 2002 Posts: 1579
|
Posted:
Tue Apr 08, 2003 11:15 am Post subject: |
|
Lycander wrote:DOH! Didn't occur to me to check the platform. Nice catch brohobbes.
I'm a WinCE programmer, so I'm use to seeing it I take it as default.
Programming for PocketPC is a lot like programming for desktop Windows.
would it work on a desktop, too? if so it wouldn't matter then, i don't know anything about that. |
|
|
|
|
|
|
Lycander
Lead Dog


Joined: 24 May 2002 Age: 25 Posts: 12198
Location: The Constitution State
|
Posted:
Tue Apr 08, 2003 11:59 am Post subject: |
|
We'll wait and see what he can come up with. |
_________________ To the top of hunger mountain
I found my solitary ways
Where I could live on nuts and honey
And take my shelter in a cave
|
|
|
|
|
hohlecow
Tail-Wagger


Joined: 17 May 2002 Posts: 2151
Location: hungary for turkey and chile
|
Posted:
Tue Apr 08, 2003 1:54 pm Post subject: |
|
Here's the latest news on my linking problem, i did the pragma comment
to include the library.
now i'm having a problem with an unhandled exception... more on that when i know more. |
_________________ give as much as you can, and take nothing
sometimes i think if zombies were attacking us, liberals would be fighting for thier rights, "they eat brains for fuel, it's part of who they are" or "we can't descriminate against them, that's just the way they were reanimated."
trying it again: POTD (picture of the day)
|
|
|
|
|
hohlecow
Tail-Wagger


Joined: 17 May 2002 Posts: 2151
Location: hungary for turkey and chile
|
Posted:
Tue Apr 08, 2003 2:04 pm Post subject: |
|
brotherhobbes wrote:
if you want hohlecow, i'd be happy to post the code i wrote. it works fine for playing an intro .avi movie with divx compression for this game demo i did like a year ago.
what did you use to compile it? code would be helpful, workspace too if you have it.
i don't have any problems getting a DirectShow filter graph playing, its the render filter that's the big problem, and also the most important part. have you written any filters for DirectShow? |
_________________ give as much as you can, and take nothing
sometimes i think if zombies were attacking us, liberals would be fighting for thier rights, "they eat brains for fuel, it's part of who they are" or "we can't descriminate against them, that's just the way they were reanimated."
trying it again: POTD (picture of the day)
|
|
|
|
|
brotherhobbes
Butt Sniffer

Joined: 06 May 2002 Posts: 1579
|
Posted:
Tue Apr 08, 2003 2:18 pm Post subject: |
|
hohlecow wrote:brotherhobbes wrote:
if you want hohlecow, i'd be happy to post the code i wrote. it works fine for playing an intro .avi movie with divx compression for this game demo i did like a year ago.
what did you use to compile it? code would be helpful, workspace too if you have it.
i don't have any problems getting a DirectShow filter graph playing, its the render filter that's the big problem, and also the most important part. have you written any filters for DirectShow?
i used vs c++ 6
i'm sorry, i don't mean to be slow, but i'm not sure what the terms mean. i wrote something that let me play a movie at the demo intro. looking over the code i used the "IGraphBuilder," so i guess it's just a filter graph? you still want it?
you are welcome to all of it, if it's still what you are looking for, but the workspace isn't just for the dshow stuff. it's the entire demo. |
|
|
|
|
|
|
Lycander
Lead Dog


Joined: 24 May 2002 Age: 25 Posts: 12198
Location: The Constitution State
|
Posted:
Tue Apr 08, 2003 3:06 pm Post subject: |
|
hohlecow wrote:Here's the latest news on my linking problem, i did the pragma comment
to include the library.
now i'm having a problem with an unhandled exception... more on that when i know more.
Unhandled exception at runtime or during compile?
If at runtime, I'm betting it's an access violation (null pointer). Double check to make sure you initialize objects before using them, and that they actually suceed in initializing. |
_________________ To the top of hunger mountain
I found my solitary ways
Where I could live on nuts and honey
And take my shelter in a cave
|
|
|
|
|
hohlecow
Tail-Wagger


Joined: 17 May 2002 Posts: 2151
Location: hungary for turkey and chile
|
Posted:
Tue Apr 08, 2003 5:27 pm Post subject: |
|
it's at run time. i'd agree with a null pointer, but i can't seem to find it. I'm initializing everything that i use. here's where things are currently crashing:
g_pGrab = new CSampleGrabber(NULL, &hr, FALSE);
g_pGrab->AddRef();
g_pGraphBuilder->AddFilter(g_pGrab, L"Texture Renderer");
/* CRASHSSHSHSHHS!!! */
i'd think that if g_pGrab wasn't properly initialized it would crash at AddRef(), but it makes it past that. CSampleGrabber is one of the sample classes included with the SDK. since my classes kept crashing at run time, i figured i'd give one of theirs a try, but it does exactly the same thing.
for Brother Hobbes, DirectShow uses filters all connected together in what's called a filter graph. you have an input filter, a decoder filter, possibly a transform filter and an output filter. You can have any number of outputs from a filter, but i think only one input. You can put together a filter graph pretty easily if you just want to play a video, but if you want to actually get at the data, things get a little tricky. and that's why i have come to you guys.
i'd still love to see you're code. i'm learning more and more about directshow and com the more i look at things. |
_________________ give as much as you can, and take nothing
sometimes i think if zombies were attacking us, liberals would be fighting for thier rights, "they eat brains for fuel, it's part of who they are" or "we can't descriminate against them, that's just the way they were reanimated."
trying it again: POTD (picture of the day)
|
|
|
|
|
brotherhobbes
Butt Sniffer

Joined: 06 May 2002 Posts: 1579
|
Posted:
Tue Apr 08, 2003 11:33 pm Post subject: |
|
the h
//////////////////////////////////////////////////////////////////////
// File: "PimpFlicks.h"
//
// Related Header Files: "dshow.h"
//
// Original Author: Joshua Brown -> brotherhobbes@hotmail.com
//
// Creation Date: May 14, 2002
//
// Purposes: member variable declaration and function prototyping for
// a DirectShow class allowing movie playing
//////////////////////////////////////////////////////////////////////
#ifndef _PIMPFLICKS_H_
#define _PIMPFLICKS_H_
#ifndef _WIN32_DCOM
#define _WIN32_DCOM
#endif
#include "dshow.h"
#include "Variables.h"
#include <string>
using std::string;
#include <objbase.h>
// WindowProc Message for DShow Events.
#define WM_GRAPHNOTIFY WM_APP + 1
class PimpFlicks
{
private:
IGraphBuilder *m_pGraphBuilder; // Makes the Filter Graph.
IMediaControl *m_pMediaControl; // VCR style control of the Movie.
IMediaEventEx *m_pMediaEvent; // Handles the Movie Events.
IVideoWindow *m_pVideoWindow; // The Window the Movie will play in.
IBasicAudio *m_pBasicAudio; // Set the Panning and Volume.
// holds handle to the window video is played in
HWND m_hWnd;
// how many movie files there are
int m_iNumFiles;
// filenames of movies
enum { MAX_MOVIES = 10, };
string m_strFileNames[MAX_MOVIES];
public:
PimpFlicks(void);
~PimpFlicks(void);
void ShutDown(void);
void Init(HWND h, const char *strFileName = "flicks.cfg");
void Load(const char *strFileName = "flicks.cfg");
void Play(int fileNum, int top = 0, int left = 0, int right = Variables::ScreenWidth(),
int bottom = Variables::ScreenHeight(), int volume = 100, int balance = 0);
void Play(int fileNum, RECT rect, int volume = 100, int balance = 0);
bool hasFinished(void);
};
#endif
|
|
|
|
|
|
|
brotherhobbes
Butt Sniffer

Joined: 06 May 2002 Posts: 1579
|
Posted:
Tue Apr 08, 2003 11:34 pm Post subject: |
|
the cpp
//////////////////////////////////////////////////////////////////////
// File: "PimpFlicks.cpp"
//
// Related Header Files: "PimpFlicks.h"
//
// Original Author: Joshua Brown -> brotherhobbes@hotmail.com
//
// Creation Date: May 14, 2002
//
// Purposes: handles direct show video displaying
//////////////////////////////////////////////////////////////////////
#include "PimpFlicks.h"
#include "Error.h"
#include <fstream>
using namespace std;
// link dshow required lib
#pragma comment (lib, "strmiids")
// macro love
#define MULTI_TO_WIDE(x, y) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, x, -1, y, _MAX_PATH)
#define WIDE_TO_MULTI(x, y) WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, x, -1, y, 0, NULL, NULL)
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p) = NULL; } }
//////////////////////////////////////////////////////////////////////
// Function: Constructor
//
// Last Modified: May 15, 2002
//
// Purposes: set all pointers to NULL and initalize variables used
//////////////////////////////////////////////////////////////////////
PimpFlicks::PimpFlicks(void)
{
m_pGraphBuilder = NULL;
m_pMediaControl = NULL;
m_pMediaEvent = NULL;
m_pVideoWindow = NULL;
m_pBasicAudio = NULL;
}
//////////////////////////////////////////////////////////////////////
// Function: Destructor
//
// Last Modified: May 16, 2002
//
// Purposes: chunks COM, NULL pointers, and releases
//////////////////////////////////////////////////////////////////////
PimpFlicks::~PimpFlicks(void)
{
ShutDown();
CoUninitialize();
}
//////////////////////////////////////////////////////////////////////
// Function: "ShutDown"
//
// Last Modified: May 16, 2002
//
// Purposes: set all pointers to NULL and releases
//////////////////////////////////////////////////////////////////////
void PimpFlicks::ShutDown(void)
{
if (m_pMediaControl)
m_pMediaControl->Stop();
SAFE_RELEASE(m_pMediaControl);
SAFE_RELEASE(m_pBasicAudio);
if (m_pMediaEvent)
m_pMediaEvent->SetNotifyWindow(NULL, 0, 0);
SAFE_RELEASE(m_pMediaEvent);
if (m_pVideoWindow)
{
//m_pVideoWindow->put_Visible(OAFALSE);
//m_pVideoWindow->put_Owner(NULL);
}
SAFE_RELEASE(m_pVideoWindow);
SAFE_RELEASE(m_pGraphBuilder);
return;
}
//////////////////////////////////////////////////////////////////////
// File: "Init"
//
// Last Modified: May 16, 2002
//
// In: h handle to window video is going to be played in
// strFileName name of movie config file to open
//
// Return: S_OK if successful
//
// Purposes: assign variables needed to play videos
//////////////////////////////////////////////////////////////////////
void PimpFlicks::Init(HWND h, const char *strFileName)
{
// holds handle to result
HRESULT result;
// Initialize the COM Libraries.
if (FAILED(result = CoInitializeEx(NULL, COINIT_MULTITHREADED)))
throw Error("PimpFlicks::Init()", "CoInitialize()", result);
// Create the Filter Graph Manager.
if (FAILED(result = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder,
(void **)&m_pGraphBuilder)))
throw Error("PimpFlicks::Init()", "CoCreateInstance()", result);
// Query for the Video Window Interface.
if (FAILED(result = m_pGraphBuilder->QueryInterface(IID_IVideoWindow, (void **)&m_pVideoWindow)))
throw Error("PimpFlicks::Init()", "m_pGraphBuilder->QueryInterface(m_pVideoWindow)", result);
// Query for the Event Handler
if (FAILED(result = m_pGraphBuilder->QueryInterface(IID_IMediaEventEx, (void **)&m_pMediaEvent)))
throw Error("PimpFlicks::Init()", "m_pGraphBuilder->QueryInterface(m_pMediaEvent)", result);
// Query for the Basic Audio Interface.
if (FAILED(result = m_pGraphBuilder->QueryInterface(IID_IBasicAudio, (void **)&m_pBasicAudio)))
throw Error("PimpFlicks::Init()", "m_pGraphBuilder->QueryInterface(m_pBasicAudio)", result);
// Query for the Media Control.
if (FAILED(result = m_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&m_pMediaControl)))
throw Error("PimpFlicks::Init()", "m_pGraphBuilder->QueryInterface(m_pMediaControl)", result);
// set window handle
m_hWnd = h;
// load the filenames
Load(strFileName);
return;
}
//////////////////////////////////////////////////////////////////////
// Function: "Load"
//
// Last Modified: May 16, 2002
//
// In: strFileName name of movie config file to open
//
// Purposes: opens movie config file and gets filenames
//////////////////////////////////////////////////////////////////////
void PimpFlicks::Load(const char *strFileName)
{
ifstream fin;
char chBuffer[256] = { 0, };
fin.open(strFileName);
if(fin.fail())
throw Error("PimpFlicks::Load()", "Can't find file", strFileName);
// number of movies
fin >> m_iNumFiles;
// file names
for(int i = 0; i < m_iNumFiles; i++)
{
fin >> chBuffer;
m_strFileNames[i] = TEXT(chBuffer);
}
fin.close();
return;
}
//////////////////////////////////////////////////////////////////////
// Function: "Play"
//
// Last Modified: May 16, 2002
//
// In: name name of file to play
// top x coord to place video
// left y coord to place video
// right desired width of video
// bottom desired height of video
// volume how loud video plays at (0 -> 100, 0 being silence)
// balance panning of video (-100 -> 100, 0 being no panning)
//
// Return: S_OK if successful
//
// Purposes: plays video file at (top,left) coordinates with a width of
// right and a height of bottom
//////////////////////////////////////////////////////////////////////
void PimpFlicks::Play(int fileNum, int top, int left, int right, int bottom, int volume, int balance)
{
// file name error checking
if (fileNum < 0)
fileNum = 0;
if (fileNum >= m_iNumFiles)
fileNum = m_iNumFiles - 1;
// convert file name to wide character format
WCHAR nameAsWideChar[_MAX_PATH];
MULTI_TO_WIDE(m_strFileNames[fileNum].c_str(), nameAsWideChar);
// holds handle to result
HRESULT result;
// Make the Filter Graph.
if (FAILED(result = m_pGraphBuilder->RenderFile(nameAsWideChar, NULL)))
throw Error("PimpFlicks::Play()", "m_pGraphBuilder->RenderFile()", result);
// Specify owner of the Video Window.
if (FAILED(result = m_pVideoWindow->put_Owner((OAHWND)m_hWnd)))
throw Error("PimpFlicks::Play()", "m_pVideoWindow->put_Owner()", result);
// The Window Styles
if (FAILED(result = m_pVideoWindow->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS)))
throw Error("PimpFlicks::Play()", "m_pVideoWindow->put_WindowStyle()", result);
// Make the Video Take up desired screen size
if (FAILED(result = m_pVideoWindow->SetWindowPosition(top, left, right, bottom)))
throw Error("PimpFlicks::Play()", "m_pVideoWindow->SetWindowPosition()", result);
// Set the Window to get the Event Messages.
if (FAILED(result = m_pMediaEvent->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
throw Error("PimpFlicks::Play()", "m_pMediaEvent->SetNotifyWindow()", result);
// convert 0 -> 100 PimpFlicks volume scale to dshow style
if (volume > 100 || volume < 0)
volume = 100;
volume = (volume * 100) - 10000;
if (FAILED(result = m_pBasicAudio->put_Volume(volume)))
throw Error("PimpFlicks::Play()", "m_pBasicAudio->put_Volume()", result);
// convert 0 -> 100 PimpFlicks balance scale to dshow style
if (balance > 100 || balance < -100)
balance = 0;
balance *= 100;
if (FAILED(result = m_pBasicAudio->put_Balance(balance)))
throw Error("PimpFlicks::Play()", "m_pBasicAudio->put_Balance()", result);
// Play the File.
if (FAILED(result = m_pMediaControl->Run()))
throw Error("PimpFlicks::Play()", "m_pMediaControl->Run()", result);
return;
}
//////////////////////////////////////////////////////////////////////
// Function: "Play"
//
// Last Modified: May 16, 2002
//
// In: fileNum number of file to play
// rect dimensions of video to be played on the screen
// volume how loud video plays at (0 -> 100, 0 being silence)
// balance panning of video (-100 -> 100, 0 being no panning)
//
// Return: S_OK if successful
//
// Purposes: plays video file at (rect.top,rect.left) coordinates with
// a width of rect.right and a height of rect.bottom
//////////////////////////////////////////////////////////////////////
void PimpFlicks::Play(int fileNum, RECT rect, int volume, int balance)
{
// pass rect to original Play function
Play(fileNum, rect.top, rect.left, rect.right, rect.bottom, volume, balance);
return;
}
//////////////////////////////////////////////////////////////////////
// Function: "hasFinished"
//
// Last Modified: May 16, 2002
//
// Return: true if entire video has been played
//
// Purposes: checks for end of video
//////////////////////////////////////////////////////////////////////
bool PimpFlicks::hasFinished(void)
{
long evCode, param1, param2; // Parameters to be set on Certain Messages.
HRESULT result; // For Error Tracking.
if (!m_pMediaEvent)
return false;
// Call GetEvent until it returns a failure code, indicating that the queue is empty.
while (result = m_pMediaEvent->GetEvent(&evCode, ¶m1, ¶m2, 0), SUCCEEDED(result))
{
result = m_pMediaEvent->FreeEventParams(evCode, param1, param2);
// Check to see if the Movie has finished Playing.
if (evCode == EC_COMPLETE)
return true;
}
// Movie is not done playing.
return false;
}
|
|
|
|
|
|
|
|
|
| Goto page 1, 2 Next
|
View next topic
View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB
© 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours
Help us keep advertisements off this site. Donate today!
|
|