[vlc-devel] [PATCH 1/2] input: export the GuessType function to the modules
Ludovic Fauvet
etix at videolan.org
Mon Nov 28 12:16:45 CET 2011
---
include/vlc_input_item.h | 5 +++++
src/input/item.c | 10 ++++------
src/libvlccore.sym | 1 +
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 6869572..fc14bc5 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -268,6 +268,11 @@ VLC_API input_item_t * input_item_NewExt( const char *psz_uri, const char *psz_n
VLC_API input_item_t * input_item_Copy(input_item_t * ) VLC_USED;
+/**
+ * This function returns the type of the mrl based on its scheme.
+ */
+VLC_API int input_item_GuessType( const char *psz_uri ) VLC_USED;
+
/******************
* Input stats
******************/
diff --git a/src/input/item.c b/src/input/item.c
index 608a996..cc1b623 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -37,8 +37,6 @@
#include "item.h"
#include "info.h"
-static int GuessType( const input_item_t *p_item );
-
static inline void input_item_Clean( input_item_t *p_i )
{
int i;
@@ -340,7 +338,7 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri )
free( p_i->psz_uri );
p_i->psz_uri = strdup( psz_uri );
- p_i->i_type = GuessType( p_i );
+ p_i->i_type = input_item_GuessType( p_i->psz_uri );
if( p_i->psz_name )
;
@@ -906,7 +904,7 @@ static int typecmp( const void *key, const void *entry )
}
/* Guess the type of the item using the beginning of the mrl */
-static int GuessType( const input_item_t *p_item )
+int input_item_GuessType( const char *psz_uri )
{
static const struct item_type_entry tab[] =
{ /* /!\ Alphabetical order /!\ */
@@ -965,10 +963,10 @@ static int GuessType( const input_item_t *p_item )
};
const struct item_type_entry *e;
- if( !strstr( p_item->psz_uri, "://" ) )
+ if( !strstr( psz_uri, "://" ) )
return ITEM_TYPE_FILE;
- e = bsearch( p_item->psz_uri, tab, sizeof( tab ) / sizeof( tab[0] ),
+ e = bsearch( psz_uri, tab, sizeof( tab ) / sizeof( tab[0] ),
sizeof( tab[0] ), typecmp );
return e ? e->i_type : ITEM_TYPE_FILE;
}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 7538bf2..92ad257 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -201,6 +201,7 @@ input_item_GetMeta
input_item_GetName
input_item_GetTitleFbName
input_item_GetURI
+input_item_GuessType
input_item_HasErrorWhenReading
input_item_IsArtFetched
input_item_IsPreparsed
--
1.7.7.4
More information about the vlc-devel
mailing list