Sign in to follow this  
hardest

ask about directshow

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 pointer
IBasicAudio* pBasicAudio;

// query the graph for the IBasicAudio interface
m_pGraph->QueryInterface( IID_IBasicAudio, (void**)&pBasicAudio );

// set the volume
pBasicAudio->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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Okay, here's an example of the backwards button:

// this is what you do when building the graph
IMediaSeeking* pSeeking;
m_pGraph->QueryInterface( IID_IMediaSeeking, (void**)&pSeeking );
// check if the graph supports relative seeking forwards and backwards
bool 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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
//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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this