* demux, access: change the prototype of access2_New/demux2_New.
* control: implemented all INPUT_GET/SET.
* src/input/*.c: removed old functions, move some of them.
count_t c_packets_trashed; /* trashed packets */
};
-/*****************************************************************************
- * stream_position_t
- *****************************************************************************
- * Describes the current position in the stream.
- *****************************************************************************/
-struct stream_position_t
-{
- off_t i_tell; /* actual location in the area (in arbitrary units) */
- off_t i_size; /* total size of the area (in arbitrary units) */
-
- uint32_t i_mux_rate; /* the rate we read the stream (in
- * units of 50 bytes/s) ; 0 if undef */
-};
-
#define MUTE_NO_CHANGE -1
/*****************************************************************************
VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
VLC_EXPORT( void, input_DestroyThread, ( input_thread_t * ) );
-#define input_SetStatus(a,b) __input_SetStatus(VLC_OBJECT(a),b)
-VLC_EXPORT( void, __input_SetStatus, ( vlc_object_t *, int ) );
-
-#define input_SetRate(a,b) __input_SetRate(VLC_OBJECT(a),b)
-VLC_EXPORT( void, __input_SetRate, ( vlc_object_t *, int ) );
-
-#define input_Seek(a,b,c) __input_Seek(VLC_OBJECT(a),b,c)
-VLC_EXPORT( void, __input_Seek, ( vlc_object_t *, off_t, int ) );
-
-#define input_Tell(a,b) __input_Tell(VLC_OBJECT(a),b)
-VLC_EXPORT( void, __input_Tell, ( vlc_object_t *, stream_position_t * ) );
-
-VLC_EXPORT( void, input_DumpStream, ( input_thread_t * ) );
VLC_EXPORT( char *, input_OffsetToTime, ( input_thread_t *, char *, off_t ) );
VLC_EXPORT( int, input_ToggleES, ( input_thread_t *, es_descriptor_t *, vlc_bool_t ) );
VLC_EXPORT( int, input_ChangeArea, ( input_thread_t *, input_area_t * ) );
VLC_EXPORT( int, input_ChangeProgram, ( input_thread_t *, uint16_t ) );
-int input_ToggleGrayscale( input_thread_t * );
-int input_ToggleMute ( input_thread_t * );
-
#endif /* "input_ext-intf.h" */
access_sys_t *p_sys;
};
-#define access2_New( a, b ) __access2_New(VLC_OBJECT(a), b )
-VLC_EXPORT( access_t *, __access2_New, ( vlc_object_t *p_obj, char *psz_mrl ) );
+#define access2_New( a, b, c, d ) __access2_New(VLC_OBJECT(a), b, c, d )
+VLC_EXPORT( access_t *, __access2_New, ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path ) );
VLC_EXPORT( void, access2_Delete, ( access_t * ) );
static inline int access2_vaControl( access_t *p_access, int i_query, va_list args )
/* stream_t *s could be null and then it mean a access+demux in one */
-#define demux2_New( a, b, c, d ) __demux2_New(VLC_OBJECT(a), b, c, d)
-VLC_EXPORT( demux_t *, __demux2_New, ( vlc_object_t *p_obj, char *psz_mrl, stream_t *s, es_out_t *out ) );
+#define demux2_New( a, b, c, d, e, f ) __demux2_New(VLC_OBJECT(a),b,c,d,e,f)
+VLC_EXPORT( demux_t *, __demux2_New, ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path, stream_t *s, es_out_t *out ) );
VLC_EXPORT( void, demux2_Delete, ( demux_t * ) );
VLC_EXPORT( int, demux2_vaControlHelper, ( stream_t *, int64_t i_start, int64_t i_end, int i_bitrate, int i_align, int i_query, va_list args ) );
*/
enum input_query_e
{
+ /* input variable "position" */
INPUT_GET_POSITION, /* arg1= double * res= */
INPUT_SET_POSITION, /* arg1= double res=can fail */
+ /* input variable "length" */
+ INPUT_GET_LENGTH, /* arg1= int64_t * res=can fail */
+
+ /* input variable "time" */
INPUT_GET_TIME, /* arg1= int64_t * res= */
INPUT_SET_TIME, /* arg1= int64_t res=can fail */
- INPUT_GET_LENGTH, /* arg1= int64_t * res=can fail */
+ /* input variable "rate" (1 is DEFAULT_RATE) */
+ INPUT_GET_RATE, /* arg1= int * res= */
+ INPUT_SET_RATE, /* arg1= int res=can fail */
+
+ /* input variable "state" */
+ INPUT_GET_STATE, /* arg1= int * res= */
+ INPUT_SET_STATE, /* arg1= int res=can fail */
- INPUT_GET_FPS, /* arg1= float * res=can fail */
- INPUT_GET_META, /* arg1= vlc_meta_t ** res=can fail */
+ /* bookmarks */
INPUT_GET_BOOKMARKS, /* arg1= seekpoint_t *** arg2= int * res=can fail */
INPUT_CLEAR_BOOKMARKS, /* res=can fail */
INPUT_ADD_BOOKMARK, /* arg1= seekpoint_t * res=can fail */
INPUT_ADD_OPTION, /* arg1= char * arg2= char * res=can fail */
+ /* */
INPUT_ADD_INFO, /* arg1= char * arg2= char * arg3=... res=can fail */
INPUT_GET_INFO, /* arg1= char * arg2= char * arg3= char ** res=can fail*/
INPUT_SET_NAME, /* arg1= char * res=can fail */
+ /* */
INPUT_GET_SUBDELAY, /* arg1 = int* res=can fail */
INPUT_SET_SUBDELAY, /* arg1 = int res=can fail */
-
- INPUT_GET_DIVISIONS
};
VLC_EXPORT( int, input_vaControl,( input_thread_t *, int i_query, va_list ) );
/* Misc */
typedef struct data_packet_t data_packet_t;
typedef struct data_buffer_t data_buffer_t;
-typedef struct stream_position_t stream_position_t;
typedef struct stream_ctrl_t stream_ctrl_t;
typedef struct pes_packet_t pes_packet_t;
typedef struct network_socket_t network_socket_t;
/*****************************************************************************
* access2_New:
*****************************************************************************/
-access_t *__access2_New( vlc_object_t *p_obj, char *psz_mrl )
+access_t *__access2_New( vlc_object_t *p_obj,
+ char *psz_access, char *psz_demux, char *psz_path )
{
access_t *p_access = vlc_object_create( p_obj, VLC_OBJECT_ACCESS );
- char *psz_dup = strdup( psz_mrl ? psz_mrl : "" );
- char *psz = strchr( psz_dup, ':' );
-
if( p_access == NULL )
{
- msg_Err( p_obj, "vlc_object_create( p_obj, VLC_OBJECT_ACCESS ) had failed" );
- free( psz_dup );
+ msg_Err( p_obj, "vlc_object_create( p_obj, VLC_OBJECT_ACCESS ) failed" );
return NULL;
}
/* Parse URL */
- p_access->psz_access = NULL;
- p_access->psz_path = NULL;
-
- if( psz )
- {
- *psz++ = '\0';
-
- if( psz[0] == '/' && psz[1] == '/' )
- {
- psz += 2;
- }
- p_access->psz_path = strdup( psz );
-
- psz = strchr( psz_dup, '/' );
- if( psz )
- {
- *psz++ = '\0';
- }
- p_access->psz_access = strdup( psz_dup );
- }
- else
- {
- p_access->psz_path = strdup( psz_mrl );
- }
- free( psz_dup );
+ p_access->psz_access = strdup( psz_access );
+ p_access->psz_path = strdup( psz_path );
+ p_access->psz_demux = strdup( "" );
-
- p_access->psz_demux = strdup( "" );
- if( p_access->psz_access == NULL )
- {
- p_access->psz_access = strdup( "" );
- }
- if( p_access->psz_path == NULL )
- {
- p_access->psz_path = strdup( "" );
- }
- msg_Dbg( p_obj, "access2_New: '%s' -> access='%s' path='%s'",
- psz_mrl,
+ msg_Dbg( p_obj, "access2_New: access='%s' path='%s'",
p_access->psz_access, p_access->psz_path );
p_access->pf_read = NULL;
int i, *pi;
vlc_value_t val, text;
char *psz_option, *psz_value;
+ int i_int, *pi_int;
+ double f, *pf;
+ int64_t i_64, *pi_64;
vlc_mutex_lock( &p_input->stream.stream_lock );
switch( i_query )
{
+ case INPUT_GET_POSITION:
+ pf = (double*)va_arg( args, double * );
+ *pf = var_GetFloat( p_input, "position" );
+ i_ret = VLC_SUCCESS;
+ break;
+ case INPUT_SET_POSITION:
+ f = (double)va_arg( args, double );
+ i_ret = var_SetFloat( p_input, "position", f );
+ break;
+
+ case INPUT_GET_LENGTH:
+ pi_64 = (int64_t*)va_arg( args, int64_t * );
+ *pi_64 = var_GetTime( p_input, "length" );
+ i_ret = VLC_SUCCESS;
+ break;
+ case INPUT_GET_TIME:
+ pi_64 = (int64_t*)va_arg( args, int64_t * );
+ *pi_64 = var_GetTime( p_input, "time" );
+ i_ret = VLC_SUCCESS;
+ break;
+ case INPUT_SET_TIME:
+ i_64 = (int64_t)va_arg( args, int64_t );
+ i_ret = var_SetTime( p_input, "time", i_64 );
+ break;
+
+ case INPUT_GET_RATE:
+ pi_int = (int*)va_arg( args, int * );
+ *pi_int = var_GetInteger( p_input, "rate" );
+ i_ret = VLC_SUCCESS;
+ break;
+ case INPUT_SET_RATE:
+ i_int = (int)va_arg( args, int );
+ i_ret = var_SetInteger( p_input, "rate", i_int );
+ break;
+
+ case INPUT_GET_STATE:
+ pi_int = (int*)va_arg( args, int * );
+ *pi_int = var_GetInteger( p_input, "state" );
+ i_ret = VLC_SUCCESS;
+ break;
+ case INPUT_SET_STATE:
+ i_int = (int)va_arg( args, int );
+ i_ret = var_SetInteger( p_input, "state", i_int );
+ break;
+
case INPUT_ADD_OPTION:
{
psz_option = (char *)va_arg( args, char * );
* demux2_New:
*****************************************************************************/
demux_t *__demux2_New( vlc_object_t *p_obj,
- char *psz_mrl, stream_t *s, es_out_t *out )
+ char *psz_access, char *psz_demux, char *psz_path,
+ stream_t *s, es_out_t *out )
{
demux_t *p_demux = vlc_object_create( p_obj, VLC_OBJECT_DEMUX );
-
- char *psz_dup = strdup( psz_mrl ? psz_mrl : "" );
- char *psz = strchr( psz_dup, ':' );
- char *psz_module;
+ char *psz_module;
if( p_demux == NULL )
{
- free( psz_dup );
return NULL;
}
/* Parse URL */
- p_demux->psz_access = NULL;
- p_demux->psz_demux = NULL;
- p_demux->psz_path = NULL;
-
- if( psz )
- {
- *psz++ = '\0';
-
- if( psz[0] == '/' && psz[1] == '/' )
- {
- psz += 2;
- }
- p_demux->psz_path = strdup( psz );
+ p_demux->psz_access = strdup( psz_access );
+ p_demux->psz_demux = strdup( psz_demux );
+ p_demux->psz_path = strdup( psz_path );
- psz = strchr( psz_dup, '/' );
- if( psz )
- {
- *psz++ = '\0';
- p_demux->psz_demux = strdup( psz );
- }
- p_demux->psz_access = strdup( psz_dup );
- }
- else
- {
- p_demux->psz_path = strdup( psz_mrl );
- }
- free( psz_dup );
-
-
- if( p_demux->psz_access == NULL )
- {
- p_demux->psz_access = strdup( "" );
- }
- if( p_demux->psz_demux == NULL )
- {
- p_demux->psz_demux = strdup( "" );
- }
- if( p_demux->psz_path == NULL )
- {
- p_demux->psz_path = strdup( "" );
- }
- msg_Dbg( p_obj, "demux2_New: '%s' -> access='%s' demux='%s' path='%s'",
- psz_mrl,
+ msg_Dbg( p_obj, "demux2_New: access='%s' demux='%s' path='%s'",
p_demux->psz_access, p_demux->psz_demux, p_demux->psz_path );
p_demux->s = s;
*****************************************************************************/
static void EndThread( input_thread_t * p_input )
{
- int i;
+ int i, j;
#ifdef HAVE_SYS_TIMES_H
/* Display statistics */
struct tms cpu_usage;
msg_Dbg( p_input, "%ld loops", p_input->c_loops );
#endif
- input_DumpStream( p_input );
+
+ /* DumpStream: printf some info for debugging purpose */
+#define S p_input->stream
+ msg_Dbg( p_input, "dumping stream ID 0x%x [OK:%ld/D:%ld]", S.i_stream_id,
+ S.c_packets_read, S.c_packets_trashed );
+ if( S.b_seekable )
+ {
+ char psz_time1[MSTRTIME_MAX_SIZE];
+ char psz_time2[MSTRTIME_MAX_SIZE];
+
+ msg_Dbg( p_input, "seekable stream, position: "I64Fd"/"I64Fd" (%s/%s)",
+ S.p_selected_area->i_tell, S.p_selected_area->i_size,
+ input_OffsetToTime( p_input, psz_time1,
+ S.p_selected_area->i_tell ),
+ input_OffsetToTime( p_input, psz_time2,
+ S.p_selected_area->i_size ) );
+ }
+ else
+ msg_Dbg( p_input, "pace %scontrolled", S.b_pace_control ? "" : "un-" );
+#undef S
+ for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
+ {
+#define P p_input->stream.pp_programs[i]
+ msg_Dbg( p_input, "dumping program 0x%x, version %d (%s)",
+ P->i_number, P->i_version,
+ P->b_is_ok ? "complete" : "partial" );
+#undef P
+ for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
+ {
+#define ES p_input->stream.pp_programs[i]->pp_es[j]
+ msg_Dbg( p_input, "ES 0x%x, "
+ "stream 0x%x, fourcc `%4.4s', %s [OK:%ld/ERR:%ld]",
+ ES->i_id, ES->i_stream_id, (char*)&ES->i_fourcc,
+ ES->p_dec != NULL ? "selected" : "not selected",
+ ES->c_packets, ES->c_invalid_packets );
+#undef ES
+ }
+ }
/* Free demultiplexer's data */
if( p_input->p_demux ) module_Unneed( p_input, p_input->p_demux );
return;
}
+/*****************************************************************************
+ * input_SetStatus: change the reading status
+ *****************************************************************************/
+static void input_SetStatus( input_thread_t *p_input, int i_mode )
+{
+ vlc_mutex_lock( &p_input->stream.stream_lock );
+
+ switch( i_mode )
+ {
+ case INPUT_STATUS_END:
+ p_input->stream.i_new_status = PLAYING_S;
+ p_input->b_eof = 1;
+ msg_Dbg( p_input, "end of stream" );
+ break;
+
+ case INPUT_STATUS_PLAY:
+ p_input->stream.i_new_status = PLAYING_S;
+ msg_Dbg( p_input, "playing at normal rate" );
+ break;
+
+ case INPUT_STATUS_PAUSE:
+ /* XXX: we don't need to check i_status, because input_clock.c
+ * does it for us */
+ p_input->stream.i_new_status = PAUSE_S;
+ msg_Dbg( p_input, "toggling pause" );
+ break;
+
+ case INPUT_STATUS_FASTER:
+ if( p_input->stream.control.i_rate * 4 <= DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "can not play any faster" );
+ }
+ else
+ {
+ p_input->stream.i_new_status = FORWARD_S;
+ p_input->stream.i_new_rate =
+ p_input->stream.control.i_rate / 2;
+
+ if ( p_input->stream.i_new_rate < DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "playing at %i:1 fast forward",
+ DEFAULT_RATE / p_input->stream.i_new_rate );
+ }
+ else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "playing at 1:%i slow motion",
+ p_input->stream.i_new_rate / DEFAULT_RATE );
+ }
+ else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
+ {
+ p_input->stream.i_new_status = PLAYING_S;
+ msg_Dbg( p_input, "playing at normal rate" );
+ }
+ }
+ break;
+
+ case INPUT_STATUS_SLOWER:
+ if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "can not play any slower" );
+ }
+ else
+ {
+ p_input->stream.i_new_status = FORWARD_S;
+ p_input->stream.i_new_rate =
+ p_input->stream.control.i_rate * 2;
+
+ if ( p_input->stream.i_new_rate < DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "playing at %i:1 fast forward",
+ DEFAULT_RATE / p_input->stream.i_new_rate );
+ }
+ else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "playing at 1:%i slow motion",
+ p_input->stream.i_new_rate / DEFAULT_RATE );
+ }
+ else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
+ {
+ p_input->stream.i_new_status = PLAYING_S;
+ msg_Dbg( p_input, "playing at normal rate" );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ vlc_cond_signal( &p_input->stream.stream_wait );
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+}
+/*****************************************************************************
+ * input_SetRate:
+ *****************************************************************************/
+static void input_SetRate( vlc_object_t * p_this, int i_rate )
+{
+ input_thread_t *p_input;
+
+ p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
+
+ if( p_input == NULL )
+ {
+ msg_Err( p_this, "no input found" );
+ return;
+ }
+
+ vlc_mutex_lock( &p_input->stream.stream_lock );
+
+ if( i_rate * 8 < DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "can not play faster than 8x" );
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+ return;
+ }
+ if( i_rate > DEFAULT_RATE * 8 )
+ {
+ msg_Dbg( p_input, "can not play slower than 1/8x" );
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+ return;
+ }
+ p_input->stream.i_new_status = FORWARD_S;
+ p_input->stream.i_new_rate = i_rate;
+
+ if ( p_input->stream.i_new_rate < DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "playing at %i:1 fast forward",
+ DEFAULT_RATE / p_input->stream.i_new_rate );
+ }
+ else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
+ {
+ msg_Dbg( p_input, "playing at 1:%i slow motion",
+ p_input->stream.i_new_rate / DEFAULT_RATE );
+ }
+ else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
+ {
+ p_input->stream.i_new_status = PLAYING_S;
+ msg_Dbg( p_input, "playing at normal rate" );
+ }
+
+ vlc_cond_signal( &p_input->stream.stream_wait );
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+ vlc_object_release( p_input );
+}
+
/*****************************************************************************
* Callbacks (position, time, state, rate )
*****************************************************************************/
* input_ext-intf.c: services to the interface
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
- * $Id: input_ext-intf.c,v 1.56 2004/01/25 17:16:05 zorglub Exp $
+ * $Id$
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
#include "input_ext-intf.h"
#include "input_ext-plugins.h"
-/*****************************************************************************
- * input_SetStatus: change the reading status
- *****************************************************************************/
-void __input_SetStatus( vlc_object_t * p_this, int i_mode )
-{
- input_thread_t *p_input;
-
- p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
- if( p_input == NULL )
- {
- msg_Err( p_this, "no input found" );
- return;
- }
-
- vlc_mutex_lock( &p_input->stream.stream_lock );
-
- switch( i_mode )
- {
- case INPUT_STATUS_END:
- p_input->stream.i_new_status = PLAYING_S;
- p_input->b_eof = 1;
- msg_Dbg( p_input, "end of stream" );
- break;
-
- case INPUT_STATUS_PLAY:
- p_input->stream.i_new_status = PLAYING_S;
- msg_Dbg( p_input, "playing at normal rate" );
- break;
-
- case INPUT_STATUS_PAUSE:
- /* XXX: we don't need to check i_status, because input_clock.c
- * does it for us */
- p_input->stream.i_new_status = PAUSE_S;
- msg_Dbg( p_input, "toggling pause" );
- break;
-
- case INPUT_STATUS_FASTER:
- if( p_input->stream.control.i_rate * 4 <= DEFAULT_RATE )
- {
- msg_Dbg( p_input, "can not play any faster" );
- }
- else
- {
- p_input->stream.i_new_status = FORWARD_S;
- p_input->stream.i_new_rate =
- p_input->stream.control.i_rate / 2;
-
- if ( p_input->stream.i_new_rate < DEFAULT_RATE )
- {
- msg_Dbg( p_input, "playing at %i:1 fast forward",
- DEFAULT_RATE / p_input->stream.i_new_rate );
- }
- else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
- {
- msg_Dbg( p_input, "playing at 1:%i slow motion",
- p_input->stream.i_new_rate / DEFAULT_RATE );
- }
- else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
- {
- p_input->stream.i_new_status = PLAYING_S;
- msg_Dbg( p_input, "playing at normal rate" );
- }
- }
- break;
-
- case INPUT_STATUS_SLOWER:
- if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
- {
- msg_Dbg( p_input, "can not play any slower" );
- }
- else
- {
- p_input->stream.i_new_status = FORWARD_S;
- p_input->stream.i_new_rate =
- p_input->stream.control.i_rate * 2;
-
- if ( p_input->stream.i_new_rate < DEFAULT_RATE )
- {
- msg_Dbg( p_input, "playing at %i:1 fast forward",
- DEFAULT_RATE / p_input->stream.i_new_rate );
- }
- else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
- {
- msg_Dbg( p_input, "playing at 1:%i slow motion",
- p_input->stream.i_new_rate / DEFAULT_RATE );
- }
- else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
- {
- p_input->stream.i_new_status = PLAYING_S;
- msg_Dbg( p_input, "playing at normal rate" );
- }
- }
- break;
-
- default:
- break;
- }
-
- vlc_cond_signal( &p_input->stream.stream_wait );
- vlc_mutex_unlock( &p_input->stream.stream_lock );
-
- vlc_object_release( p_input );
-}
-
-void __input_SetRate( vlc_object_t * p_this, int i_rate )
-{
- input_thread_t *p_input;
-
- p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
- if( p_input == NULL )
- {
- msg_Err( p_this, "no input found" );
- return;
- }
-
- vlc_mutex_lock( &p_input->stream.stream_lock );
-
- if( i_rate * 8 < DEFAULT_RATE )
- {
- msg_Dbg( p_input, "can not play faster than 8x" );
- vlc_mutex_unlock( &p_input->stream.stream_lock );
- return;
- }
- if( i_rate > DEFAULT_RATE * 8 )
- {
- msg_Dbg( p_input, "can not play slower than 1/8x" );
- vlc_mutex_unlock( &p_input->stream.stream_lock );
- return;
- }
- p_input->stream.i_new_status = FORWARD_S;
- p_input->stream.i_new_rate = i_rate;
-
- if ( p_input->stream.i_new_rate < DEFAULT_RATE )
- {
- msg_Dbg( p_input, "playing at %i:1 fast forward",
- DEFAULT_RATE / p_input->stream.i_new_rate );
- }
- else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
- {
- msg_Dbg( p_input, "playing at 1:%i slow motion",
- p_input->stream.i_new_rate / DEFAULT_RATE );
- }
- else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
- {
- p_input->stream.i_new_status = PLAYING_S;
- msg_Dbg( p_input, "playing at normal rate" );
- }
-
- vlc_cond_signal( &p_input->stream.stream_wait );
- vlc_mutex_unlock( &p_input->stream.stream_lock );
-
- vlc_object_release( p_input );
-}
-
-/*****************************************************************************
- * input_Seek: changes the stream postion
- *****************************************************************************/
-void __input_Seek( vlc_object_t * p_this, off_t i_position, int i_whence )
-{
- input_thread_t *p_input;
-
- char psz_time1[MSTRTIME_MAX_SIZE];
- char psz_time2[MSTRTIME_MAX_SIZE];
-
- p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
- if( p_input == NULL )
- {
- msg_Err( p_this, "no input found" );
- return;
- }
-
- vlc_mutex_lock( &p_input->stream.stream_lock );
-
-#define A p_input->stream.p_selected_area
- switch( i_whence & 0x30 )
- {
- case INPUT_SEEK_SECONDS:
- i_position *= (off_t)50 * p_input->stream.i_mux_rate;
- break;
-
- case INPUT_SEEK_PERCENT:
- i_position = A->i_size * i_position / (off_t)100;
- break;
-
- case INPUT_SEEK_BYTES:
- default:
- break;
- }
-
- switch( i_whence & 0x03 )
- {
- case INPUT_SEEK_CUR:
- A->i_seek = A->i_tell + i_position;
- break;
-
- case INPUT_SEEK_END:
- A->i_seek = A->i_size + i_position;
- break;
-
- case INPUT_SEEK_SET:
- default:
- A->i_seek = i_position;
- break;
- }
-
- if( A->i_seek < 0 )
- {
- A->i_seek = 0;
- }
- else if( A->i_seek > A->i_size )
- {
- A->i_seek = A->i_size;
- }
-
- msg_Dbg( p_input, "seeking position "I64Fd"/"I64Fd" (%s/%s)",
- A->i_seek, A->i_size,
- input_OffsetToTime( p_input, psz_time1, i_position ),
- input_OffsetToTime( p_input, psz_time2, A->i_size ) );
-#undef A
-
- vlc_cond_signal( &p_input->stream.stream_wait );
- vlc_mutex_unlock( &p_input->stream.stream_lock );
-
- vlc_object_release( p_input );
-}
-
-/*****************************************************************************
- * input_Tell: requests the stream postion
- *****************************************************************************/
-void __input_Tell( vlc_object_t * p_this, stream_position_t * p_position )
-{
- input_thread_t *p_input;
-
- p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
- if( p_input == NULL )
- {
- p_position->i_tell = 0;
- p_position->i_size = 0;
- p_position->i_mux_rate = 0;
- msg_Err( p_this, "no input found" );
- return;
- }
-
- vlc_mutex_lock( &p_input->stream.stream_lock );
-
-#define A p_input->stream.p_selected_area
- p_position->i_tell = A->i_tell;
- p_position->i_size = A->i_size;
- p_position->i_mux_rate = p_input->stream.i_mux_rate;
-#undef A
-
- vlc_mutex_unlock( &p_input->stream.stream_lock );
- vlc_object_release( p_input );
-}
-
/*****************************************************************************
* input_OffsetToTime : converts an off_t value to a time indicator, using
* mux_rate
}
}
-/*****************************************************************************
- * input_DumpStream: dumps the contents of a stream descriptor
- *****************************************************************************
- * BEWARE : this function assumes that you already own the lock on
- * p_input->stream.stream_lock
- *****************************************************************************/
-void input_DumpStream( input_thread_t * p_input )
-{
- char psz_time1[MSTRTIME_MAX_SIZE];
- char psz_time2[MSTRTIME_MAX_SIZE];
- unsigned int i, j;
-
-#define S p_input->stream
- msg_Dbg( p_input, "dumping stream ID 0x%x [OK:%ld/D:%ld]", S.i_stream_id,
- S.c_packets_read, S.c_packets_trashed );
- if( S.b_seekable )
- msg_Dbg( p_input, "seekable stream, position: "I64Fd"/"I64Fd" (%s/%s)",
- S.p_selected_area->i_tell, S.p_selected_area->i_size,
- input_OffsetToTime( p_input, psz_time1,
- S.p_selected_area->i_tell ),
- input_OffsetToTime( p_input, psz_time2,
- S.p_selected_area->i_size ) );
- else
- msg_Dbg( p_input, "pace %scontrolled", S.b_pace_control ? "" : "un-" );
-#undef S
- for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
- {
-#define P p_input->stream.pp_programs[i]
- msg_Dbg( p_input, "dumping program 0x%x, version %d (%s)",
- P->i_number, P->i_version,
- P->b_is_ok ? "complete" : "partial" );
-#undef P
- for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
- {
-#define ES p_input->stream.pp_programs[i]->pp_es[j]
- msg_Dbg( p_input, "ES 0x%x, "
- "stream 0x%x, fourcc `%4.4s', %s [OK:%ld/ERR:%ld]",
- ES->i_id, ES->i_stream_id, (char*)&ES->i_fourcc,
- ES->p_dec != NULL ? "selected" : "not selected",
- ES->c_packets, ES->c_invalid_packets );
-#undef ES
- }
- }
-}
-
/*****************************************************************************
* input_ToggleES: answers to a user request with calls to (Un)SelectES
*****************************************************************************
return 0;
}
-
-/****************************************************************************
- * input_ToggleGrayscale: change to grayscale or color output
- ****************************************************************************/
-int input_ToggleGrayscale( input_thread_t * p_input )
-{
- /* No need to warn the input thread since only the decoders and outputs
- * worry about it. */
- vlc_mutex_lock( &p_input->stream.control.control_lock );
- p_input->stream.control.b_grayscale =
- !p_input->stream.control.b_grayscale;
-
- msg_Dbg( p_input, "changing to %s output",
- p_input->stream.control.b_grayscale ? "grayscale" : "color" );
-
- vlc_mutex_unlock( &p_input->stream.control.control_lock );
-
- return 0;
-}
-
-/****************************************************************************
- * input_ToggleMute: activate/deactivate mute mode
- ****************************************************************************/
-int input_ToggleMute( input_thread_t * p_input )
-{
- /* We need to feed the decoders with 0, and only input can do that, so
- * pass the message to the input thread. */
- vlc_mutex_lock( &p_input->stream.stream_lock );
- p_input->stream.b_new_mute = !p_input->stream.control.b_mute;
-
- msg_Dbg( p_input, "%s mute mode",
- p_input->stream.control.b_mute ? "activating" : "deactivating" );
-
- vlc_mutex_unlock( &p_input->stream.stream_lock );
-
- return 0;
-}
-
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ChangeProgram( p_input, (uint16_t)newval.i_int );
- input_SetStatus( p_input, INPUT_STATUS_PLAY );
+ var_SetInteger( p_input, "state", PLAYING_S );
vlc_mutex_lock( &p_input->stream.stream_lock );
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ChangeArea( p_input, p_area );
- input_SetStatus( p_input, INPUT_STATUS_PLAY );
+ var_SetInteger( p_input, "state", PLAYING_S );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ChangeArea( p_input, p_area );
- input_SetStatus( p_input, INPUT_STATUS_PLAY );
+ var_SetInteger( p_input, "state", PLAYING_S );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
p_area->i_part = newval.i_int;
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ChangeArea( p_input, p_area );
- input_SetStatus( p_input, INPUT_STATUS_PLAY );
+ var_SetInteger( p_input, "state", PLAYING_S );
vlc_mutex_lock( &p_input->stream.stream_lock );
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
static int DStreamThread ( stream_t *s )
{
d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
- char *psz_mrl;
demux_t *p_demux;
/* Create the demuxer */
- psz_mrl = malloc( strlen( p_sys->psz_name ) + 3 );
- sprintf( psz_mrl, "/%s:", p_sys->psz_name );
-
- if( ( p_demux = demux2_New( s, psz_mrl, s, p_sys->out ) ) == NULL )
+ if( ( p_demux = demux2_New( s, "", p_sys->psz_name, "", s, p_sys->out ) ) == NULL )
{
- free( psz_mrl );
return VLC_EGENERIC;
}
- free( psz_mrl );
vlc_mutex_lock( &p_sys->lock );
p_sys->p_demux = p_demux;