From: Erwan Tulou Date: Sat, 6 Mar 2010 09:16:24 +0000 (+0100) Subject: mediadirs: display snapshots in the video widget X-Git-Tag: 1.1.0-pre1~481 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e80d880336624f91fd039952ac95aefd5a9e2e7e;p=vlc mediadirs: display snapshots in the video widget This patch replaces vlc://pause:10 (only working for qt4 in complete mode) with fake:// --fake-file=... (working in any cases) --- diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c index b644fb6883..6cd5e605d7 100644 --- a/modules/services_discovery/mediadirs.c +++ b/modules/services_discovery/mediadirs.c @@ -299,28 +299,34 @@ void formatSnapshotItem( input_item_t *p_item ) if( !p_item ) return; - if( !p_item->p_meta ) - p_item->p_meta = vlc_meta_New(); + char* psz_file = NULL; + char* psz_option = NULL; + char* psz_uri = input_item_GetURI( p_item ); + + if( !psz_uri ) + goto end; /* copy the snapshot mrl as a ArtURL */ - if( p_item->p_meta ) + input_item_SetArtURL( p_item, psz_uri ); + + psz_file = make_path( psz_uri ); + if( !psz_file ) + goto end; + + if( asprintf( &psz_option, "fake-file=%s", psz_file ) == -1 ) { - char* psz_uri = NULL; - psz_uri = input_item_GetURI( p_item ); - if( psz_uri ) - input_item_SetArtURL( p_item, psz_uri ); - free( psz_uri ); + psz_option = NULL; + goto end; } - /** - * TODO: select the best mrl for displaying snapshots - * - vlc://pause:10 => snapshot are displayed as Art - * - file:///path/image.ext => snapshot are displayed as videos - **/ - input_item_SetURI( p_item, "vlc://pause:10" ); + /* display still image as a video */ + input_item_SetURI( p_item, "fake://" ); + input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED ); - // input_item_AddOption( p_item, "fake-duration=10000", - // VLC_INPUT_OPTION_TRUSTED ); +end: + free( psz_option ); + free( psz_file ); + free( psz_uri ); }