Commit 68aa3ca3 authored by Clément Stenac's avatar Clément Stenac

Merge 0.8.5-api changes

Fix compilation
parent 91c8dba0
...@@ -63,14 +63,15 @@ pkgincludedir = $(includedir)/vlc ...@@ -63,14 +63,15 @@ pkgincludedir = $(includedir)/vlc
dist_pkginclude_HEADERS = \ dist_pkginclude_HEADERS = \
include/vlc/vlc.h \ include/vlc/vlc.h \
include/vlc/libvlc.h \
include/vlc/aout.h \ include/vlc/aout.h \
include/vlc/vout.h \ include/vlc/vout.h \
include/vlc/sout.h \ include/vlc/sout.h \
include/vlc/decoder.h \ include/vlc/decoder.h \
include/vlc/input.h \ include/vlc/input.h \
include/vlc/intf.h \ include/vlc/intf.h \
include/vlc/control.h \ include/vlc/mediacontrol.h \
include/vlc/control_structures.h \ include/vlc/mediacontrol_structures.h \
$(NULL) $(NULL)
noinst_HEADERS = $(HEADERS_include) noinst_HEADERS = $(HEADERS_include)
...@@ -105,7 +106,6 @@ HEADERS_include = \ ...@@ -105,7 +106,6 @@ HEADERS_include = \
include/vlc_codec.h \ include/vlc_codec.h \
include/vlc_common.h \ include/vlc_common.h \
include/vlc_config.h \ include/vlc_config.h \
include/vlc_control.h \
include/vlc_cpu.h \ include/vlc_cpu.h \
include/vlc_demux.h \ include/vlc_demux.h \
include/vlc_error.h \ include/vlc_error.h \
...@@ -137,6 +137,8 @@ HEADERS_include = \ ...@@ -137,6 +137,8 @@ HEADERS_include = \
include/vlc_xml.h \ include/vlc_xml.h \
include/vout_synchro.h \ include/vout_synchro.h \
include/win32_specific.h \ include/win32_specific.h \
include/libvlc_internal.h \
include/mediacontrol_internal.h
$(NULL) $(NULL)
src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in vlc-config src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in vlc-config
...@@ -471,12 +473,15 @@ SOURCES_libvlc_common = \ ...@@ -471,12 +473,15 @@ SOURCES_libvlc_common = \
src/misc/version.c \ src/misc/version.c \
src/extras/libc.c \ src/extras/libc.c \
src/control/core.c \ src/control/core.c \
src/control/util.c \ src/control/playlist.c \
src/control/audio_video.c \ src/control/input.c \
src/control/mediacontrol_core.c \
src/control/mediacontrol_util.c \
src/control/mediacontrol_audio_video.c \
$(NULL) $(NULL)
# These should be distributed, but not compiled # These should be distributed, but not compiled
EXTRA_DIST += src/control/init.c src/control/plugin.c EXTRA_DIST += src/control/mediacontrol_init.c src/control/mediacontrol_plugin.c
SOURCES_libvlc = \ SOURCES_libvlc = \
$(SOURCES_libvlc_common) \ $(SOURCES_libvlc_common) \
......
...@@ -48,7 +48,7 @@ def get_ldflags(): ...@@ -48,7 +48,7 @@ def get_ldflags():
# To compile in a local vlc tree # To compile in a local vlc tree
vlclocal = Extension('vlc', vlclocal = Extension('vlc',
sources = ['vlcglue.c', sources = ['vlcglue.c',
'../../src/control/init.c'], '../../src/control/mediacontrol_init.c'],
include_dirs = ['../../include', '../../', '/usr/win32/include' ], include_dirs = ['../../include', '../../', '/usr/win32/include' ],
extra_objects = [ '../../lib/libvlc_pic.a' ], extra_objects = [ '../../lib/libvlc_pic.a' ],
extra_compile_args = get_cflags(), extra_compile_args = get_cflags(),
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#include <stdio.h> #include <stdio.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/control_structures.h> #include <vlc/mediacontrol_structures.h>
#include <vlc/control.h> #include <vlc/mediacontrol.h>
#define SELF ((MediaControl*)self) #define SELF ((MediaControl*)self)
......
/*****************************************************************************
* libvlc_internal.h : Definition of opaque structures for libvlc exported API
* Also contains some internal utility functions
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id: control_structures.h 13752 2005-12-15 10:14:42Z oaubert $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _LIBVLC_INTERNAL_H
#define _LIBVLC_INTERNAL_H 1
# ifdef __cplusplus
extern "C" {
# endif
#include <vlc/vlc.h>
struct libvlc_instance_t
{
vlc_t *p_vlc;
playlist_t *p_playlist;
int i_vlc_id;
};
struct libvlc_input_t
{
int i_input_id; ///< Input object id. We don't use a pointer to
/// avoid any crash
struct libvlc_instance_t *p_instance; ///< Parent instance
};
# ifdef __cplusplus
}
# endif
#endif
...@@ -21,15 +21,15 @@ ...@@ -21,15 +21,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef _VLC_PRIVATE_CONTROL_H #ifndef _VLC_MEDIACONTROL_INTERNAL_H
#define _VLC_PRIVATE_CONTROL_H 1 #define _VLC_MEDIACONTROL_INTERNAL_H 1
# ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
# endif # endif
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include "vlc/control_structures.h" #include "vlc/mediacontrol_structures.h"
typedef struct { typedef struct {
vlc_object_t *p_vlc; vlc_object_t *p_vlc;
......
/*****************************************************************************
* libvlc.h: libvlc_* new external API
*****************************************************************************
* Copyright (C) 1998-2005 the VideoLAN team
* $Id: vlc.h 13701 2005-12-12 17:58:56Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* \defgroup libvlc Libvlc
* This is libvlc, the base library of the VLC program.
*
* @{
*/
#ifndef _LIBVLC_H
#define _LIBVLC_H 1
#include <vlc/vlc.h>
# ifdef __cplusplus
extern "C" {
# endif
/*****************************************************************************
* Exception handling
*****************************************************************************/
/** defgroup libvlc_exception Exceptions
* \ingroup libvlc
* LibVLC Exceptions handling
* @{
*/
struct libvlc_exception_t
{
int b_raised;
char *psz_message;
};
typedef struct libvlc_exception_t libvlc_exception_t;
/**
* Initialize an exception structure. This can be called several times to reuse
* an exception structure.
* \param p_exception the exception to initialize
*/
void libvlc_exception_init( libvlc_exception_t *p_exception );
/**
* Has an exception been raised ?
* \param p_exception the exception to query
* \return 0 if no exception raised, 1 else
*/
int libvlc_exception_raised( libvlc_exception_t *p_exception );
/**
* Get exception message
* \param p_exception the exception to query
* \return the exception message or NULL if not applicable (exception not raised
* for example)
*/
char* libvlc_exception_get_message( libvlc_exception_t *p_exception );
/** @} */
/*****************************************************************************
* Core handling
*****************************************************************************/
/** defgroup libvlc_core Core
* \ingroup libvlc
* LibVLC Core
* @{
*/
/** This structure is opaque. It represents a libvlc instance */
typedef struct libvlc_instance_t libvlc_instance_t;
/**
* Create an initialized libvlc instance
* \param argc the number of arguments
* \param argv command-line-type arguments
* \param exception an initialized exception pointer
*/
libvlc_instance_t * libvlc_new( int , char **, libvlc_exception_t *);
/**
* Destroy a libvlc instance
* \param p_instance the instance to destroy
*/
void libvlc_destroy( libvlc_instance_t *);
/** @}*/
/*****************************************************************************
* Playlist
*****************************************************************************/
/** defgroup libvlc_playlist Playlist
* \ingroup libvlc
* LibVLC Playlist handling
* @{
*/
/**
* Start playing. You can give some additionnal playlist item options
* that will be added to the item before playing it.
* \param p_instance the instance
* \param i_options the number of options to add to the item
* \param ppsz_options the options to add to the item
* \param p_exception an initialized exception
*/
void libvlc_playlist_play( libvlc_instance_t*, int, char **,
libvlc_exception_t * );
typedef struct libvlc_input_t libvlc_input_t;
///\todo document me
libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
libvlc_exception_t * );
/** @}*/
/*****************************************************************************
* Input
*****************************************************************************/
/** defgroup libvlc_input Input
* \ingroup libvlc
* LibVLC Input handling
* @{
*/
/** Free an input object
* \param p_input the input to free
*/
void libvlc_input_free( libvlc_input_t * );
/// \bug This might go away ... to be replaced by a broader system
vlc_int64_t libvlc_input_get_length( libvlc_input_t *, libvlc_exception_t *);
vlc_int64_t libvlc_input_get_time( libvlc_input_t *, libvlc_exception_t *);
float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *);
/** @} */
# ifdef __cplusplus
}
# endif
#endif /* <vlc/vlc_control.h> */
...@@ -34,7 +34,7 @@ extern "C" { ...@@ -34,7 +34,7 @@ extern "C" {
#define WINDOWHANDLE int #define WINDOWHANDLE int
#endif #endif
#include <vlc/control_structures.h> #include <vlc/mediacontrol_structures.h>
/************************************************************************ /************************************************************************
* Position Object Manipulation * Position Object Manipulation
......
/***************************************************************************** /*****************************************************************************
* vlc.h: global header for vlc * vlc.h: global header for libvlc (old-style)
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team * Copyright (C) 1998-2004 the VideoLAN team
* $Id$ * $Id$
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
*****************************************************************************/ *****************************************************************************/
/** /**
* \defgroup libvlc Libvlc * \defgroup libvlc_old Libvlc Old
* This is libvlc, the base library of the VLC program. * This is libvlc, the base library of the VLC program.
* This is the legacy API. Please consider using the new libvlc API
* *
* @{ * @{
*/ */
......
...@@ -419,6 +419,7 @@ typedef struct vlc_meta_t vlc_meta_t; ...@@ -419,6 +419,7 @@ typedef struct vlc_meta_t vlc_meta_t;
typedef struct counter_t counter_t; typedef struct counter_t counter_t;
typedef struct counter_sample_t counter_sample_t; typedef struct counter_sample_t counter_sample_t;
typedef struct stats_handler_t stats_handler_t; typedef struct stats_handler_t stats_handler_t;
typedef struct input_stats_t input_stats_t;
/***************************************************************************** /*****************************************************************************
......
This diff is collapsed.
/*****************************************************************************
* input.c: Libvlc new API input management functions
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <libvlc_internal.h>
#include <vlc/libvlc.h>
#include <vlc/intf.h>
void libvlc_input_free( libvlc_input_t *p_input )
{
if( p_input )
free( p_input );
}
/**************************************************************************
* Getters for stream information
**************************************************************************/
vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
libvlc_exception_t *p_exception )
{
input_thread_t *p_input_thread;
vlc_value_t val;
if( !p_input )
{
libvlc_exception_raise( p_exception, "Input is NULL" );
return -1;
}
p_input_thread = (input_thread_t*)vlc_object_get(
p_input->p_instance->p_vlc,
p_input->i_input_id );
if( !p_input_thread )
{
libvlc_exception_raise( p_exception, "Input does not exist" );
return -1;
}
var_Get( p_input_thread, "length", &val );
vlc_object_release( p_input_thread );
return val.i_time / 1000;
}
vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
libvlc_exception_t *p_exception )
{
input_thread_t *p_input_thread;
vlc_value_t val;
if( !p_input )
{
libvlc_exception_raise( p_exception, "Input is NULL" );
return -1;
}
p_input_thread = (input_thread_t*)vlc_object_get(
p_input->p_instance->p_vlc,
p_input->i_input_id );
if( !p_input_thread )
{
libvlc_exception_raise( p_exception, "Input does not exist" );
return -1;
}
var_Get( p_input_thread , "time", &val );
vlc_object_release( p_input_thread );
return val.i_time / 1000;
}
float libvlc_input_get_position( libvlc_input_t *p_input,
libvlc_exception_t *p_exception )
{
input_thread_t *p_input_thread;
vlc_value_t val;
if( !p_input )
{
libvlc_exception_raise( p_exception, "Input is NULL" );
return -1;
}
p_input_thread = (input_thread_t*)vlc_object_get(
p_input->p_instance->p_vlc,
p_input->i_input_id );
if( !p_input_thread )
{
libvlc_exception_raise( p_exception, "Input does not exist" );
return -1.0;
}
var_Get( p_input_thread, "position", &val );
vlc_object_release( p_input_thread );
return val.f_float;
}
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc_control.h> #include <mediacontrol_internal.h>
#include <vlc/control.h> #include <vlc/mediacontrol.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/vout.h> #include <vlc/vout.h>
......
This diff is collapsed.
#define __VLC__ #define __VLC__
#include <vlc_control.h> #include <mediacontrol_internal.h>
#include <vlc/control.h> #include <vlc/mediacontrol.h>
mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception ) mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception )
{ {
......
#include <vlc_control.h> #include <mediacontrol_internal.h>
#include <vlc/control.h> #include <vlc/mediacontrol.h>
#include <vlc/intf.h> #include <vlc/intf.h>
mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception ) mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception )
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc_control.h> #include <mediacontrol_internal.h>
#include <vlc/control.h> #include <vlc/mediacontrol.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/vout.h> #include <vlc/vout.h>
......
/*****************************************************************************
* playlist.c: libvlc new API playlist handling functions
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <libvlc_internal.h>
#include <vlc/libvlc.h>
#include <vlc/intf.h>
void libvlc_playlist_play( libvlc_instance_t *p_instance,
int i_options, char **ppsz_options,
libvlc_exception_t *p_exception )
{
///\todo Handle additionnal options
if( p_instance->p_playlist->i_size == 0 )
{
libvlc_exception_raise( p_exception, "Empty playlist" );
return;
}
playlist_Play( p_instance->p_playlist );
}
libvlc_input_t * libvlc_playlist_get_input( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )
{
libvlc_input_t *p_input;
vlc_mutex_lock( &p_instance->p_playlist->object_lock );
if( p_instance->p_playlist->p_input == NULL )
{
libvlc_exception_raise( p_exception, "No active input" );
vlc_mutex_unlock( &p_instance->p_playlist->object_lock );
return;
}
p_input = (libvlc_input_t *)malloc( sizeof( libvlc_input_t ) );
p_input->i_input_id = p_instance->p_playlist->p_input->i_object_id;
p_input->p_instance = p_instance;
vlc_mutex_unlock( &p_instance->p_playlist->object_lock );
return p_input;
}
...@@ -96,7 +96,7 @@ static int stats_CounterUpdate( stats_handler_t *p_handler, ...@@ -96,7 +96,7 @@ static int stats_CounterUpdate( stats_handler_t *p_handler,
{ {
case STATS_LAST: case STATS_LAST:
case STATS_MIN: case STATS_MIN:
case STATS_LAST: case STATS_MAX:
if( p_counter->i_samples > 1) if( p_counter->i_samples > 1)
{ {
msg_Err( p_handler, "LAST counter has several samples !" ); msg_Err( p_handler, "LAST counter has several samples !" );
...@@ -249,7 +249,7 @@ void stats_ComputeInputStats( input_thread_t *p_input, ...@@ -249,7 +249,7 @@ void stats_ComputeInputStats( input_thread_t *p_input,
{ {
int i; int i;
/* read_packets and read_bytes are common to all streams */ /* read_packets and read_bytes are common to all streams */
p_stats->i_read_packets = stats_GetInteger( p_input, "read_packets" ); //p_stats->i_read_packets = stats_GetInteger( p_input, "read_packets" );
p_stats->i_read_bytes = stats_GetInteger( p_input, "read_bytes" ); // p_stats->i_read_bytes = stats_GetInteger( p_input, "read_bytes" );
} }
#include <stdio.h>
#include <time.h>
#include <vlc/libvlc.h>
int main(int argc, char **argv)
{
libvlc_instance_t *p_instance1;
libvlc_exception_t exception;
libvlc_input_t *p_input;
int b_started = 0;
libvlc_exception_init( &exception );
p_instance1 = libvlc_new( argc,argv, &exception );
if( libvlc_exception_raised( &exception ) )
{
fprintf( stderr, "FATAL: %s\n",
libvlc_exception_get_message( &exception ) );
return 0;
}
libvlc_playlist_play( p_instance1, 0,NULL, NULL );
while( 1 )
{
sleep( 1 );
libvlc_exception_init( &exception );
p_input = libvlc_playlist_get_input( p_instance1, &exception );
if( libvlc_exception_raised( &exception ) )
{
if( b_started == 1 )
break;
else
continue;
}
else
{
b_started = 1;
}
fprintf( stderr, "Length %lli - Time %lli\n",
libvlc_input_get_length( p_input, NULL ),
libvlc_input_get_time( p_input, NULL ) );
libvlc_input_free( p_input );
}
libvlc_destroy( p_instance1 );
return 0;
}
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