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.Run() , 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::OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT
*pResult)
{   //Slider event handler
        LONGLONG lPos = 0;
        LONGLONG lDuration = 0;
        KillTimer(101);

       g_pSeek->GetDuration(&lDuration);
        g_pSeek->GetCurrentPosition(&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_AbsolutePositioning,NULL,
AM_SEEKING_NoPositioning);
        *pResult = 0;
}
void CvideoDlg::OnTimer(UINT nIDEvent)
{       //Timer event handler.
        LONGLONG lPos = 0;
        LONGLONG lDuration = 0;

    g_pSeek->GetDuration(&lDuration);
        g_pSeek->GetCurrentPosition(&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::OnTimer(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].
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to