Author |
Topic: Using Directshow through COM (Read 833 times) |
|
kgoodyer
New Member
member is offline


Posts: 5
|
 |
Using Directshow through COM
« Thread started on: Nov 26th, 2013, 9:48pm » |
|
I hope Richard or somebody could help me understand a couple of issues with accessing Directshow. I will use Richards example for playing a media file.
Code: REM Create a media control object
IID_IMediaControl% = FNguid("{56a868b1-0ad4-11ce-b03a-0020af0ba770}")
SYS !(!m_graphBuilder%), m_graphBuilder%, IID_IMediaControl%, ^m_mediaControl% TO hr%
IF hr% THEN ERROR 100, "Could not instantiate media control object"
:
I'm a little unsure about the ^m_mediaControl% I understand this is effectively a pointer to m_mediaControl% where is m_mediaControl% declared or created?
The second issue is how did you figure out the indexing into these structures, for example the +44 in this segment of your code.
Code: REM Create a Filter Graph (mediafile$ = Full qualified Path to media file)
SYS !(!m_mediaControl%+44), m_mediaControl%, FNwide(mediafile$), 0 TO hr%
IF hr% THEN ERROR 100, "Could not render file "+mediafile$
:
I have searched the web and cant find any info, are they hidden dark inside a Microsoft c++ header file?
I am actually on a mission here, to prove to my work colleagues that basic, especially BBC basic is not a dead language.
Many Thanks in Advance
Keith
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Using Directshow through COM
« Reply #1 on: Nov 27th, 2013, 12:40am » |
|
on Nov 26th, 2013, 9:48pm, kgoodyer wrote:where is m_mediaControl% declared or created? |
|
If the variable has already been declared, the ^ operator will return a pointer to it. If not, the ^ operator creates the variable.
Quote:The second issue is how did you figure out the indexing into these structures, for example the +44 in this segment of your code... I have searched the web and cant find any info, are they hidden dark inside a Microsoft c++ header file? |
|
They're in a header file, yes. You may want to install the relevant Microsoft SDK on your PC so you can search the header files easily. I've often thought about writing a little utility to convert the object declarations to BBC code automatically, but that's as far as it's ever got.
Using a constant like 44 saves some code, but I would encourage you to use the technique described on the Wiki here because it's more elegant:
http://bb4w.wikispaces.com/Calling+object+methods+using+structures
If you transfer the list of methods (in the correct order!) from the header file to the structure declaration all the offsets will be worked out automatically rather than requiring 'magic constants'.
Richard.
|
|
Logged
|
|
|
|
kgoodyer
New Member
member is offline


Posts: 5
|
 |
Re: Using Directshow through COM
« Reply #2 on: Nov 27th, 2013, 8:28pm » |
|
Thanks Richard, that a real help. I did manage to find the Media control and Event header files, and figure it all out. Going to spend the evening putting some structured procedures around them.
Keith
|
|
Logged
|
|
|
|
|