Hey all,
So I've written a simple video player using directshow/COM in VC++,
and I'm in the process of translating it to python. For example, when
the avi starts playing, I have a call media_control.R un() , etc.
I'm wondering how I should go about updating my gtk.Hscale widget as a
trackbar for the avi player.
In C++, I have the following callbacks that update the scrollbar and
video position with a timer.
void CvideoDlg::OnNM Releasedcapture Slider1(NMHDR *pNMHDR, LRESULT
*pResult)
{ //Slider event handler
LONGLONG lPos = 0;
LONGLONG lDuration = 0;
KillTimer(101);
g_pSeek->GetDuration(&l Duration);
g_pSeek->GetCurrentPosi tion(&lPos);
Videopos= m_slider.GetPos (); //Sets new video position to that of
the slider, which user inputs
lPos = ((long)Videopos * (lDuration/num_of_frames)) ;
g_pSeek->SetPositions(& lPos, AM_SEEKING_Abso lutePositioning ,NULL,
AM_SEEKING_NoPo sitioning);
*pResult = 0;
}
void CvideoDlg::OnTi mer(UINT nIDEvent)
{ //Timer event handler.
LONGLONG lPos = 0;
LONGLONG lDuration = 0;
g_pSeek->GetDuration(&l Duration);
g_pSeek->GetCurrentPosi tion(&lPos);
Videopos = (int)(lPos * num_of_frames/ lDuration);
m_slider.SetPos (Videopos);
if (Videopos==(int )(last_frame)) //If we get to the end of the
selection, the video pauses
pause();
else{
UpdateData(); //Updates the slider controller and position
CDialog::OnTime r(nIDEvent);}
}
I'm wondering how I would implement similar callbacks in Python for a
gtk.Hscale, and some sort of time [I'm not familiar with Pythons
timers/threading at all].
So I've written a simple video player using directshow/COM in VC++,
and I'm in the process of translating it to python. For example, when
the avi starts playing, I have a call media_control.R un() , etc.
I'm wondering how I should go about updating my gtk.Hscale widget as a
trackbar for the avi player.
In C++, I have the following callbacks that update the scrollbar and
video position with a timer.
void CvideoDlg::OnNM Releasedcapture Slider1(NMHDR *pNMHDR, LRESULT
*pResult)
{ //Slider event handler
LONGLONG lPos = 0;
LONGLONG lDuration = 0;
KillTimer(101);
g_pSeek->GetDuration(&l Duration);
g_pSeek->GetCurrentPosi tion(&lPos);
Videopos= m_slider.GetPos (); //Sets new video position to that of
the slider, which user inputs
lPos = ((long)Videopos * (lDuration/num_of_frames)) ;
g_pSeek->SetPositions(& lPos, AM_SEEKING_Abso lutePositioning ,NULL,
AM_SEEKING_NoPo sitioning);
*pResult = 0;
}
void CvideoDlg::OnTi mer(UINT nIDEvent)
{ //Timer event handler.
LONGLONG lPos = 0;
LONGLONG lDuration = 0;
g_pSeek->GetDuration(&l Duration);
g_pSeek->GetCurrentPosi tion(&lPos);
Videopos = (int)(lPos * num_of_frames/ lDuration);
m_slider.SetPos (Videopos);
if (Videopos==(int )(last_frame)) //If we get to the end of the
selection, the video pauses
pause();
else{
UpdateData(); //Updates the slider controller and position
CDialog::OnTime r(nIDEvent);}
}
I'm wondering how I would implement similar callbacks in Python for a
gtk.Hscale, and some sort of time [I'm not familiar with Pythons
timers/threading at all].
Comment