LEADTOOLS Support
Multimedia
Multimedia SDK Questions
ltmmPlay_Notify_StateChanged and ltmmPlay_State_Running
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, August 20, 2007 5:52:22 PM(UTC)
Groups: Registered
Posts: 4
Hello,
I am developing a program based on the NetClient example given in VC++ 6.0.
I need to know when the stream has been lost and then I need to write code to have it attempt to reconnect.
SO, I went to NetClient's function CChildView::OnPlayNotify(). No problem there -- I implemented this in my code no problem.
BUT now what? What does this tell me about when the stream has been dropped? I see the pattern when connecting to a remote stream:
ltmmPlay_State_Stopped, then ltmmConvert_State_Paused... then when the stream is lost back to ltmmConvert_State_Stopped.
Shouldn't I see (and this is pseudo code) a pattern of STOPPED -> PLAYING... then when stream is lost STOPPED?
Am I missing a different set of constants and messages I should be catching? :| Is there a different way of doing this? And why does ltmmPlay_State_Running only referenced when the stream actually stops? And why is that one loaded into the high part of the lParam and everything else loaded in the low? I don't see that in the help and had to look at example code to find that it was loaded into the high.
I am confused. Any help would be appreciated.
Thanks!
Rob
#2
Posted
:
Thursday, August 23, 2007 4:49:42 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
What exactly is happening when you say that the stream has been dropped? Are you saying that when the stream "drops" that the state doesn't change or that it is changing to Stopped and that's not what you'd expect?
You might also want to check the ltmmPlay_Notify_Error in addition toltmmPlay_Notify_StateChanged to make sure that no error is getting reported. It might be that when the stream is "dropped" that a DirectShow error is getting thrown rather than a state changing.
#3
Posted
:
Thursday, August 23, 2007 11:43:23 AM(UTC)
Groups: Registered
Posts: 4
GregR helped me solve this through a few e-mails! I gave him a snippet of my code that was running when WM_PLAYNOTIFY and he was able to detect the problem from there.
Something I didn't understand is that the HIWORD(lParam) gives the PREVIOUS state and LOWORD(lParam) gives the CURRENT state.
So now we have the following explorational code that works great. I can now fill in where the AfxMessageBox's are with my real code:
void CViewer::OnPlayNotify(WPARAM wParam, LPARAM lParam)
{
if(wParam == ltmmPlay_Notify_StateChanged)
{
// check the previous state running...
if(HIWORD(lParam) == ltmmPlay_State_Running)
{
AfxMessageBox("Previous state Running!");
}
// present state
if(LOWORD(lParam) == ltmmConvert_State_NotReady)
{
AfxMessageBox("Not Ready");
}
else if(LOWORD(lParam) == ltmmConvert_State_Stopped)
{
AfxMessageBox("Stopped");
}
else if(LOWORD(lParam) == ltmmPlay_State_Running)
{
AfxMessageBox("Present-State Running");
}
else if(LOWORD(lParam) == ltmmConvert_State_Paused)
{
AfxMessageBox("Paused");
}
else
{
CString whatState;
whatState.Format("Unknown state: %i", LOWORD(lParam));
AfxMessageBox(whatState);
}
}
if(wParam == ltmmPlay_Notify_Error)
{
TCHAR sz[2048];
_stprintf(sz, _T("Error 0x%.8X. Playback stopped."), lParam);
AfxMessageBox(sz);
}
} // end OnPlayNotify ()
Better yet, to detect if the stream has dropped, you could just do this:
void CViewer::OnPlayNotify(WPARAM wParam, LPARAM lParam)
{
if(wParam == ltmmPlay_Notify_StateChanged)
{
if(HIWORD(lParam) == ltmmPlay_State_Running && LOWORD(lParam) == ltmmConvert_State_Stopped)
{
AfxMessageBox("Stream Dropped!");
}
}
if(wParam == ltmmPlay_Notify_Error)
{
TCHAR sz[2048];
_stprintf(sz, _T("Error 0x%.8X. Playback stopped."), lParam);
AfxMessageBox(sz);
}
} // end OnPlayNotify ()
... And that seems to work fine so far.
Thanks Greg!
Rob
LEADTOOLS Support
Multimedia
Multimedia SDK Questions
ltmmPlay_Notify_StateChanged and ltmmPlay_State_Running
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.