这篇教程C++ vlc_fopen函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vlc_fopen函数的典型用法代码示例。如果您正苦于以下问题:C++ vlc_fopen函数的具体用法?C++ vlc_fopen怎么用?C++ vlc_fopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vlc_fopen函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LoadCryptFile/************************************************************************ * LoadCryptFile: Try to parse key_uri and keyfile-location from file ************************************************************************/static int LoadCryptFile( sout_access_out_t *p_access ){ sout_access_out_sys_t *p_sys = p_access->p_sys; FILE *stream = vlc_fopen( p_sys->psz_keyfile, "rt" ); char *key_file=NULL,*key_uri=NULL; if( unlikely( stream == NULL ) ) { msg_Err( p_access, "Unable to open keyloadfile %s: %s", p_sys->psz_keyfile, vlc_strerror_c(errno) ); return VLC_EGENERIC; } //First read key_uri ssize_t len = getline( &key_uri, &(size_t){0}, stream ); if( unlikely( len == -1 ) ) { msg_Err( p_access, "Cannot read %s: %s", p_sys->psz_keyfile, vlc_strerror_c(errno) ); clearerr( stream ); fclose( stream ); free( key_uri ); return VLC_EGENERIC; } //Strip the newline from uri, maybe scanf would be better? key_uri[len-1]='/0'; len = getline( &key_file, &(size_t){0}, stream ); if( unlikely( len == -1 ) ) { msg_Err( p_access, "Cannot read %s: %s", p_sys->psz_keyfile, vlc_strerror_c(errno) ); clearerr( stream ); fclose( stream ); free( key_uri ); free( key_file ); return VLC_EGENERIC; } // Strip the last newline from filename key_file[len-1]='/0'; fclose( stream ); int returncode = VLC_SUCCESS; if( !p_sys->key_uri || strcmp( p_sys->key_uri, key_uri ) ) { if( p_sys->key_uri ) { free( p_sys->key_uri ); p_sys->key_uri = NULL; } p_sys->key_uri = strdup( key_uri ); returncode = CryptSetup( p_access, key_file ); } free( key_file ); free( key_uri ); return returncode;}
开发者ID:Geal,项目名称:vlc,代码行数:63,
示例2: OpenDecoderCommon/***************************************************************************** * OpenDecoder: Open the decoder *****************************************************************************/static int OpenDecoderCommon( vlc_object_t *p_this, bool b_force_dump ){ decoder_t *p_dec = (decoder_t*)p_this; char psz_file[10 + 3 * sizeof (p_dec)]; snprintf( psz_file, sizeof( psz_file), "stream.%p", p_dec ); if( !b_force_dump ) b_force_dump = var_InheritBool( p_dec, "dummy-save-es" ); if( b_force_dump ) { FILE *stream = vlc_fopen( psz_file, "wb" ); if( stream == NULL ) { msg_Err( p_dec, "cannot create `%s'", psz_file ); return VLC_EGENERIC; } msg_Dbg( p_dec, "dumping stream to file `%s'", psz_file ); p_dec->p_sys = (void *)stream; } else p_dec->p_sys = NULL; /* Set callbacks */ p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **)) DecodeBlock; p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) DecodeBlock; p_dec->pf_decode_sub = (subpicture_t *(*)(decoder_t *, block_t **)) DecodeBlock; es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in ); return VLC_SUCCESS;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:38,
示例3: vlc_fopenstatic char *MarqueeReadFile( filter_t *obj, const char *path ){ FILE *stream = vlc_fopen( path, "rt" ); if( stream == NULL ) { msg_Err( obj, "cannot open %s: %m", path ); return NULL; } char *line = NULL; size_t p = 0; // sunqueen add ssize_t len = getline( &line, &p/*&(size_t){ 0 }*/, stream ); // sunqueen modify if( len == -1 ) { msg_Err( obj, "cannot read %s: %m", path ); clearerr( stream ); line = NULL; } fclose( stream ); if( len >= 1 && line[len - 1] == '/n' ) line[--len] = '/0'; return line;}
开发者ID:WutongEdward,项目名称:vlc-2.1.4.32.subproject-2013,代码行数:25,
示例4: playlist_FindArtInCacheUsingItemUIDint playlist_FindArtInCacheUsingItemUID( input_item_t *p_item ){ char *uid = input_item_GetInfo( p_item, "uid", "md5" ); if ( ! *uid ) { free( uid ); return VLC_EGENERIC; } /* we have an input item uid set */ bool b_done = false; char *psz_byuiddir = GetDirByItemUIDs( uid ); char *psz_byuidfile = GetFileByItemUID( psz_byuiddir, "arturl" ); free( psz_byuiddir ); if( psz_byuidfile ) { FILE *fd = vlc_fopen( psz_byuidfile, "rb" ); if ( fd ) { char sz_cachefile[2049]; /* read the cache hash url */ if ( fgets( sz_cachefile, 2048, fd ) != NULL ) { input_item_SetArtURL( p_item, sz_cachefile ); b_done = true; } fclose( fd ); } free( psz_byuidfile ); } free( uid ); if ( b_done ) return VLC_SUCCESS; return VLC_EGENERIC;}
开发者ID:IAPark,项目名称:vlc,代码行数:35,
示例5: open_vlcstatic voidpf ZCALLBACK open_vlc( voidpf opaque, const char *filename, int mode){ (void)mode; intf_thread_t *pIntf = (intf_thread_t *)opaque; FILE *stream = vlc_fopen( filename, "rb" ); if( stream == NULL ) msg_Dbg( pIntf, "vlc_fopen failed for %s", filename ); return stream;}
开发者ID:Gonsaave,项目名称:vlc,代码行数:10,
示例6: InstallFilestatic int InstallFile( addons_storage_t *p_this, const char *psz_downloadlink, const char *psz_dest ){ stream_t *p_stream; FILE *p_destfile; char buffer[1<<10]; int i_read = 0; p_stream = stream_UrlNew( p_this, psz_downloadlink ); if( !p_stream ) { msg_Err( p_this, "Failed to access Addon download url %s", psz_downloadlink ); return VLC_EGENERIC; } char *psz_path = strdup( psz_dest ); if ( !psz_path ) { stream_Delete( p_stream ); return VLC_ENOMEM; } char *psz_buf = strrchr( psz_path, DIR_SEP_CHAR ); if( psz_buf ) { *++psz_buf = '/0'; /* ensure directory exists */ if( !EMPTY_STR( psz_path ) ) recursive_mkdir( VLC_OBJECT(p_this), psz_path ); free( psz_path ); } p_destfile = vlc_fopen( psz_dest, "w" ); if( !p_destfile ) { msg_Err( p_this, "Failed to open Addon storage file %s", psz_dest ); stream_Delete( p_stream ); return VLC_EGENERIC; } while ( ( i_read = stream_Read( p_stream, &buffer, 1<<10 ) ) > 0 ) { if ( fwrite( &buffer, i_read, 1, p_destfile ) < 1 ) { msg_Err( p_this, "Failed to write to Addon file" ); fclose( p_destfile ); stream_Delete( p_stream ); return VLC_EGENERIC; } } fclose( p_destfile ); stream_Delete( p_stream ); return VLC_SUCCESS;}
开发者ID:LTNGlobal-opensource,项目名称:vlc-sdi,代码行数:53,
示例7: playlist_Exportint playlist_Export( playlist_t * p_playlist, const char *psz_filename, bool b_playlist, const char *psz_type ){ playlist_export_t *p_export = vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" ); if( unlikely(p_export == NULL) ) return VLC_ENOMEM; msg_Dbg( p_export, "saving %s to file %s", b_playlist ? "playlist" : "media library", psz_filename ); int ret = VLC_EGENERIC; /* Prepare the playlist_export_t structure */ p_export->base_url = vlc_path2uri( psz_filename, NULL ); p_export->p_file = vlc_fopen( psz_filename, "wt" ); if( p_export->p_file == NULL ) { msg_Err( p_export, "could not create playlist file %s: %s", psz_filename, vlc_strerror_c(errno) ); goto out; } module_t *p_module; /* And call the module ! All work is done now */ playlist_Lock( p_playlist ); p_export->p_root = b_playlist ? p_playlist->p_playing : p_playlist->p_media_library; p_module = module_need( p_export, "playlist export", psz_type, true ); playlist_Unlock( p_playlist ); if( p_module != NULL ) { module_unneed( p_export, p_module ); if( !ferror( p_export->p_file ) ) ret = VLC_SUCCESS; else msg_Err( p_playlist, "could not write playlist file: %s", vlc_strerror_c(errno) ); } else msg_Err( p_playlist, "could not export playlist" ); fclose( p_export->p_file );out: free( p_export->base_url ); vlc_object_release( p_export ); return ret;}
开发者ID:IAPark,项目名称:vlc,代码行数:50,
示例8: playlist_Exportint playlist_Export( playlist_t * p_playlist, const char *psz_filename, playlist_item_t *p_export_root, const char *psz_type ){ if( p_export_root == NULL ) return VLC_EGENERIC; playlist_export_t *p_export = vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" ); if( unlikely(p_export == NULL) ) return VLC_ENOMEM; msg_Dbg( p_export, "saving %s to file %s", p_export_root->p_input->psz_name, psz_filename ); int ret = VLC_EGENERIC; /* Prepare the playlist_export_t structure */ p_export->p_root = p_export_root; p_export->psz_filename = psz_filename; p_export->p_file = vlc_fopen( psz_filename, "wt" ); if( p_export->p_file == NULL ) { msg_Err( p_export, "could not create playlist file %s: %s", psz_filename, vlc_strerror_c(errno) ); goto out; } module_t *p_module; /* And call the module ! All work is done now */ playlist_Lock( p_playlist ); p_module = module_need( p_export, "playlist export", psz_type, true ); playlist_Unlock( p_playlist ); if( p_module != NULL ) { module_unneed( p_export, p_module ); if( !ferror( p_export->p_file ) ) ret = VLC_SUCCESS; else msg_Err( p_playlist, "could not write playlist file: %s", vlc_strerror_c(errno) ); } else msg_Err( p_playlist, "could not export playlist" ); fclose( p_export->p_file );out: vlc_object_release( p_export ); return ret;}
开发者ID:0xheart0,项目名称:vlc,代码行数:49,
示例9: hash_from_binary_file/* hash a binary file */static int hash_from_binary_file( const char *psz_file, gcry_md_hd_t hd ){ uint8_t buffer[4096]; size_t i_read; FILE *f = vlc_fopen( psz_file, "r" ); if( !f ) return -1; while( ( i_read = fread( buffer, 1, sizeof(buffer), f ) ) > 0 ) gcry_md_write( hd, buffer, i_read ); fclose( f ); return 0;}
开发者ID:BossKing,项目名称:vlc,代码行数:17,
示例10: vlc_fopen/***************************************************************************** * Open file relative to base directory for reading. *****************************************************************************/static FILE *OpenRelativeFile( access_t *p_access, const char *psz_file ){ /* build path and add extension */ char *psz_path; if( asprintf( &psz_path, "%s" DIR_SEP "%s%s", p_access->psz_filepath, psz_file, p_access->p_sys->b_ts_format ? "" : ".vdr" ) == -1 ) return NULL; FILE *file = vlc_fopen( psz_path, "rb" ); if( !file ) msg_Warn( p_access, "Failed to open %s: %m", psz_path ); free( psz_path ); return file;}
开发者ID:Flameeyes,项目名称:vlc,代码行数:19,
示例11: CacheSave/** * Saves a module cache to disk, and release cache data from memory. */void CacheSave (vlc_object_t *p_this, const char *dir, module_cache_t *entries, size_t n){ char *filename = NULL, *tmpname = NULL; if (asprintf (&filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1) goto out; if (asprintf (&tmpname, "%s.%"PRIu32, filename, (uint32_t)getpid ()) == -1) goto out; msg_Dbg (p_this, "saving plugins cache %s", filename); FILE *file = vlc_fopen (tmpname, "wb"); if (file == NULL) { if (errno != EACCES && errno != ENOENT) msg_Warn (p_this, "cannot create %s: %s", tmpname, vlc_strerror_c(errno)); goto out; } if (CacheSaveBank (file, entries, n)) { msg_Warn (p_this, "cannot write %s: %s", tmpname, vlc_strerror_c(errno)); clearerr (file); fclose (file); vlc_unlink (tmpname); goto out; }#if !defined( _WIN32 ) && !defined( __OS2__ ) vlc_rename (tmpname, filename); /* atomically replace old cache */ fclose (file);#else vlc_unlink (filename); fclose (file); vlc_rename (tmpname, filename);#endifout: free (filename); free (tmpname); for (size_t i = 0; i < n; i++) free (entries[i].path); free (entries);}
开发者ID:371816210,项目名称:vlc_vlc,代码行数:50,
示例12: Start/**************************************************************************** * Helpers ****************************************************************************/static int Start( stream_t *s, const char *psz_extension ){ stream_sys_t *p_sys = s->p_sys; char *psz_file; FILE *f; /* */ if( !psz_extension ) psz_extension = "dat"; /* Retreive path */ char *psz_path = var_CreateGetNonEmptyString( s, "input-record-path" ); if( !psz_path ) psz_path = config_GetUserDir( VLC_DOWNLOAD_DIR ); if( !psz_path ) return VLC_ENOMEM; /* Create file name * TODO allow prefix configuration */ psz_file = input_CreateFilename( VLC_OBJECT(s), psz_path, INPUT_RECORD_PREFIX, psz_extension ); free( psz_path ); if( !psz_file ) return VLC_ENOMEM; f = vlc_fopen( psz_file, "wb" ); if( !f ) { free( psz_file ); return VLC_EGENERIC; } /* signal new record file */ var_SetString( s->p_libvlc, "record-file", psz_file ); msg_Dbg( s, "Recording into %s", psz_file ); free( psz_file ); /* */ p_sys->f = f; p_sys->b_error = false; return VLC_SUCCESS;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:49,
示例13: CacheSave/***************************************************************************** * SavePluginsCache: saves the plugins cache to a file *****************************************************************************/void CacheSave (vlc_object_t *p_this, const char *dir, module_cache_t *const *pp_cache, size_t n){ char *filename, *tmpname; if (asprintf (&filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1) return; if (asprintf (&tmpname, "%s.%"PRIu32, filename, (uint32_t)getpid ()) == -1) { free (filename); return; } msg_Dbg (p_this, "saving plugins cache %s", filename); FILE *file = vlc_fopen (tmpname, "wb"); if (file == NULL) { if (errno != EACCES && errno != ENOENT) msg_Warn (p_this, "cannot create %s (%m)", tmpname); goto out; } if (CacheSaveBank (file, pp_cache, n)) { msg_Warn (p_this, "cannot write %s (%m)", tmpname); clearerr (file); fclose (file); vlc_unlink (tmpname); goto out; }#if !defined( WIN32 ) && !defined( __OS2__ ) vlc_rename (tmpname, filename); /* atomically replace old cache */ fclose (file);#else vlc_unlink (filename); fclose (file); vlc_rename (tmpname, filename);#endifout: free (filename); free (tmpname);}
开发者ID:LDiracDelta,项目名称:vlc_censor_plugin,代码行数:47,
示例14: Open/***************************************************************************** * Open: *****************************************************************************/static int Open( vlc_object_t *p_this ){ sout_stream_t *p_stream = (sout_stream_t*)p_this; sout_stream_sys_t *p_sys; char *outputFile; p_sys = calloc( 1, sizeof( sout_stream_sys_t ) ); if( !p_sys ) return VLC_ENOMEM; config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); outputFile = var_InheritString( p_stream, SOUT_CFG_PREFIX "output" ); if( outputFile ) { p_sys->output = vlc_fopen( outputFile, "wt" ); if( !p_sys->output ) { msg_Err( p_stream, "Unable to open file '%s' for writing", outputFile ); free( p_sys ); free( outputFile ); return VLC_EGENERIC; } else { fprintf( p_sys->output,"#prefix/ttrack/ttype/tsegment_number/tdts_difference/tlength/tmd5/n"); } free( outputFile ); } p_sys->prefix = var_InheritString( p_stream, SOUT_CFG_PREFIX "prefix" ); p_stream->p_sys = p_sys; p_stream->pf_add = Add; p_stream->pf_del = Del; p_stream->pf_send = Send; return VLC_SUCCESS;}
开发者ID:mstorsjo,项目名称:vlc,代码行数:45,
示例15: ImageWriteUrlstatic int ImageWriteUrl( image_handler_t *p_image, picture_t *p_pic, video_format_t *p_fmt_in, video_format_t *p_fmt_out, const char *psz_url ){ block_t *p_block; FILE *file; if( !p_fmt_out->i_chroma ) { /* Try to guess format from file name */ p_fmt_out->i_chroma = image_Ext2Fourcc( psz_url ); } file = vlc_fopen( psz_url, "wb" ); if( !file ) { msg_Err( p_image->p_parent, "%s: %s", psz_url, vlc_strerror_c(errno) ); return VLC_EGENERIC; } p_block = ImageWrite( p_image, p_pic, p_fmt_in, p_fmt_out ); int err = 0; if( p_block ) { if( fwrite( p_block->p_buffer, p_block->i_buffer, 1, file ) != 1 ) err = errno; block_Release( p_block ); } if( fclose( file ) && !err ) err = errno; if( err ) { errno = err; msg_Err( p_image->p_parent, "%s: %s", psz_url, vlc_strerror_c(errno) ); } return err ? VLC_EGENERIC : VLC_SUCCESS;}
开发者ID:BossKing,项目名称:vlc,代码行数:41,
示例16: HttpCallbackint HttpCallback( httpd_file_sys_t *p_args, httpd_file_t *p_file, uint8_t *_p_request, uint8_t **_pp_data, int *pi_data ){ VLC_UNUSED(p_file); char *p_request = (char *)_p_request; char **pp_data = (char **)_pp_data; FILE *f; if( ( f = vlc_fopen( p_args->file, "r" ) ) == NULL ) { Callback404( p_args, pp_data, pi_data ); return VLC_SUCCESS; } if( !p_args->b_html ) { FileLoad( f, pp_data, pi_data ); } else { int i_buffer; char *p_buffer; /* first we load in a temporary buffer */ FileLoad( f, &p_buffer, &i_buffer ); ParseExecute( p_args, p_buffer, i_buffer, p_request, pp_data, pi_data ); free( p_buffer ); } fclose( f ); return VLC_SUCCESS;}
开发者ID:cobr123,项目名称:qtVlc,代码行数:37,
示例17: vlc_fopenstatic char *MarqueeReadFile( filter_t *obj, const char *path ){ FILE *stream = vlc_fopen( path, "rt" ); if( stream == NULL ) { msg_Err( obj, "cannot open %s: %s", path, vlc_strerror_c(errno) ); return NULL; } char *line = NULL; ssize_t len = getline( &line, &(size_t){ 0 }, stream ); if( len == -1 ) { msg_Err( obj, "cannot read %s: %s", path, vlc_strerror_c(errno) ); clearerr( stream ); line = NULL; } fclose( stream ); if( len >= 1 && line[len - 1] == '/n' ) line[--len] = '/0'; return line;}
开发者ID:0xheart0,项目名称:vlc,代码行数:24,
示例18: CacheLoad/** * Loads a plugins cache file. * * This function will load the plugin cache if present and valid. This cache * will in turn be queried by AllocateAllPlugins() to see if it needs to * actually load the dynamically loadable module. * This allows us to only fully load plugins when they are actually used. */size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ){ char *psz_filename; FILE *file; int i_size, i_read; char p_cachestring[sizeof(CACHE_STRING)]; size_t i_cache; int32_t i_marker; assert( dir != NULL ); *r = NULL; if( asprintf( &psz_filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1 ) return 0; msg_Dbg( p_this, "loading plugins cache file %s", psz_filename ); file = vlc_fopen( psz_filename, "rb" ); if( !file ) { msg_Warn( p_this, "cannot read %s: %s", psz_filename, vlc_strerror_c(errno) ); free( psz_filename ); return 0; } free( psz_filename ); /* Check the file is a plugins cache */ i_size = sizeof(CACHE_STRING) - 1; i_read = fread( p_cachestring, 1, i_size, file ); if( i_read != i_size || memcmp( p_cachestring, CACHE_STRING, i_size ) ) { msg_Warn( p_this, "This doesn't look like a valid plugins cache" ); fclose( file ); return 0; }#ifdef DISTRO_VERSION /* Check for distribution specific version */ char p_distrostring[sizeof( DISTRO_VERSION )]; i_size = sizeof( DISTRO_VERSION ) - 1; i_read = fread( p_distrostring, 1, i_size, file ); if( i_read != i_size || memcmp( p_distrostring, DISTRO_VERSION, i_size ) ) { msg_Warn( p_this, "This doesn't look like a valid plugins cache" ); fclose( file ); return 0; }#endif /* Check Sub-version number */ i_read = fread( &i_marker, 1, sizeof(i_marker), file ); if( i_read != sizeof(i_marker) || i_marker != CACHE_SUBVERSION_NUM ) { msg_Warn( p_this, "This doesn't look like a valid plugins cache " "(corrupted header)" ); fclose( file ); return 0; } /* Check header marker */ i_read = fread( &i_marker, 1, sizeof(i_marker), file ); if( i_read != sizeof(i_marker) || i_marker != ftell( file ) - (int)sizeof(i_marker) ) { msg_Warn( p_this, "This doesn't look like a valid plugins cache " "(corrupted header)" ); fclose( file ); return 0; } if (fread( &i_cache, 1, sizeof(i_cache), file ) != sizeof(i_cache) ) { msg_Warn( p_this, "This doesn't look like a valid plugins cache " "(file too short)" ); fclose( file ); return 0; } module_cache_t *cache = NULL; for (size_t count = 0; count < i_cache;) { module_t *module; int i_submodules; module = vlc_module_create (NULL); /* Load additional infos */ LOAD_STRING(module->psz_shortname);//.........这里部分代码省略.........
开发者ID:371816210,项目名称:vlc_vlc,代码行数:101,
示例19: libvlc_InternalInit//.........这里部分代码省略......... module_EndBank (true); return VLC_EEXITSUCCESS; } if( module_count <= 1 ) { msg_Err( p_libvlc, "No plugins found! Check your VLC installation."); module_EndBank (true); return VLC_ENOITEM; }#ifdef HAVE_DAEMON /* Check for daemon mode */ if( var_InheritBool( p_libvlc, "daemon" ) ) { char *psz_pidfile = NULL; if( daemon( 1, 0) != 0 ) { msg_Err( p_libvlc, "Unable to fork vlc to daemon mode" ); module_EndBank (true); return VLC_EEXIT; } b_daemon = true; /* lets check if we need to write the pidfile */ psz_pidfile = var_CreateGetNonEmptyString( p_libvlc, "pidfile" ); if( psz_pidfile != NULL ) { FILE *pidfile; pid_t i_pid = getpid (); msg_Dbg( p_libvlc, "PID is %d, writing it to %s", i_pid, psz_pidfile ); pidfile = vlc_fopen( psz_pidfile,"w" ); if( pidfile != NULL ) { utf8_fprintf( pidfile, "%d", (int)i_pid ); fclose( pidfile ); } else { msg_Err( p_libvlc, "cannot open pid file for writing: %s (%m)", psz_pidfile ); } } free( psz_pidfile ); }#endif/* FIXME: could be replaced by using Unix sockets */#ifdef HAVE_DBUS#define MPRIS_APPEND "/org/mpris/MediaPlayer2/TrackList/Append"#define MPRIS_BUS_NAME "org.mpris.MediaPlayer2.vlc"#define MPRIS_OBJECT_PATH "/org/mpris/MediaPlayer2"#define MPRIS_TRACKLIST_INTERFACE "org.mpris.MediaPlayer2.TrackList" dbus_threads_init_default(); if( var_InheritBool( p_libvlc, "one-instance" ) || ( var_InheritBool( p_libvlc, "one-instance-when-started-from-file" ) && var_InheritBool( p_libvlc, "started-from-file" ) ) ) { /* Initialise D-Bus interface, check for other instances */ DBusConnection *p_conn = NULL; DBusError dbus_error;
开发者ID:RodrigoNieves,项目名称:vlc,代码行数:67,
示例20: osd_parser_simpleOpen/***************************************************************************** * Simple parser open function *****************************************************************************/int osd_parser_simpleOpen( vlc_object_t *p_this ){ osd_menu_t *p_menu = (osd_menu_t *) p_this; osd_button_t *p_current = NULL; /* button currently processed */ osd_button_t *p_prev = NULL; /* previous processed button */ FILE *fd = NULL; int result = 0; if( !p_menu ) return VLC_ENOOBJ; msg_Dbg( p_this, "opening osdmenu definition file %s", p_menu->psz_file ); fd = vlc_fopen( p_menu->psz_file, "r" ); if( !fd ) { msg_Err( p_this, "failed to open osdmenu definition file %s", p_menu->psz_file ); return VLC_EGENERIC; } /* Read first line */ if( !feof( fd ) ) { char action[25] = ""; char cmd[25] = ""; char path[PATH_MAX] = ""; char *psz_path = NULL; size_t i_len = 0; long pos = 0; result = fscanf(fd, "%24s %255s", action, path ); /* override images path ? */ psz_path = var_InheritString( p_this, "osdmenu-file-path" ); if( psz_path ) { /* psz_path is not null and therefor path cannot be NULL * it might be null terminated. */ strncpy( path, psz_path, PATH_MAX ); free( psz_path ); psz_path = NULL; } /* NULL terminate before asking the length of path[] */ path[PATH_MAX-1] = '/0'; i_len = strlen(path); /* Protect against buffer overflow: * max index is PATH_MAX-1 and we increment by 1 after * so PATH_MAX-2 is the bigest we can have */ if( i_len > PATH_MAX - 2 ) i_len = PATH_MAX - 2;#if defined(WIN32) || defined(UNDER_CE) || defined(__OS2__) if( (i_len > 0) && path[i_len] != '//' ) path[i_len] = '//';#else if( (i_len > 0) && path[i_len] != '/' ) path[i_len] = '/';#endif path[i_len+1] = '/0'; if( result == 0 || result == EOF ) goto error; msg_Dbg( p_this, "osdmenu dir %s", path ); if( i_len == 0 ) p_menu = osd_MenuNew( p_menu, NULL, 0, 0 ); else p_menu = osd_MenuNew( p_menu, path, 0, 0 ); /* Peek for 'style' argument */ pos = ftell( fd ); if( pos < 0 ) goto error; result = fscanf(fd, "%24s %24s", cmd, action ); if( result == 0 || result == EOF ) goto error; msg_Dbg( p_this, "osdmenu %s %s", cmd, action ); if( strncmp( cmd, "style", 5 ) == 0 ) { if( strncmp( action, "default", 7) == 0 ) { p_menu->i_style = OSD_MENU_STYLE_SIMPLE; } else if( strncmp( action, "concat", 6) == 0 ) { p_menu->i_style = OSD_MENU_STYLE_CONCAT; } } else { result = fseek( fd, pos, SEEK_SET ); if( result < 0 ) goto error; } }//.........这里部分代码省略.........
开发者ID:vlcchina,项目名称:vlc-player-experimental,代码行数:101,
示例21: OpenVCDImage/**************************************************************************** * OpenVCDImage: try to open a vcd image from a .cue file ****************************************************************************/static int OpenVCDImage( vlc_object_t * p_this, const char *psz_dev, vcddev_t *p_vcddev ){ int i_ret = -1; char *p_pos; char *psz_vcdfile = NULL; char *psz_cuefile = NULL; FILE *cuefile = NULL; int *p_sectors = NULL; char line[1024]; bool b_found = false; /* Check if we are dealing with a .cue file */ p_pos = strrchr( psz_dev, '.' ); if( p_pos && !strcmp( p_pos, ".cue" ) ) { /* psz_dev must be the cue file. Let's assume there's a .bin * file with the same filename */ if( asprintf( &psz_vcdfile, "%.*s.bin", (int)(p_pos - psz_dev), psz_dev ) < 0 ) psz_vcdfile = NULL; psz_cuefile = strdup( psz_dev ); } else if( p_pos ) { /* psz_dev must be the actual vcd file. Let's assume there's a .cue * file with the same filename */ if( asprintf( &psz_cuefile, "%.*s.cue", (int)(p_pos - psz_dev), psz_dev ) < 0 ) psz_cuefile = NULL; psz_vcdfile = strdup( psz_dev ); } else { if( asprintf( &psz_cuefile, "%s.cue", psz_dev ) == -1 ) psz_cuefile = NULL; /* If we need to look up the .cue file, then we don't have to look * for the vcd */ psz_vcdfile = strdup( psz_dev ); } if( psz_cuefile == NULL || psz_vcdfile == NULL ) goto error; /* Open the cue file and try to parse it */ msg_Dbg( p_this,"trying .cue file: %s", psz_cuefile ); cuefile = vlc_fopen( psz_cuefile, "rt" ); if( cuefile == NULL ) { msg_Dbg( p_this, "could not find .cue file" ); goto error; } msg_Dbg( p_this,"guessing vcd image file: %s", psz_vcdfile ); p_vcddev->i_vcdimage_handle = vlc_open( psz_vcdfile, O_RDONLY | O_NONBLOCK | O_BINARY ); while( fgets( line, 1024, cuefile ) && !b_found ) { /* We have a cue file, but no valid vcd file yet */ char filename[1024]; char type[16]; int i_temp = sscanf( line, "FILE /"%1023[^/"]/" %15s", filename, type ); switch( i_temp ) { case 2: msg_Dbg( p_this, "the cue file says the data file is %s", type ); if( strcasecmp( type, "BINARY" ) ) goto error; /* Error if not binary, otherwise treat as case 1 */ case 1: if( p_vcddev->i_vcdimage_handle == -1 ) { msg_Dbg( p_this, "we could not find the data file, but we found a new path" ); free( psz_vcdfile); if( *filename != '/' && ((p_pos = strrchr( psz_cuefile, '/' )) || (p_pos = strrchr( psz_cuefile, '//' ) )) ) { psz_vcdfile = malloc( strlen(filename) + (p_pos - psz_cuefile + 1) + 1 ); strncpy( psz_vcdfile, psz_cuefile, (p_pos - psz_cuefile + 1) ); strcpy( psz_vcdfile + (p_pos - psz_cuefile + 1), filename ); } else psz_vcdfile = strdup( filename ); msg_Dbg( p_this,"using vcd image file: %s", psz_vcdfile ); p_vcddev->i_vcdimage_handle = vlc_open( psz_vcdfile, O_RDONLY | O_NONBLOCK | O_BINARY ); } b_found = true; default: break; } } if( p_vcddev->i_vcdimage_handle == -1) goto error; /* Try to parse the i_tracks and p_sectors info so we can just forget//.........这里部分代码省略.........
开发者ID:Geal,项目名称:vlc,代码行数:101,
示例22: WriteCatalogstatic int WriteCatalog( addons_storage_t *p_storage, addon_entry_t **pp_entries, int i_entries ){ addon_entry_t *p_entry; char *psz_file; char *psz_file_tmp; char *psz_tempstring; char *psz_userdir = config_GetUserDir( VLC_DATA_DIR ); if ( !psz_userdir ) return VLC_ENOMEM; if ( asprintf( &psz_file, "%s%s", psz_userdir, ADDONS_CATALOG ) < 1 ) { free( psz_userdir ); return VLC_ENOMEM; } free( psz_userdir ); if ( asprintf( &psz_file_tmp, "%s.tmp%"PRIu32, psz_file, (uint32_t)getpid() ) < 1 ) { free( psz_file ); return VLC_ENOMEM; } char *psz_path = strdup( psz_file ); if ( !psz_path ) { free( psz_file ); free( psz_file_tmp ); return VLC_ENOMEM; } char *psz_buf = strrchr( psz_path, DIR_SEP_CHAR ); if( psz_buf ) { *++psz_buf = '/0'; /* ensure directory exists */ if( !EMPTY_STR( psz_path ) ) recursive_mkdir( VLC_OBJECT(p_storage), psz_path ); } free( psz_path ); FILE *p_catalog = vlc_fopen( psz_file_tmp, "wt" ); if ( !p_catalog ) { free( psz_file ); free( psz_file_tmp ); return VLC_EGENERIC; } /* write XML header */ fprintf( p_catalog, "<?xml version=/"1.0/" encoding=/"UTF-8/"?>/n" ); fprintf( p_catalog, "<videolan xmlns=/"http://videolan.org/ns/vlc/addons/1.0/">/n" ); fprintf( p_catalog, "/t<addons>/n" ); for ( int i=0; i<i_entries; i++ ) { p_entry = pp_entries[i]; vlc_mutex_lock( &p_entry->lock ); psz_tempstring = NULL; if ( ( p_entry->e_state != ADDON_INSTALLED ) || !( p_entry->e_flags & ADDON_MANAGEABLE ) ) { vlc_mutex_unlock( &p_entry->lock ); continue; } if ( p_entry->psz_source_module ) psz_tempstring = vlc_xml_encode( p_entry->psz_source_module ); char *psz_uuid = addons_uuid_to_psz( ( const addon_uuid_t * ) & p_entry->uuid ); fprintf( p_catalog, "/t/t<addon source=/"%s/" type=/"%s/" id=/"%s/" " "downloads=/"%ld/" score=/"%d/"", ( psz_tempstring ) ? psz_tempstring : "", getTypePsz( p_entry->e_type ), psz_uuid, p_entry->i_downloads, p_entry->i_score ); free( psz_uuid ); free( psz_tempstring ); WRITE_WITH_ENTITIES( " version=/"%s/"", p_entry->psz_version ) fprintf( p_catalog, ">/n" ); WRITE_WITH_ENTITIES( "/t/t/t<name>%s</name>/n", p_entry->psz_name ) WRITE_WITH_ENTITIES( "/t/t/t<summary>%s</summary>/n", p_entry->psz_summary ) if ( p_entry->psz_description ) { psz_tempstring = p_entry->psz_description; /* FIXME: do real escaping */ while( ( psz_tempstring = strstr( psz_tempstring, "]]>" ) ) ) *psz_tempstring = ' '; fprintf( p_catalog, "/t/t/t<description><![CDATA[%s]]></description>/n", p_entry->psz_description ); } WRITE_WITH_ENTITIES( "/t/t/t<image>%s</image>/n", p_entry->psz_image_data ) WRITE_WITH_ENTITIES( "/t/t/t<archive>%s</archive>/n", p_entry->psz_archive_uri ) fprintf( p_catalog, "/t/t/t<authorship>/n" ); WRITE_WITH_ENTITIES( "/t/t/t/t<creator>%s</creator>/n", p_entry->psz_author )//.........这里部分代码省略.........
开发者ID:LTNGlobal-opensource,项目名称:vlc-sdi,代码行数:101,
示例23: Open/***************************************************************************** * Open: initialize and create stuff *****************************************************************************/static int Open( vlc_object_t *p_this ){ intf_thread_t *p_intf = (intf_thread_t *)p_this; intf_sys_t *p_sys; char *psz_mode; CONSOLE_INTRO_MSG; msg_Info( p_intf, "using logger." ); /* Allocate instance and initialize some members */ p_sys = p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); if( p_sys == NULL ) return VLC_ENOMEM; p_sys->msg.p_intf = p_intf; p_sys->msg.i_mode = MODE_TEXT; psz_mode = var_InheritString( p_intf, "logmode" ); if( psz_mode ) { if( !strcmp( psz_mode, "text" ) ) ; else if( !strcmp( psz_mode, "html" ) ) { p_sys->msg.i_mode = MODE_HTML; }#ifdef HAVE_SYSLOG_H else if( !strcmp( psz_mode, "syslog" ) ) { p_sys->msg.i_mode = MODE_SYSLOG; }#endif else { msg_Warn( p_intf, "invalid log mode `%s', using `text'", psz_mode ); p_sys->msg.i_mode = MODE_TEXT; } free( psz_mode ); } else { msg_Warn( p_intf, "no log mode specified, using `text'" ); } if( p_sys->msg.i_mode != MODE_SYSLOG ) { char *psz_file = var_InheritString( p_intf, "logfile" ); if( !psz_file ) {#ifdef __APPLE__ char *home = config_GetUserDir(VLC_DOCUMENTS_DIR); if( home == NULL || asprintf( &psz_file, "%s/"LOG_DIR"/%s", home, (p_sys->msg.i_mode == MODE_HTML) ? LOG_FILE_HTML : LOG_FILE_TEXT ) == -1 ) psz_file = NULL; free(home);#else switch( p_sys->msg.i_mode ) { case MODE_HTML: psz_file = strdup( LOG_FILE_HTML ); break; case MODE_TEXT: default: psz_file = strdup( LOG_FILE_TEXT ); break; }#endif msg_Warn( p_intf, "no log filename provided, using `%s'", psz_file ); } /* Open the log file and remove any buffering for the stream */ msg_Dbg( p_intf, "opening logfile `%s'", psz_file ); p_sys->msg.p_file = vlc_fopen( psz_file, "at" ); if( p_sys->msg.p_file == NULL ) { msg_Err( p_intf, "error opening logfile `%s'", psz_file ); free( p_sys ); free( psz_file ); return -1; } setvbuf( p_sys->msg.p_file, NULL, _IONBF, 0 ); free( psz_file ); switch( p_sys->msg.i_mode ) { case MODE_HTML: fputs( HTML_HEADER, p_sys->msg.p_file ); break; case MODE_TEXT: default: fputs( TEXT_HEADER, p_sys->msg.p_file ); break; }//.........这里部分代码省略.........
开发者ID:banketree,项目名称:faplayer,代码行数:101,
示例24: vout_snapshot_SaveImageint vout_snapshot_SaveImage(char **name, int *sequential, const block_t *image, vout_thread_t *p_vout, const vout_snapshot_save_cfg_t *cfg){ /* */ char *filename; DIR *pathdir = vlc_opendir(cfg->path); input_thread_t *input = (input_thread_t*)p_vout->p->input; if (pathdir != NULL) { /* The use specified a directory path */ closedir(pathdir); /* */ char *prefix = NULL; if (cfg->prefix_fmt) prefix = str_format(input, cfg->prefix_fmt); if (prefix) filename_sanitize(prefix); else { prefix = strdup("vlcsnap-"); if (!prefix) goto error; } if (cfg->is_sequential) { for (int num = cfg->sequence; ; num++) { struct stat st; if (asprintf(&filename, "%s" DIR_SEP "%s%05d.%s", cfg->path, prefix, num, cfg->format) < 0) { free(prefix); goto error; } if (vlc_stat(filename, &st)) { *sequential = num; break; } free(filename); } } else { struct timespec ts; struct tm curtime; char buffer[128]; timespec_get(&ts, TIME_UTC); if (localtime_r(&ts.tv_sec, &curtime) == NULL) gmtime_r(&ts.tv_sec, &curtime); if (strftime(buffer, sizeof(buffer), "%Y-%m-%d-%Hh%Mm%Ss", &curtime) == 0) strcpy(buffer, "error"); if (asprintf(&filename, "%s" DIR_SEP "%s%s%03lu.%s", cfg->path, prefix, buffer, ts.tv_nsec / 1000000, cfg->format) < 0) filename = NULL; } free(prefix); } else { /* The user specified a full path name (including file name) */ filename = str_format(input, cfg->path); path_sanitize(filename); } if (!filename) goto error; /* Save the snapshot */ FILE *file = vlc_fopen(filename, "wb"); if (!file) { msg_Err(p_vout, "Failed to open '%s'", filename); free(filename); goto error; } if (fwrite(image->p_buffer, image->i_buffer, 1, file) != 1) { msg_Err(p_vout, "Failed to write to '%s'", filename); fclose(file); free(filename); goto error; } fclose(file); /* */ if (name) *name = filename; else free(filename); return VLC_SUCCESS;error: msg_Err(p_vout, "could not save snapshot"); return VLC_EGENERIC;}
开发者ID:42TheAnswerToLife,项目名称:vlc,代码行数:94,
示例25: Open//.........这里部分代码省略.........#ifdef __ANDROID__ else if( !strcmp( mode, "android" ) ) cb = AndroidPrint;#endif else if( strcmp( mode, "text" ) ) msg_Warn( p_intf, "invalid log mode `%s', using `text'", mode ); free( mode ); }#ifdef HAVE_SYSLOG_H if( cb == SyslogPrint ) { int i_facility; char *psz_facility = var_InheritString( p_intf, "syslog-facility" ); if( psz_facility ) { bool b_valid = 0; for( size_t i = 0; i < fac_entries; ++i ) { if( !strcmp( psz_facility, fac_name[i] ) ) { i_facility = fac_number[i]; b_valid = 1; break; } } if( !b_valid ) { msg_Warn( p_intf, "invalid syslog facility `%s', using `%s'", psz_facility, fac_name[0] ); i_facility = fac_number[0]; } free( psz_facility ); } else { msg_Warn( p_intf, "no syslog facility specified, using `%s'", fac_name[0] ); i_facility = fac_number[0]; } char *psz_syslog_ident = var_InheritString( p_intf, "syslog-ident" ); if (unlikely(psz_syslog_ident == NULL)) { free( p_sys ); return VLC_ENOMEM; } p_sys->ident = psz_syslog_ident; openlog( p_sys->ident, LOG_PID|LOG_NDELAY, i_facility ); p_sys->p_file = NULL; } else#endif#ifdef __ANDROID__ if( cb == AndroidPrint ) { /* nothing to do */ } else#endif { char *psz_file = var_InheritString( p_intf, "logfile" ); if( !psz_file ) {#ifdef __APPLE__# define LOG_DIR "Library/Logs" char *home = config_GetUserDir(VLC_HOME_DIR); if( home == NULL || asprintf( &psz_file, "%s/"LOG_DIR"/%s", home, filename ) == -1 ) psz_file = NULL; free(home); filename = psz_file;#endif msg_Warn( p_intf, "no log filename provided, using `%s'", filename ); } else filename = psz_file; /* Open the log file and remove any buffering for the stream */ msg_Dbg( p_intf, "opening logfile `%s'", filename ); p_sys->p_file = vlc_fopen( filename, "at" ); if( p_sys->p_file == NULL ) { msg_Err( p_intf, "error opening logfile `%s': %m", filename ); free( psz_file ); free( p_sys ); return VLC_EGENERIC; } free( psz_file ); setvbuf( p_sys->p_file, NULL, _IONBF, 0 ); fputs( header, p_sys->p_file ); } vlc_LogSet( p_intf->p_libvlc, cb, p_intf ); return VLC_SUCCESS;}
开发者ID:nunoneto,项目名称:vlc,代码行数:101,
示例26: Retrievestatic int Retrieve( addons_finder_t *p_finder, addon_entry_t *p_entry ){ if ( !p_entry->psz_archive_uri ) return VLC_EGENERIC; /* get archive and parse manifest */ stream_t *p_stream; if ( p_entry->psz_archive_uri[0] == '/' ) { /* Relative path */ char *psz_uri; if ( ! asprintf( &psz_uri, ADDONS_REPO_SCHEMEHOST"%s", p_entry->psz_archive_uri ) ) return VLC_ENOMEM; p_stream = stream_UrlNew( p_finder, psz_uri ); free( psz_uri ); } else { p_stream = stream_UrlNew( p_finder, p_entry->psz_archive_uri ); } msg_Dbg( p_finder, "downloading archive %s", p_entry->psz_archive_uri ); if ( !p_stream ) return VLC_EGENERIC; /* In case of pf_ reuse */ if ( p_finder->p_sys->psz_tempfile ) { vlc_unlink( p_finder->p_sys->psz_tempfile ); FREENULL( p_finder->p_sys->psz_tempfile ); } p_finder->p_sys->psz_tempfile = tempnam( NULL, "vlp" ); if ( !p_finder->p_sys->psz_tempfile ) { msg_Err( p_finder, "Can't create temp storage file" ); stream_Delete( p_stream ); return VLC_EGENERIC; } FILE *p_destfile = vlc_fopen( p_finder->p_sys->psz_tempfile, "w" ); if( !p_destfile ) { msg_Err( p_finder, "Failed to open addon temp storage file" ); FREENULL(p_finder->p_sys->psz_tempfile); stream_Delete( p_stream ); return VLC_EGENERIC; } char buffer[1<<10]; int i_read = 0; while ( ( i_read = stream_Read( p_stream, &buffer, 1<<10 ) ) ) { if ( fwrite( &buffer, i_read, 1, p_destfile ) < 1 ) { msg_Err( p_finder, "Failed to write to Addon file" ); fclose( p_destfile ); stream_Delete( p_stream ); return VLC_EGENERIC; } } fclose( p_destfile ); stream_Delete( p_stream ); msg_Dbg( p_finder, "Reading manifest from %s", p_finder->p_sys->psz_tempfile ); char *psz_manifest; if ( asprintf( &psz_manifest, "unzip://%s!/manifest.xml", p_finder->p_sys->psz_tempfile ) < 1 ) return VLC_ENOMEM; p_stream = stream_UrlNew( p_finder, psz_manifest ); free( psz_manifest ); int i_ret = ( ParseManifest( p_finder, p_entry, p_finder->p_sys->psz_tempfile, p_stream ) > 0 ) ? VLC_SUCCESS : VLC_EGENERIC; stream_Delete( p_stream ); return i_ret;}
开发者ID:sorbits,项目名称:vlc,代码行数:82,
示例27: playlist_SaveArtint playlist_SaveArt( vlc_object_t *obj, input_item_t *p_item, const void *data, size_t length, const char *psz_type ){ char *psz_filename = ArtCacheName( p_item, psz_type ); if( !psz_filename ) return VLC_EGENERIC; char *psz_uri = vlc_path2uri( psz_filename, "file" ); if( !psz_uri ) { free( psz_filename ); return VLC_EGENERIC; } /* Check if we already dumped it */ struct stat s; if( !vlc_stat( psz_filename, &s ) ) { input_item_SetArtURL( p_item, psz_uri ); free( psz_filename ); free( psz_uri ); return VLC_SUCCESS; } /* Dump it otherwise */ FILE *f = vlc_fopen( psz_filename, "wb" ); if( f ) { if( fwrite( data, 1, length, f ) != length ) { msg_Err( obj, "%s: %s", psz_filename, vlc_strerror_c(errno) ); } else { msg_Dbg( obj, "album art saved to %s", psz_filename ); input_item_SetArtURL( p_item, psz_uri ); } fclose( f ); } free( psz_uri ); /* save uid info */ char *uid = input_item_GetInfo( p_item, "uid", "md5" ); if ( ! *uid ) { free( uid ); goto end; } char *psz_byuiddir = GetDirByItemUIDs( uid ); char *psz_byuidfile = GetFileByItemUID( psz_byuiddir, "arturl" ); ArtCacheCreateDir( psz_byuiddir ); free( psz_byuiddir ); if ( psz_byuidfile ) { f = vlc_fopen( psz_byuidfile, "wb" ); if ( f ) { if( fputs( "file://", f ) < 0 || fputs( psz_filename, f ) < 0 ) msg_Err( obj, "Error writing %s: %s", psz_byuidfile, vlc_strerror_c(errno) ); fclose( f ); } free( psz_byuidfile ); } free( uid ); /* !save uid info */end: free( psz_filename ); return VLC_SUCCESS;}
开发者ID:IAPark,项目名称:vlc,代码行数:73,
示例28: config_GetConfigFilestatic FILE *config_OpenConfigFile( vlc_object_t *p_obj ){ char *psz_filename = config_GetConfigFile( p_obj ); if( psz_filename == NULL ) return NULL; msg_Dbg( p_obj, "opening config file (%s)", psz_filename ); FILE *p_stream = vlc_fopen( psz_filename, "rt" ); if( p_stream == NULL && errno != ENOENT ) { msg_Err( p_obj, "cannot open config file (%s): %m", psz_filename ); }#if !( defined(WIN32) || defined(__APPLE__) ) else if( p_stream == NULL && errno == ENOENT ) { /* This is the fallback for pre XDG Base Directory * Specification configs */ char *home = config_GetUserDir(VLC_HOME_DIR); char *psz_old; if( home != NULL && asprintf( &psz_old, "%s/.vlc/" CONFIG_FILE, home ) != -1 ) { p_stream = vlc_fopen( psz_old, "rt" ); if( p_stream ) { /* Old config file found. We want to write it at the * new location now. */ msg_Info( p_obj->p_libvlc, "Found old config file at %s. " "VLC will now use %s.", psz_old, psz_filename ); char *psz_readme; if( asprintf(&psz_readme,"%s/.vlc/README", home ) != -1 ) { FILE *p_readme = vlc_fopen( psz_readme, "wt" ); if( p_readme ) { fprintf( p_readme, "The VLC media player " "configuration folder has moved to comply/n" "with the XDG Base Directory Specification " "version 0.6. Your/nconfiguration has been " "copied to the new location:/n%s/nYou can " "delete this directory and all its contents.", psz_filename); fclose( p_readme ); } free( psz_readme ); } /* Remove the old configuration file so that --reset-config * can work properly. Fortunately, Linux allows removing * open files - with most filesystems. */ unlink( psz_old ); } free( psz_old ); } free( home ); }#endif free( psz_filename ); return p_stream;}
开发者ID:banketree,项目名称:faplayer,代码行数:65,
示例29: libvlc_InternalInit//.........这里部分代码省略......... /*xgettext: Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */ msg_Dbg( p_libvlc, "translation test: code is /"%s/"", _("C") ); if (config_PrintHelp (VLC_OBJECT(p_libvlc))) { module_EndBank (true); exit(0); } if( module_count <= 1 ) { msg_Err( p_libvlc, "No plugins found! Check your VLC installation."); vlc_LogDeinit (p_libvlc); module_EndBank (true); return VLC_ENOMOD; }#ifdef HAVE_DAEMON /* Check for daemon mode */ if( var_InheritBool( p_libvlc, "daemon" ) ) { if( daemon( 1, 0) != 0 ) { msg_Err( p_libvlc, "Unable to fork vlc to daemon mode" ); vlc_LogDeinit (p_libvlc); module_EndBank (true); return VLC_ENOMEM; } /* lets check if we need to write the pidfile */ char *pidfile = var_InheritString( p_libvlc, "pidfile" ); if( pidfile != NULL ) { FILE *stream = vlc_fopen( pidfile, "w" ); if( stream != NULL ) { fprintf( stream, "%d", (int)getpid() ); fclose( stream ); msg_Dbg( p_libvlc, "written PID file %s", pidfile ); } else msg_Err( p_libvlc, "cannot write PID file %s: %s", pidfile, vlc_strerror_c(errno) ); free( pidfile ); } } else { var_Create( p_libvlc, "pidfile", VLC_VAR_STRING ); var_SetString( p_libvlc, "pidfile", "" ); }#endif/* FIXME: could be replaced by using Unix sockets */#ifdef HAVE_DBUS#define MPRIS_APPEND "/org/mpris/MediaPlayer2/TrackList/Append"#define MPRIS_BUS_NAME "org.mpris.MediaPlayer2.vlc"#define MPRIS_OBJECT_PATH "/org/mpris/MediaPlayer2"#define MPRIS_TRACKLIST_INTERFACE "org.mpris.MediaPlayer2.TrackList" if( var_InheritBool( p_libvlc, "one-instance" ) || ( var_InheritBool( p_libvlc, "one-instance-when-started-from-file" ) && var_InheritBool( p_libvlc, "started-from-file" ) ) ) { for( int i = vlc_optind; i < i_argc; i++ )
开发者ID:LTNGlobal-opensource,项目名称:vlc-sdi,代码行数:67,
注:本文中的vlc_fopen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vlc_fourcc_GetCodec函数代码示例 C++ vlc_event_send函数代码示例 |