- exception=mediacontrol_exception_init(exception);
-
- /*
- if (var_Get (self->p_vlc, "snapshot-id", &val) == VLC_SUCCESS)
- p_vout = vlc_object_get (self->p_vlc, val.i_int);
- */
-
- /* FIXME: if in p_libvlc, we cannot have multiple video outputs */
- /* Once corrected, search for snapshot-id to modify all instances */
- if (var_Get (p_input, "snapshot-id", &val) != VLC_SUCCESS)
- {
- RAISE(mediacontrol_InternalException, "No snapshot-id in p_input");
- return NULL;
- }
- p_vout = vlc_object_get (self->p_vlc, val.i_int);
-
- if (! p_vout)
- {
- RAISE(mediacontrol_InternalException, "No snapshot module");
- return NULL;
- }
-
-#ifdef HAS_SNAPSHOT
- /* We test if the vout is a snapshot module. We cannot test
- pvout_psz_object_name (which is NULL). But we can check if
- there are snapshot-specific variables */
- if (var_Get( p_vout, "snapshot-datasize", &val ) != VLC_SUCCESS)
- {
- RAISE(mediacontrol_InternalException, "No snapshot module");
- vlc_object_release(p_vout);
- return NULL;
- }
- i_datasize = val.i_int;
-
- /* Handle the a_position parameter */
- if (! (a_position->origin == mediacontrol_RelativePosition
- && a_position->value == 0))
- {
- /* The position is not the current one. Go to it. */
- mediacontrol_set_media_position (self, (mediacontrol_Position*)a_position, exception);
- if (exception->code)
- {
- vlc_object_release(p_vout);
- return NULL;
- }
- }
-
- /* FIXME: We should not go further until we got past the position
- (which means that we had the possibility to capture the right
- picture). */
-
- vlc_mutex_lock( &p_vout->picture_lock );
-
- searched_date = mediacontrol_position2microsecond (p_input,
- (mediacontrol_Position *)a_position);
-
- var_Get( p_vout, "snapshot-cache-size", &val );
- i_cachesize = val.i_int ;
-
- var_Get( p_vout, "snapshot-list-pointer", &val );
- pointer = (snapshot_t **)val.p_address;
-
- if (! pointer)
- {
- RAISE(mediacontrol_InternalException, "No available snapshot");
-
- vlc_mutex_unlock( &p_vout->picture_lock );
- vlc_object_release( p_vout );
- return NULL;
- }
-
- /* Find the more appropriate picture, based on date */
- p_best_snapshot = pointer[0];
-
- for (i_index = 1 ; i_index < i_cachesize ; i_index++)
- {
- long l_diff = pointer[i_index]->date - searched_date;
- if (l_diff > 0 && l_diff < abs(p_best_snapshot->date - searched_date))
- {
- /* This one is closer, and _after_ the requested position */
- p_best_snapshot = pointer[i_index];
- }
- }
-
- /* FIXME: add a test for the case that no picture matched the test
- (we have p_best_snapshot == pointer[0] */
- retval = _mediacontrol_createRGBPicture (p_best_snapshot->i_width,
- p_best_snapshot->i_height,
- p_vout->output.i_chroma,
- p_best_snapshot->date,
- p_best_snapshot->p_data,
- i_datasize);
-
- vlc_mutex_unlock( &p_vout->picture_lock );
- vlc_object_release( p_vout );
+ exception=mediacontrol_exception_init( exception );
+
+ /*
+ if( var_Get( self->p_vlc, "snapshot-id", &val ) == VLC_SUCCESS )
+ p_vout = vlc_object_get( self->p_vlc, val.i_int );
+ */
+
+ /* FIXME: if in p_libvlc, we cannot have multiple video outputs */
+ /* Once corrected, search for snapshot-id to modify all instances */
+ if( var_Get( p_input, "snapshot-id", &val ) != VLC_SUCCESS )
+ {
+ RAISE( mediacontrol_InternalException, "No snapshot-id in p_input" );
+ return NULL;
+ }
+ p_vout = vlc_object_get( self->p_vlc, val.i_int );
+
+ if( ! p_vout )
+ {
+ RAISE( mediacontrol_InternalException, "No snapshot module" );
+ return NULL;
+ }
+
+#ifdef HAS_SNAPSHOT
+ /* We test if the vout is a snapshot module. We cannot test
+ pvout_psz_object_name( which is NULL ). But we can check if
+ there are snapshot-specific variables */
+ if( var_Get( p_vout, "snapshot-datasize", &val ) != VLC_SUCCESS )
+ {
+ RAISE( mediacontrol_InternalException, "No snapshot module" );
+ vlc_object_release( p_vout );
+ return NULL;
+ }
+ i_datasize = val.i_int;
+
+ /* Handle the a_position parameter */
+ if( ! ( a_position->origin == mediacontrol_RelativePosition
+ && a_position->value == 0 ) )
+ {
+ /* The position is not the current one. Go to it. */
+ mediacontrol_set_media_position( self,
+ ( mediacontrol_Position* ) a_position,
+ exception );
+ if( exception->code )
+ {
+ vlc_object_release( p_vout );
+ return NULL;
+ }
+ }
+
+ /* FIXME: We should not go further until we got past the position
+ ( which means that we had the possibility to capture the right
+ picture ). */
+
+ vlc_mutex_lock( &p_vout->picture_lock );
+
+ searched_date = mediacontrol_position2microsecond( p_input,
+ ( mediacontrol_Position * ) a_position );
+
+ var_Get( p_vout, "snapshot-cache-size", &val );
+ i_cachesize = val.i_int ;
+
+ var_Get( p_vout, "snapshot-list-pointer", &val );
+ pointer = ( snapshot_t ** )val.p_address;
+
+ if( ! pointer )
+ {
+ RAISE( mediacontrol_InternalException, "No available snapshot" );
+
+ vlc_mutex_unlock( &p_vout->picture_lock );
+ vlc_object_release( p_vout );
+ return NULL;
+ }
+
+ /* Find the more appropriate picture, based on date */
+ p_best_snapshot = pointer[0];
+
+ for( i_index = 1 ; i_index < i_cachesize ; i_index++ )
+ {
+ long l_diff = pointer[i_index]->date - searched_date;
+ if( l_diff > 0 && l_diff < abs( p_best_snapshot->date - searched_date ))
+ {
+ /* This one is closer, and _after_ the requested position */
+ p_best_snapshot = pointer[i_index];
+ }
+ }
+
+ /* FIXME: add a test for the case that no picture matched the test
+ ( we have p_best_snapshot == pointer[0] */
+ retval = _mediacontrol_createRGBPicture( p_best_snapshot->i_width,
+ p_best_snapshot->i_height,
+ p_vout->output.i_chroma,
+ p_best_snapshot->date,
+ p_best_snapshot->p_data,
+ i_datasize );
+
+ vlc_mutex_unlock( &p_vout->picture_lock );
+ vlc_object_release( p_vout );