+static void on_playlist_next( mlt_properties owner, void *object, int i );
+
+class PlaylistNextListener : RubyListener
+{
+ private:
+ Mlt::Event *event;
+
+ public:
+ PlaylistNextListener( Mlt::Properties *properties, VALUE proc )
+ : RubyListener( proc )
+ {
+ event = properties->listen( "playlist-next", this, ( mlt_listener )on_playlist_next );
+ }
+
+ ~PlaylistNextListener()
+ {
+ delete event;
+ }
+
+ void yield( int i )
+ {
+ ID method = rb_intern( "call" );
+ rb_funcall( callback, method, 1, INT2FIX( i ) );
+ }
+};
+
+static void on_playlist_next( mlt_properties owner, void *object, int i )
+{
+ PlaylistNextListener *o = static_cast< PlaylistNextListener * >( object );
+ o->yield( i );
+}
+