Commit cbc8fb03 authored by Clément Stenac's avatar Clément Stenac

Add a input_Read function that reads a stream in blocking or non-blocking mode...

Add a input_Read function that reads a stream in blocking or non-blocking mode and cleans-up (Closes:#244)

Still needs to be exported, but needs some thinking for pause/stop handling
parent 8d65083c
...@@ -411,6 +411,9 @@ struct input_thread_t ...@@ -411,6 +411,9 @@ struct input_thread_t
VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item_t * ) ); VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item_t * ) );
#define input_Preparse(a,b) __input_Preparse(VLC_OBJECT(a),b) #define input_Preparse(a,b) __input_Preparse(VLC_OBJECT(a),b)
VLC_EXPORT( int, __input_Preparse, ( vlc_object_t *, input_item_t * ) ); VLC_EXPORT( int, __input_Preparse, ( vlc_object_t *, input_item_t * ) );
#define input_Read(a,b,c) __input_Read(VLC_OBJECT(a),b, c)
VLC_EXPORT( void, __input_Read, ( vlc_object_t *, input_item_t *, vlc_bool_t ) );
VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) ); VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
VLC_EXPORT( void, input_DestroyThread, ( input_thread_t * ) ); VLC_EXPORT( void, input_DestroyThread, ( input_thread_t * ) );
......
...@@ -263,6 +263,7 @@ int net_Printf (vlc_object_t *p_this, int fd, v_socket_t *, const char *psz_fmt, ...@@ -263,6 +263,7 @@ int net_Printf (vlc_object_t *p_this, int fd, v_socket_t *, const char *psz_fmt,
int __vlc_thread_set_priority (vlc_object_t *, char *, int, int); int __vlc_thread_set_priority (vlc_object_t *, char *, int, int);
int ACL_LoadFile (vlc_acl_t *p_acl, const char *path); int ACL_LoadFile (vlc_acl_t *p_acl, const char *path);
void input_StopThread (input_thread_t *); void input_StopThread (input_thread_t *);
void __input_Read (vlc_object_t *, input_item_t *, vlc_bool_t);
intf_thread_t * __intf_Create (vlc_object_t *, const char *); intf_thread_t * __intf_Create (vlc_object_t *, const char *);
void aout_ChannelReorder (uint8_t *, int, int, const int *, int); void aout_ChannelReorder (uint8_t *, int, int, const int *, int);
int __var_DelCallback (vlc_object_t *, const char *, vlc_callback_t, void *); int __var_DelCallback (vlc_object_t *, const char *, vlc_callback_t, void *);
...@@ -847,6 +848,7 @@ struct module_symbols_t ...@@ -847,6 +848,7 @@ struct module_symbols_t
int (*osd_ShowTextAbsolute_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); int (*osd_ShowTextAbsolute_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t);
char * (*config_GetUserDir_inner) (void); char * (*config_GetUserDir_inner) (void);
char * (*FromUTF32_inner) (const wchar_t *); char * (*FromUTF32_inner) (const wchar_t *);
void (*__input_Read_inner) (vlc_object_t *, input_item_t *, vlc_bool_t);
}; };
# if defined (__PLUGIN__) # if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner # define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...@@ -1256,6 +1258,7 @@ struct module_symbols_t ...@@ -1256,6 +1258,7 @@ struct module_symbols_t
# define osd_ShowTextAbsolute (p_symbols)->osd_ShowTextAbsolute_inner # define osd_ShowTextAbsolute (p_symbols)->osd_ShowTextAbsolute_inner
# define config_GetUserDir (p_symbols)->config_GetUserDir_inner # define config_GetUserDir (p_symbols)->config_GetUserDir_inner
# define FromUTF32 (p_symbols)->FromUTF32_inner # define FromUTF32 (p_symbols)->FromUTF32_inner
# define __input_Read (p_symbols)->__input_Read_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/****************************************************************** /******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access. * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...@@ -1668,6 +1671,7 @@ struct module_symbols_t ...@@ -1668,6 +1671,7 @@ struct module_symbols_t
((p_symbols)->osd_ShowTextAbsolute_inner) = osd_ShowTextAbsolute; \ ((p_symbols)->osd_ShowTextAbsolute_inner) = osd_ShowTextAbsolute; \
((p_symbols)->config_GetUserDir_inner) = config_GetUserDir; \ ((p_symbols)->config_GetUserDir_inner) = config_GetUserDir; \
((p_symbols)->FromUTF32_inner) = FromUTF32; \ ((p_symbols)->FromUTF32_inner) = FromUTF32; \
((p_symbols)->__input_Read_inner) = __input_Read; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \ (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
# endif /* __PLUGIN__ */ # endif /* __PLUGIN__ */
......
This diff is collapsed.
...@@ -1219,7 +1219,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, ...@@ -1219,7 +1219,7 @@ int VLC_AddTarget( int i_object, char const *psz_target,
} }
/***************************************************************************** /*****************************************************************************
* VLC_Play: play * VLC_Play: play the playlist
*****************************************************************************/ *****************************************************************************/
int VLC_Play( int i_object ) int VLC_Play( int i_object )
{ {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#define TITLE_ALL N_( "All items, unsorted" ) #define TITLE_ALL N_( "All items, unsorted" )
#undef PLAYLIST_PROFILE #undef PLAYLIST_PROFILE
#undef PLAYLIST_DEBUG #define PLAYLIST_DEBUG 1
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -364,8 +364,8 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args ) ...@@ -364,8 +364,8 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args )
i_view = (int)va_arg( args,int ); i_view = (int)va_arg( args,int );
p_node = (playlist_item_t *)va_arg( args, playlist_item_t * ); p_node = (playlist_item_t *)va_arg( args, playlist_item_t * );
p_item = (playlist_item_t *)va_arg( args, playlist_item_t * ); p_item = (playlist_item_t *)va_arg( args, playlist_item_t * );
if ( p_node == NULL || (p_item != NULL && p_item->input.psz_uri if ( p_node == NULL ) //|| (p_item != NULL && p_item->input.psz_uri
== NULL )) // == NULL ))
{ {
p_playlist->status.i_status = PLAYLIST_STOPPED; p_playlist->status.i_status = PLAYLIST_STOPPED;
p_playlist->request.b_request = VLC_TRUE; p_playlist->request.b_request = VLC_TRUE;
...@@ -378,10 +378,8 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args ) ...@@ -378,10 +378,8 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args )
p_playlist->request.p_node = p_node; p_playlist->request.p_node = p_node;
p_playlist->request.p_item = p_item; p_playlist->request.p_item = p_item;
/* If we select a node, play only it. /* Don't go further if the node doesn't want to */
* If we select an item, continue */ if( ! p_playlist->request.p_node->i_flags & PLAYLIST_SKIP_FLAG )
if( p_playlist->request.p_item == NULL ||
! p_playlist->request.p_node->i_flags & PLAYLIST_SKIP_FLAG )
{ {
p_playlist->b_go_next = VLC_FALSE; p_playlist->b_go_next = VLC_FALSE;
} }
...@@ -468,7 +466,7 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args ) ...@@ -468,7 +466,7 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args )
break; break;
default: default:
msg_Err( p_playlist, "unimplemented playlist query" ); msg_Err( p_playlist, "unknown playlist query" );
return VLC_EBADVAR; return VLC_EBADVAR;
break; break;
} }
...@@ -680,7 +678,6 @@ static void RunThread ( playlist_t *p_playlist ) ...@@ -680,7 +678,6 @@ static void RunThread ( playlist_t *p_playlist )
* Get the next item to play */ * Get the next item to play */
p_item = NextItem( p_playlist ); p_item = NextItem( p_playlist );
/* We must stop */ /* We must stop */
if( p_item == NULL ) if( p_item == NULL )
{ {
...@@ -899,7 +896,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -899,7 +896,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
/* TODO: use the "shuffled view" internally ? */ /* TODO: use the "shuffled view" internally ? */
/* Random case. This is an exception: if request, but request is skip +- 1 /* Random case. This is an exception: if request, but request is skip +- 1
* we don't go to next item but select a new random one. */ * we don't go to next item but select a new random one. */
if( b_random && if( b_random &&
( !p_playlist->request.b_request || ( !p_playlist->request.b_request ||
( p_playlist->request.b_request && ( p_playlist->request.p_item == NULL || ( p_playlist->request.b_request && ( p_playlist->request.p_item == NULL ||
p_playlist->request.i_skip == 1 || p_playlist->request.i_skip == -1 ) ) ) ) p_playlist->request.i_skip == 1 || p_playlist->request.i_skip == -1 ) ) ) )
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "vlc_playlist.h" #include "vlc_playlist.h"
#undef PLAYLIST_DEBUG #define PLAYLIST_DEBUG 1
/************************************************************************ /************************************************************************
* Local prototypes * Local prototypes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment