Author: fejj
Date: 2007-08-27 16:25:31 -0400 (Mon, 27 Aug 2007)
New Revision: 84917

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/media.cpp
   trunk/moon/src/mplayer.cpp
   trunk/moon/src/mplayer.h
Log:
2007-08-27  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * media.cpp (AdvanceFrame): Emit the MediaEndedEvent.

        * mplayer.cpp (MediaEnded): New convenience function.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-08-27 20:07:15 UTC (rev 84916)
+++ trunk/moon/src/ChangeLog    2007-08-27 20:25:31 UTC (rev 84917)
@@ -1,7 +1,14 @@
+2007-08-27  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * media.cpp (AdvanceFrame): Emit the MediaEndedEvent.
+
+       * mplayer.cpp (MediaEnded): New convenience function.
+
 2007-08-27  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
-       * shape.cpp: Remove cairo_new_path call in moon_rounded_rectangle as 
this
-       clear any path data in the context (see test-path-group.xaml)
+       * shape.cpp: Remove cairo_new_path call in moon_rounded_rectangle
+       as this clear any path data in the context (see
+       test-path-group.xaml)
 
 2007-08-27  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
@@ -12,11 +19,12 @@
 
 2007-08-27  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
-       * panel.cpp: InsideObject: only skip checking the children if the point 
is
-         not in the clipped area.
-       * uielement.h, uielement.cpp: Added InsideClip, and moved the 
corresponding
-         code from InsideObject to InsideClip.
+       * panel.cpp: InsideObject: only skip checking the children if the
+         point is not in the clipped area.
 
+       * uielement.h, uielement.cpp: Added InsideClip, and moved the
+         corresponding code from InsideObject to InsideClip.
+
 2007-08-27  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * xaml.cpp: Fix calculation for smooth quadatric bezier (T) as seen in

Modified: trunk/moon/src/media.cpp
===================================================================
--- trunk/moon/src/media.cpp    2007-08-27 20:07:15 UTC (rev 84916)
+++ trunk/moon/src/media.cpp    2007-08-27 20:25:31 UTC (rev 84917)
@@ -106,11 +106,13 @@
                position *= TIMESPANTICKS_IN_SECOND / 1000;
                media_element_set_position (this, position);
                updating = false;
+       } else if (mplayer->MediaEnded ()) {
+               // FIXME: we need to do the same for audio-only media
+               media_element_set_current_state (this, "Stopped");
+               Emit (MediaEndedEvent);
+               return false;
        }
        
-       // FIXME: need to disconnect the timeout if the video is complete
-       //        and set the CurrentState to "Stopped"?
-       
        return true;
 }
 

Modified: trunk/moon/src/mplayer.cpp
===================================================================
--- trunk/moon/src/mplayer.cpp  2007-08-27 20:07:15 UTC (rev 84916)
+++ trunk/moon/src/mplayer.cpp  2007-08-27 20:25:31 UTC (rev 84917)
@@ -492,6 +492,17 @@
        return playing && !paused;
 }
 
+bool
+MediaPlayer::MediaEnded ()
+{
+       if (audio->pcm != NULL && audio->stream_id != -1)
+               return target_pts >= audio->initial_pts + 
audio->stream->duration;
+       else if (video->stream_id != -1)
+               return target_pts >= video->initial_pts + 
video->stream->duration;
+       else
+               return true;
+}
+
 guint
 MediaPlayer::Play (GSourceFunc callback, void *user_data)
 {

Modified: trunk/moon/src/mplayer.h
===================================================================
--- trunk/moon/src/mplayer.h    2007-08-27 20:07:15 UTC (rev 84916)
+++ trunk/moon/src/mplayer.h    2007-08-27 20:25:31 UTC (rev 84917)
@@ -64,6 +64,7 @@
        void Close ();
        
        bool IsPlaying ();
+       bool MediaEnded ();
        guint Play (GSourceFunc callback, void *user_data);
        bool CanPause ();
        bool IsPaused ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to