diff -urN DirectFB-1.0.0.orig/include/directfb.h DirectFB-1.0.0.new/include/directfb.h --- DirectFB-1.0.0.orig/include/directfb.h 2007-03-14 08:33:48.000000000 +0000 +++ DirectFB-1.0.0.new/include/directfb.h 2007-03-29 15:36:22.000000000 +0100 @@ -3868,7 +3868,8 @@ DFEC_INPUT = 0x01, /* raw input event */ DFEC_WINDOW = 0x02, /* windowing event */ DFEC_USER = 0x03, /* custom event for the user of this library */ - DFEC_UNIVERSAL = 0x04 /* universal event for custom usage with variable size */ + DFEC_UNIVERSAL = 0x04, /* universal event for custom usage with variable size */ + DFEC_VIDEOPROVIDER = 0x05 /* video provider event */ } DFBEventClass; /* @@ -4006,6 +4007,19 @@ } DFBWindowEventType; /* + * Video Provider Event Types - can also be used as flags for event filters. + */ +typedef enum { + DVPET_NONE = 0x00000000, + DVPET_STARTED = 0x00000001, /* The video provider has started the playback */ + DVPET_STOPPED = 0x00000002, /* The video provider has stopped the playback */ + DVPET_SPEEDCHANGE = 0x00000004, /* A speed change has occured */ + DVPET_STREAMCHANGE = 0x00000008, /* A stream description change has occured */ + DVPET_FATALERROR = 0x00000010, /* A fatal error has occured: restart must be done */ + DVPET_ALL = 0x0000001F /* all event types */ +} DFBVideoProviderEventType; + +/* * Event from the windowing system. */ typedef struct { @@ -4059,6 +4073,15 @@ } DFBWindowEvent; /* + * Event from the video provider + */ +typedef struct { + DFBEventClass clazz; /* clazz of event */ + + DFBVideoProviderEventType type; /* type of event */ +} DFBVideoProviderEvent; + +/* * Event for usage by the user of this library. */ typedef struct { @@ -4084,11 +4107,12 @@ * General container for a DirectFB Event. */ typedef union { - DFBEventClass clazz; /* clazz of event */ - DFBInputEvent input; /* field for input events */ - DFBWindowEvent window; /* field for window events */ - DFBUserEvent user; /* field for user-defined events */ - DFBUniversalEvent universal; /* field for universal events */ + DFBEventClass clazz; /* clazz of event */ + DFBInputEvent input; /* field for input events */ + DFBWindowEvent window; /* field for window events */ + DFBUserEvent user; /* field for user-defined events */ + DFBUniversalEvent universal; /* field for universal events */ + DFBVideoProviderEvent videoprovider; /* field for video provider */ } DFBEvent; #define DFB_EVENT(e) ((DFBEvent *) (e)) @@ -4103,6 +4127,7 @@ unsigned int DFEC_WINDOW; /* Number of window events. */ unsigned int DFEC_USER; /* Number of user events. */ unsigned int DFEC_UNIVERSAL; /* Number of universal events. */ + unsigned int DFEC_VIDEOPROVIDER; /* Number of universal events. */ unsigned int DIET_KEYPRESS; unsigned int DIET_KEYRELEASE; @@ -4125,6 +4150,12 @@ unsigned int DWET_LEAVE; unsigned int DWET_WHEEL; unsigned int DWET_POSITION_SIZE; + + unsigned int DVPET_STARTED; + unsigned int DVPET_STOPPED; + unsigned int DVPET_SPEEDCHANGE; + unsigned int DVPET_STREAMCHANGE; + unsigned int DVPET_FATALERROR; } DFBEventBufferStats; @@ -5298,6 +5329,55 @@ IDirectFBVideoProvider *thiz, float *ret_level ); + + /** Event buffers **/ + /* + * Create an event buffer for this video provider and attach it. + */ + DFBResult (*CreateEventBuffer) ( + IDirectFBVideoProvider *thiz, + IDirectFBEventBuffer **ret_buffer + ); + + /* + * Attach an existing event buffer to this video provider. + * + * NOTE: Attaching multiple times generates multiple events. + */ + DFBResult (*AttachEventBuffer) ( + IDirectFBVideoProvider *thiz, + IDirectFBEventBuffer *buffer + ); + + /* + * Enable specific events to be sent from the video provider. + * + * The argument is a mask of events that will be set in the + * videoproviders's event mask. The default event mask is DVPET_ALL. + */ + DFBResult (*EnableEvents) ( + IDirectFBVideoProvider *thiz, + DFBVideoProviderEventType mask + ); + + /* + * Disable specific events from being sent from the video provider + * + * The argument is a mask of events that will be cleared in + * the video providers's event mask. The default event mask is DWET_ALL. + */ + DFBResult (*DisableEvents) ( + IDirectFBVideoProvider *thiz, + DFBVideoProviderEventType mask + ); + + /* + * Detach an event buffer from this video provider. + */ + DFBResult (*DetachEventBuffer) ( + IDirectFBVideoProvider *thiz, + IDirectFBEventBuffer *buffer + ); ) /*********************** diff -urN DirectFB-1.0.0.orig/src/input/idirectfbinputbuffer.c DirectFB-1.0.0.new/src/input/idirectfbinputbuffer.c --- DirectFB-1.0.0.orig/src/input/idirectfbinputbuffer.c 2007-03-14 08:33:48.000000000 +0000 +++ DirectFB-1.0.0.new/src/input/idirectfbinputbuffer.c 2007-03-29 15:36:43.000000000 +0100 @@ -340,6 +340,10 @@ event->user = item->evt.user; break; + case DFEC_VIDEOPROVIDER: + event->videoprovider = item->evt.videoprovider; + break; + case DFEC_UNIVERSAL: direct_memcpy( event, &item->evt, item->evt.universal.size ); break; @@ -393,6 +397,10 @@ event->user = item->evt.user; break; + case DFEC_VIDEOPROVIDER: + event->videoprovider = item->evt.videoprovider; + break; + case DFEC_UNIVERSAL: direct_memcpy( event, &item->evt, item->evt.universal.size ); break; @@ -430,6 +438,7 @@ case DFEC_INPUT: case DFEC_WINDOW: case DFEC_USER: + case DFEC_VIDEOPROVIDER: size = sizeof(EventBufferItem); break; @@ -461,6 +470,10 @@ item->evt.user = event->user; break; + case DFEC_VIDEOPROVIDER: + item->evt.videoprovider = event->videoprovider; + break; + case DFEC_UNIVERSAL: direct_memcpy( &item->evt, event, event->universal.size ); break; @@ -938,6 +951,35 @@ stats->DFEC_USER += incdec; break; + case DFEC_VIDEOPROVIDER: + stats->DFEC_VIDEOPROVIDER +=incdec; + + switch (event->videoprovider.type) { + case DVPET_STARTED: + stats->DVPET_STARTED += incdec; + break; + + case DVPET_STOPPED: + stats->DVPET_STOPPED += incdec; + break; + + case DVPET_SPEEDCHANGE: + stats->DVPET_SPEEDCHANGE += incdec; + break; + + case DVPET_STREAMCHANGE: + stats->DVPET_STREAMCHANGE += incdec; + break; + + case DVPET_FATALERROR: + stats->DVPET_FATALERROR += incdec; + break; + + default: + D_BUG( "unknown video provider event type 0x%08x\n", event->videoprovider.type ); + } + break; + case DFEC_UNIVERSAL: stats->DFEC_UNIVERSAL += incdec; break; diff -urN DirectFB-1.0.0.orig/src/media/idirectfbvideoprovider.c DirectFB-1.0.0.new/src/media/idirectfbvideoprovider.c --- DirectFB-1.0.0.orig/src/media/idirectfbvideoprovider.c 2007-03-14 08:33:48.000000000 +0000 +++ DirectFB-1.0.0.new/src/media/idirectfbvideoprovider.c 2007-03-29 15:44:57.000000000 +0100 @@ -203,6 +203,42 @@ return DFB_UNIMPLEMENTED; } + +static DFBResult +IDirectFBVideoProvider_CreateEventBuffer( IDirectFBVideoProvider *thiz, + IDirectFBEventBuffer **buffer ) +{ + return DFB_UNIMPLEMENTED; +} + +static DFBResult +IDirectFBVideoProvider_AttachEventBuffer( IDirectFBVideoProvider *thiz, + IDirectFBEventBuffer *buffer ) +{ + return DFB_UNIMPLEMENTED; +} + +static DFBResult +IDirectFBVideoProvider_EnableEvents(IDirectFBVideoProvider *thiz, + DFBVideoProviderEventType mask +{ + return DFB_UNIMPLEMENTED; +} + +static DFBResult +IDirectFBVideoProvider_DisableEvents(IDirectFBVideoProvider *thiz, + DFBVideoProviderEventType mask +{ + return DFB_UNIMPLEMENTED; +} + +static DFBResult +IDirectFBVideoProvider_DetachEventBuffer( IDirectFBVideoProvider *thiz, + IDirectFBEventBuffer *buffer ) +{ + return DFB_UNIMPLEMENTED; +} + static void IDirectFBVideoProvider_Construct( IDirectFBVideoProvider *thiz ) { @@ -225,6 +261,11 @@ thiz->GetSpeed = IDirectFBVideoProvider_GetSpeed; thiz->SetVolume = IDirectFBVideoProvider_SetVolume; thiz->GetVolume = IDirectFBVideoProvider_GetVolume; + thiz->CreateEventBuffer = IDirectFBVideoProvider_CreateEventBuffer; + thiz->AttachEventBuffer = IDirectFBVideoProvider_AttachEventBuffer; + thiz->EnableEvents = IDirectFBVideoProvider_EnableEvents; + thiz->DisableEvents = IDirectFBVideoProvider_DisableEvents; + thiz->DetachEventBuffer = IDirectFBVideoProvider_DetachEventBuffer; }