Commit e96ffed1 authored by gbazin's avatar gbazin

* 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" {
#define WINDOWHANDLE int
#endif
#ifndef true
typedef int bool;
#endif
/************************************************************************
* Position Object Manipulation
*************************************************************************/
......@@ -65,19 +61,19 @@ typedef struct {
int width;
int height;
long type;
long long date;
vlc_int64_t date;
int size;
char* data;
char *data;
} mediacontrol_RGBPicture;
typedef struct {
int size;
char** data;
char **data;
} mediacontrol_PlaylistSeq;
typedef struct {
int code;
char* message;
char *message;
} mediacontrol_Exception;
/* Exception codes */
......@@ -96,118 +92,136 @@ typedef struct {
/* Cf stream_control.h */
enum mediacontrol_PlayerStatusList
{
{
mediacontrol_PlayingStatus, mediacontrol_PauseStatus,
mediacontrol_ForwardStatus, mediacontrol_BackwardStatus,
mediacontrol_InitStatus, mediacontrol_EndStatus,
mediacontrol_UndefinedStatus
};
};
typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus;
typedef struct {
mediacontrol_PlayerStatus streamstatus;
char* url; /* The URL of the current media stream */
long long position; /* actual location in the stream (in ms) */
long long length; /* total length of the stream (in ms) */
} mediacontrol_StreamInformation;
char *url; /* The URL of the current media stream */
vlc_int64_t position; /* actual location in the stream (in ms) */
vlc_int64_t length; /* total length of the stream (in ms) */
} mediacontrol_StreamInformation;
/**************************************************************************
* Helper functions
***************************************************************************/
long long mediacontrol_unit_convert (input_thread_t *p_input,
mediacontrol_PositionKey from,
mediacontrol_PositionKey to,
long long value);
long long
mediacontrol_position2microsecond (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_createRGBPicture (int, int, long, long long 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);
vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from,
mediacontrol_PositionKey to,
vlc_int64_t value );
vlc_int64_t mediacontrol_position2microsecond(
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_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);
/*****************************************************************************
* Core functions
*****************************************************************************/
mediacontrol_Instance* mediacontrol_new(char** args, mediacontrol_Exception *exception);
mediacontrol_Instance* mediacontrol_new_from_object(vlc_object_t* p_object,
mediacontrol_Exception *exception);
mediacontrol_Instance *
mediacontrol_new( char **args, 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,
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
void mediacontrol_pause( mediacontrol_Instance *self,
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
void mediacontrol_pause(mediacontrol_Instance *self,
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
void mediacontrol_resume( mediacontrol_Instance *self,
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
void mediacontrol_resume(mediacontrol_Instance *self,
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
void mediacontrol_stop( mediacontrol_Instance *self,
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
void mediacontrol_stop(mediacontrol_Instance *self,
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
void mediacontrol_exit(mediacontrol_Instance *self);
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,
mediacontrol_Exception *exception);
void mediacontrol_playlist_clear (mediacontrol_Instance *self,
mediacontrol_Exception *exception);
mediacontrol_PlaylistSeq* mediacontrol_playlist_get_list (
mediacontrol_Instance *self,
mediacontrol_Exception *exception);
mediacontrol_Exception *exception );
void mediacontrol_playlist_clear( mediacontrol_Instance *self,
mediacontrol_Exception *exception );
mediacontrol_PlaylistSeq *
mediacontrol_playlist_get_list( mediacontrol_Instance *self,
mediacontrol_Exception *exception );
/*****************************************************************************
* A/V functions
*****************************************************************************/
mediacontrol_RGBPicture* mediacontrol_snapshot (mediacontrol_Instance *self,
const mediacontrol_Position* a_position,
mediacontrol_Exception *exception);
mediacontrol_RGBPicture *
mediacontrol_snapshot( mediacontrol_Instance *self,
const mediacontrol_Position *a_position,
mediacontrol_Exception *exception );
/* Return a NULL terminated list */
mediacontrol_RGBPicture** 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,
const char* message,
const mediacontrol_Position* begin,
const mediacontrol_Position* end,
mediacontrol_Exception *exception);
mediacontrol_StreamInformation*
mediacontrol_get_stream_information(mediacontrol_Instance* self,
mediacontrol_PositionKey a_key,
mediacontrol_Exception *exception);
unsigned short mediacontrol_sound_get_volume(mediacontrol_Instance* self,
mediacontrol_Exception *exception);
void mediacontrol_sound_set_volume(mediacontrol_Instance* self,
const unsigned short volume,
mediacontrol_Exception *exception);
bool mediacontrol_set_visual(mediacontrol_Instance* self,
WINDOWHANDLE visual_id,
mediacontrol_Exception *exception);
mediacontrol_RGBPicture **
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,
const char *message,
const mediacontrol_Position *begin,
const mediacontrol_Position *end,
mediacontrol_Exception *exception );
mediacontrol_StreamInformation *
mediacontrol_get_stream_information( mediacontrol_Instance *self,
mediacontrol_PositionKey a_key,
mediacontrol_Exception *exception );
unsigned short
mediacontrol_sound_get_volume( mediacontrol_Instance *self,
mediacontrol_Exception *exception );
void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
const unsigned short volume,
mediacontrol_Exception *exception );
vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
WINDOWHANDLE visual_id,
mediacontrol_Exception *exception );
# ifdef __cplusplus
}
# endif
#endif
......@@ -46,6 +46,12 @@ typedef int vlc_bool_t;
typedef struct vlc_list_t vlc_list_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
* These are the different types a vlc variable can have.
......@@ -79,12 +85,7 @@ typedef union
void * p_address;
vlc_object_t * p_object;
vlc_list_t * p_list;
#if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
signed __int64 i_time;
# else
signed long long i_time;
#endif
vlc_int64_t i_time;
struct { char *psz_name; int i_object_id; } var;
......
......@@ -55,10 +55,10 @@
#define RAISE( c, m ) exception->code = c; \
exception->message = strdup(m);
long long mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from,
mediacontrol_PositionKey to,
long long value )
vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from,
mediacontrol_PositionKey to,
vlc_int64_t value )
{
if( to == from )
return value;
......@@ -101,12 +101,12 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
{
/* FIXME */
/* 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;
}
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 */
break;
......@@ -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) ;
// 0 if undef */
// 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 )
// {
......@@ -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 )
// return 0;
// 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 */
break;
......@@ -143,7 +143,7 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
/* Converts a mediacontrol_Position into a time in microseconds in
movie clock time */
long long
vlc_int64_t
mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_Position * pos )
{
switch( pos->origin )
......@@ -156,7 +156,7 @@ mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_P
break;
case mediacontrol_RelativePosition:
{
long long l_pos;
vlc_int64_t l_pos;
vlc_value_t val;
val.i_time = 0;
......@@ -174,7 +174,7 @@ mediacontrol_position2microsecond( input_thread_t* p_input, const mediacontrol_P
}
case mediacontrol_ModuloPosition:
{
long long l_pos;
vlc_int64_t l_pos;
vlc_value_t val;
val.i_time = 0;
......@@ -273,7 +273,7 @@ mediacontrol_exception_free( mediacontrol_Exception *exception )
}
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 )
{
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