Commit e96ffed1 authored by Gildas Bazin's avatar Gildas Bazin

* include/vlc/vlc.h, include/vlc/control.h, src/control/util.c: introduced...

* include/vlc/vlc.h, include/vlc/control.h, src/control/util.c: introduced vlc_int64_t in the libvlc headers instead of using long long which isn't portable + fixed a function prototype in control.h. Thanks to Brian Robb (vascy at hotmail) for pointing out the problem.
parent ebe12068
...@@ -36,10 +36,6 @@ extern "C" { ...@@ -36,10 +36,6 @@ extern "C" {
#define WINDOWHANDLE int #define WINDOWHANDLE int
#endif #endif
#ifndef true
typedef int bool;
#endif
/************************************************************************ /************************************************************************
* Position Object Manipulation * Position Object Manipulation
*************************************************************************/ *************************************************************************/
...@@ -65,19 +61,19 @@ typedef struct { ...@@ -65,19 +61,19 @@ typedef struct {
int width; int width;
int height; int height;
long type; long type;
long long date; vlc_int64_t date;
int size; int size;
char* data; char *data;
} mediacontrol_RGBPicture; } mediacontrol_RGBPicture;
typedef struct { typedef struct {
int size; int size;
char** data; char **data;
} mediacontrol_PlaylistSeq; } mediacontrol_PlaylistSeq;
typedef struct { typedef struct {
int code; int code;
char* message; char *message;
} mediacontrol_Exception; } mediacontrol_Exception;
/* Exception codes */ /* Exception codes */
...@@ -96,118 +92,136 @@ typedef struct { ...@@ -96,118 +92,136 @@ typedef struct {
/* Cf stream_control.h */ /* Cf stream_control.h */
enum mediacontrol_PlayerStatusList enum mediacontrol_PlayerStatusList
{ {
mediacontrol_PlayingStatus, mediacontrol_PauseStatus, mediacontrol_PlayingStatus, mediacontrol_PauseStatus,
mediacontrol_ForwardStatus, mediacontrol_BackwardStatus, mediacontrol_ForwardStatus, mediacontrol_BackwardStatus,
mediacontrol_InitStatus, mediacontrol_EndStatus, mediacontrol_InitStatus, mediacontrol_EndStatus,
mediacontrol_UndefinedStatus mediacontrol_UndefinedStatus
}; };
typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus; typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus;
typedef struct { typedef struct {
mediacontrol_PlayerStatus streamstatus; mediacontrol_PlayerStatus streamstatus;
char* url; /* The URL of the current media stream */ char *url; /* The URL of the current media stream */
long long position; /* actual location in the stream (in ms) */ vlc_int64_t position; /* actual location in the stream (in ms) */
long long length; /* total length of the stream (in ms) */ vlc_int64_t length; /* total length of the stream (in ms) */
} mediacontrol_StreamInformation; } mediacontrol_StreamInformation;
/************************************************************************** /**************************************************************************
* Helper functions * Helper functions
***************************************************************************/ ***************************************************************************/
long long mediacontrol_unit_convert (input_thread_t *p_input, vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from, mediacontrol_PositionKey from,
mediacontrol_PositionKey to, mediacontrol_PositionKey to,
long long value); vlc_int64_t value );
long long vlc_int64_t mediacontrol_position2microsecond(
mediacontrol_position2microsecond (input_thread_t* p_input, const mediacontrol_Position * pos); input_thread_t *p_input,
const mediacontrol_Position *pos );
mediacontrol_RGBPicture* mediacontrol_RGBPicture__alloc (int datasize);
void mediacontrol_RGBPicture__free (mediacontrol_RGBPicture* pic); mediacontrol_RGBPicture *mediacontrol_RGBPicture__alloc( int datasize );
mediacontrol_RGBPicture* _mediacontrol_createRGBPicture (int, int, long, long long l_date, char*, int);
mediacontrol_PlaylistSeq* mediacontrol_PlaylistSeq__alloc (int size); void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
void mediacontrol_PlaylistSeq__free (mediacontrol_PlaylistSeq* ps);
mediacontrol_RGBPicture *
mediacontrol_Exception* mediacontrol_exception_init(mediacontrol_Exception *exception); _mediacontrol_createRGBPicture( int, int, long, vlc_int64_t l_date,
char *, int);
mediacontrol_PlaylistSeq *mediacontrol_PlaylistSeq__alloc( int size );
void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
mediacontrol_Exception *
mediacontrol_exception_init( mediacontrol_Exception *exception );
void mediacontrol_exception_free(mediacontrol_Exception *exception); void mediacontrol_exception_free(mediacontrol_Exception *exception);
/***************************************************************************** /*****************************************************************************
* Core functions * Core functions
*****************************************************************************/ *****************************************************************************/
mediacontrol_Instance* mediacontrol_new(char** args, mediacontrol_Exception *exception); mediacontrol_Instance *
mediacontrol_Instance* mediacontrol_new_from_object(vlc_object_t* p_object, mediacontrol_new( char **args, mediacontrol_Exception *exception );
mediacontrol_Exception *exception);
mediacontrol_Instance *
mediacontrol_new_from_object( vlc_object_t *p_object,
mediacontrol_Exception *exception );
mediacontrol_Position *
mediacontrol_get_media_position(
mediacontrol_Instance *self,
const mediacontrol_PositionOrigin an_origin,
const mediacontrol_PositionKey a_key,
mediacontrol_Exception *exception );
void mediacontrol_set_media_position( mediacontrol_Instance *self,
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
mediacontrol_Position* mediacontrol_get_media_position(
mediacontrol_Instance *self,
mediacontrol_PositionOrigin an_origin,
mediacontrol_PositionKey a_key,
mediacontrol_Exception *exception);
void mediacontrol_set_media_position(mediacontrol_Instance *self,
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
void mediacontrol_start( mediacontrol_Instance *self, void mediacontrol_start( mediacontrol_Instance *self,
const mediacontrol_Position* a_position, const mediacontrol_Position *a_position,
mediacontrol_Exception *exception); mediacontrol_Exception *exception );
void mediacontrol_pause( mediacontrol_Instance *self,
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
void mediacontrol_pause(mediacontrol_Instance *self, void mediacontrol_resume( mediacontrol_Instance *self,
const mediacontrol_Position* a_position, const mediacontrol_Position *a_position,
mediacontrol_Exception *exception); mediacontrol_Exception *exception );
void mediacontrol_resume(mediacontrol_Instance *self, void mediacontrol_stop( mediacontrol_Instance *self,
const mediacontrol_Position* a_position, const mediacontrol_Position *a_position,
mediacontrol_Exception *exception); mediacontrol_Exception *exception );
void mediacontrol_stop(mediacontrol_Instance *self, void mediacontrol_exit( mediacontrol_Instance *self );
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
void mediacontrol_exit(mediacontrol_Instance *self);
void mediacontrol_playlist_add_item (mediacontrol_Instance *self, void mediacontrol_playlist_add_item( mediacontrol_Instance *self,
const char* psz_file, const char* psz_file,
mediacontrol_Exception *exception); mediacontrol_Exception *exception );
void mediacontrol_playlist_clear (mediacontrol_Instance *self, void mediacontrol_playlist_clear( mediacontrol_Instance *self,
mediacontrol_Exception *exception); mediacontrol_Exception *exception );
mediacontrol_PlaylistSeq* mediacontrol_playlist_get_list ( mediacontrol_PlaylistSeq *
mediacontrol_Instance *self, mediacontrol_playlist_get_list( mediacontrol_Instance *self,
mediacontrol_Exception *exception); mediacontrol_Exception *exception );
/***************************************************************************** /*****************************************************************************
* A/V functions * A/V functions
*****************************************************************************/ *****************************************************************************/
mediacontrol_RGBPicture* mediacontrol_snapshot (mediacontrol_Instance *self, mediacontrol_RGBPicture *
const mediacontrol_Position* a_position, mediacontrol_snapshot( mediacontrol_Instance *self,
mediacontrol_Exception *exception); const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
/* Return a NULL terminated list */ /* Return a NULL terminated list */
mediacontrol_RGBPicture** mediacontrol_all_snapshots (mediacontrol_Instance *self, mediacontrol_RGBPicture **
mediacontrol_Exception *exception); mediacontrol_all_snapshots( mediacontrol_Instance *self,
mediacontrol_Exception *exception );
// Displays the message string, between "begin" and "end" positions
void mediacontrol_display_text (mediacontrol_Instance *self, /* Displays the message string, between "begin" and "end" positions */
const char* message, void mediacontrol_display_text( mediacontrol_Instance *self,
const mediacontrol_Position* begin, const char *message,
const mediacontrol_Position* end, const mediacontrol_Position *begin,
mediacontrol_Exception *exception); const mediacontrol_Position *end,
mediacontrol_Exception *exception );
mediacontrol_StreamInformation*
mediacontrol_get_stream_information(mediacontrol_Instance* self, mediacontrol_StreamInformation *
mediacontrol_PositionKey a_key, mediacontrol_get_stream_information( mediacontrol_Instance *self,
mediacontrol_Exception *exception); mediacontrol_PositionKey a_key,
mediacontrol_Exception *exception );
unsigned short mediacontrol_sound_get_volume(mediacontrol_Instance* self,
mediacontrol_Exception *exception); unsigned short
void mediacontrol_sound_set_volume(mediacontrol_Instance* self, mediacontrol_sound_get_volume( mediacontrol_Instance *self,
const unsigned short volume, mediacontrol_Exception *exception );
mediacontrol_Exception *exception); void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
const unsigned short volume,
bool mediacontrol_set_visual(mediacontrol_Instance* self, mediacontrol_Exception *exception );
WINDOWHANDLE visual_id,
mediacontrol_Exception *exception); vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
WINDOWHANDLE visual_id,
mediacontrol_Exception *exception );
# ifdef __cplusplus # ifdef __cplusplus
} }
# endif # endif
#endif #endif
...@@ -46,6 +46,12 @@ typedef int vlc_bool_t; ...@@ -46,6 +46,12 @@ typedef int vlc_bool_t;
typedef struct vlc_list_t vlc_list_t; typedef struct vlc_list_t vlc_list_t;
typedef struct vlc_object_t vlc_object_t; typedef struct vlc_object_t vlc_object_t;
#if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
typedef signed __int64 vlc_int64_t;
# else
typedef signed long long vlc_int64_t;
#endif
/** /**
* \defgroup var_type Variable types * \defgroup var_type Variable types
* These are the different types a vlc variable can have. * These are the different types a vlc variable can have.
...@@ -79,12 +85,7 @@ typedef union ...@@ -79,12 +85,7 @@ typedef union
void * p_address; void * p_address;
vlc_object_t * p_object; vlc_object_t * p_object;
vlc_list_t * p_list; vlc_list_t * p_list;
vlc_int64_t i_time;
#if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
signed __int64 i_time;
# else
signed long long i_time;
#endif
struct { char *psz_name; int i_object_id; } var; struct { char *psz_name; int i_object_id; } var;
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
#define RAISE( c, m ) exception->code = c; \ #define RAISE( c, m ) exception->code = c; \
exception->message = strdup(m); exception->message = strdup(m);
long long mediacontrol_unit_convert( input_thread_t *p_input, vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from, mediacontrol_PositionKey from,
mediacontrol_PositionKey to, mediacontrol_PositionKey to,
long long value ) vlc_int64_t value )
{ {
if( to == from ) if( to == from )
return value; return value;
...@@ -101,12 +101,12 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -101,12 +101,12 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
{ {
/* FIXME */ /* FIXME */
/* vlc < 0.8 API */ /* vlc < 0.8 API */
/* return ( long long )( value * 50 * p_input->stream.i_mux_rate / f_fps ); */ /* return ( vlc_int64_t )( value * 50 * p_input->stream.i_mux_rate / f_fps ); */
return 0; return 0;
} }
if( to == mediacontrol_MediaTime ) if( to == mediacontrol_MediaTime )
return( long long )( value * 1000.0 / ( double )f_fps ); return( vlc_int64_t )( value * 1000.0 / ( double )f_fps );
/* Cannot happen */ /* Cannot happen */
break; break;
...@@ -124,7 +124,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -124,7 +124,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
// i_mux_rate : the rate we read the stream (in units of 50 bytes/s) ; // i_mux_rate : the rate we read the stream (in units of 50 bytes/s) ;
// 0 if undef */ // 0 if undef */
// if( to == mediacontrol_MediaTime ) // if( to == mediacontrol_MediaTime )
// return ( long long )( 1000 * value / 50 / p_input->stream.i_mux_rate ); // return ( vlc_int64_t )( 1000 * value / 50 / p_input->stream.i_mux_rate );
// //
// if( to == mediacontrol_SampleCount ) // if( to == mediacontrol_SampleCount )
// { // {
...@@ -132,7 +132,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -132,7 +132,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
// if( demux2_Control( p_input->input.p_demux, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 ) // if( demux2_Control( p_input->input.p_demux, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 )
// return 0; // return 0;
// else // else
// return ( long long )( value * f_fps / 50 / p_input->stream.i_mux_rate ); // return ( vlc_int64_t )( value * f_fps / 50 / p_input->stream.i_mux_rate );
// } // }
/* Cannot happen */ /* Cannot happen */
break; break;
...@@ -143,7 +143,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -143,7 +143,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
/* Converts a mediacontrol_Position into a time in microseconds in /* Converts a mediacontrol_Position into a time in microseconds in
movie clock time */ movie clock time */
long long vlc_int64_t
mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_Position * pos ) mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_Position * pos )
{ {
switch( pos->origin ) switch( pos->origin )
...@@ -156,7 +156,7 @@ mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_P ...@@ -156,7 +156,7 @@ mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_P
break; break;
case mediacontrol_RelativePosition: case mediacontrol_RelativePosition:
{ {
long long l_pos; vlc_int64_t l_pos;
vlc_value_t val; vlc_value_t val;
val.i_time = 0; val.i_time = 0;
...@@ -174,7 +174,7 @@ mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_P ...@@ -174,7 +174,7 @@ mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_P
} }
case mediacontrol_ModuloPosition: case mediacontrol_ModuloPosition:
{ {
long long l_pos; vlc_int64_t l_pos;
vlc_value_t val; vlc_value_t val;
val.i_time = 0; val.i_time = 0;
...@@ -273,7 +273,7 @@ mediacontrol_exception_free( mediacontrol_Exception *exception ) ...@@ -273,7 +273,7 @@ mediacontrol_exception_free( mediacontrol_Exception *exception )
} }
mediacontrol_RGBPicture* mediacontrol_RGBPicture*
_mediacontrol_createRGBPicture( int i_width, int i_height, long i_chroma, long long l_date, _mediacontrol_createRGBPicture( int i_width, int i_height, long i_chroma, vlc_int64_t l_date,
char* p_data, int i_datasize ) char* p_data, int i_datasize )
{ {
mediacontrol_RGBPicture *retval; mediacontrol_RGBPicture *retval;
......
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