ask about directshow

Started by
9 comments, last by mdias 18 years, 4 months ago
I want to have "backward" and "forward" buttons but I don't know how to do...I also want to have a volume control button but I dont' know what function shuold be used. I used "directshow" library .Can you help me find out the solution for my matters? Thank you
Advertisement
You'll have to query the grapth for these 2 interfaces:
IMediaSeeking
IBasicAudio

here's an example of how you'd change the volume:
// assuming m_pGraph is a valid IGraphInterface pointerIBasicAudio* pBasicAudio;// query the graph for the IBasicAudio interfacem_pGraph->QueryInterface( IID_IBasicAudio, (void**)&pBasicAudio );// set the volumepBasicAudio->put_Volume( -2000 ); // this value ranges from -10000 (mute) to 0 (full volume)// don't forget to release your interfaces when you no longer need them, and check for returned error codes


note: I did not test this code, but it should be something like that.
Thank you very much.
But that difficult of me is "backward" and "forward" button,and volume control button.
That you is volume mute.
This IMediaSeeking interface,I don't how to do...
Help me,please.
Okay, here's an example of the backwards button:
// this is what you do when building the graphIMediaSeeking* pSeeking;m_pGraph->QueryInterface( IID_IMediaSeeking, (void**)&pSeeking );// check if the graph supports relative seeking forwards and backwardsbool bSuportsRelativeSeeking = true;DWORD dwCaps = AM_SEEKING_CanSeekForwards | AM_SEEKING_CanSeekBackwards;if( pSeeking->CheckCapabilities( &dwCaps ) != S_OK )   bSupportsRelativeSeeking = false;bool SeekRelative( int miliseconds ){   LONGLONG seek = miliseconds * 10000; // units are 100 nanosecons by default   HRESULT hr = pSeeking->SetPositions( &seek, AM_SEEKING_RelativePositioning,                                        NULL, AM_SEEKING_NoPositioning );   return SUCCEEDED(hr);}void buttonBackward(){   if( bSupportsRelativeSeeking )      SeekRelative( -3000 ); // Seek 3 seconds backwards}void buttonForward(){   if( bSupportsRelativeSeeking )      SeekRelative( 3000 ); // Seek 3 seconds forwards}

Once again I did not test that code, but it should be working.
Here's a great link that should be enough to shed some light on all your seeking doubts.
thanhk you very much.
I'm sorry Kamikaze15,but I don't understand it still not run.
here's code of me.
..............
..............
LRESULT WinProc....

case ID_BUTTON_BACKWARD:
if( bSupportsRelativeSeeking )
SeekRelative( -3000 );
break;


can you help me?

if you don't understand code of me,I will sent for you deme project of me.
English of me very bad sorry
Debug each line of your program and tell me which one is failing (returns bad error code).
Maybe your graph just doesn't support seeking...
//syntax error:"if"

if( g_pMediaSeeking->CheckCapabilities( &dwCaps ) != S_OK )
bSupportsRelativeSeeking = false;

library include:
#include <dshow.h>
#include <windows.h>
#include <stdio.h>
#include <atlbase.h>
#include <qedit.h>

have you email?,I want sent Demo project of me for you.
Thank you.
hey,no body help me?
hic hic
a question out of the topic , can i use direct show with managed Code ??? if no , with what i can replace it in Managed (C#) ?? coz the library audioVideoplayback is for simple playing of videos.

This topic is closed to new replies.

Advertisement