Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
68aa3ca3
Commit
68aa3ca3
authored
Jan 08, 2006
by
zorglub
Browse files
Merge 0.8.5-api changes
Fix compilation
parent
91c8dba0
Changes
20
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
68aa3ca3
...
...
@@ -63,14 +63,15 @@ pkgincludedir = $(includedir)/vlc
dist_pkginclude_HEADERS
=
\
include/vlc/vlc.h
\
include/vlc/libvlc.h
\
include/vlc/aout.h
\
include/vlc/vout.h
\
include/vlc/sout.h
\
include/vlc/decoder.h
\
include/vlc/input.h
\
include/vlc/intf.h
\
include/vlc/control.h
\
include/vlc/control_structures.h
\
include/vlc/
media
control.h
\
include/vlc/
media
control_structures.h
\
$(NULL)
noinst_HEADERS
=
$(HEADERS_include)
...
...
@@ -105,7 +106,6 @@ HEADERS_include = \
include/vlc_codec.h
\
include/vlc_common.h
\
include/vlc_config.h
\
include/vlc_control.h
\
include/vlc_cpu.h
\
include/vlc_demux.h
\
include/vlc_error.h
\
...
...
@@ -137,6 +137,8 @@ HEADERS_include = \
include/vlc_xml.h
\
include/vout_synchro.h
\
include/win32_specific.h
\
include/libvlc_internal.h
\
include/mediacontrol_internal.h
$(NULL)
src/misc/modules_builtin.h
:
Makefile src/misc/modules_builtin.h.in vlc-config
...
...
@@ -471,12 +473,15 @@ SOURCES_libvlc_common = \
src/misc/version.c
\
src/extras/libc.c
\
src/control/core.c
\
src/control/util.c
\
src/control/audio_video.c
\
src/control/playlist.c
\
src/control/input.c
\
src/control/mediacontrol_core.c
\
src/control/mediacontrol_util.c
\
src/control/mediacontrol_audio_video.c
\
$(NULL)
# 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_common)
\
...
...
bindings/python/setup.py
View file @
68aa3ca3
...
...
@@ -48,7 +48,7 @@ def get_ldflags():
# To compile in a local vlc tree
vlclocal
=
Extension
(
'vlc'
,
sources
=
[
'vlcglue.c'
,
'../../src/control/init.c'
],
'../../src/control/
mediacontrol_
init.c'
],
include_dirs
=
[
'../../include'
,
'../../'
,
'/usr/win32/include'
],
extra_objects
=
[
'../../lib/libvlc_pic.a'
],
extra_compile_args
=
get_cflags
(),
...
...
bindings/python/vlcglue.h
View file @
68aa3ca3
...
...
@@ -29,8 +29,8 @@
#include <stdio.h>
#include <vlc/vlc.h>
#include <vlc/control_structures.h>
#include <vlc/control.h>
#include <vlc/
media
control_structures.h>
#include <vlc/
media
control.h>
#define SELF ((MediaControl*)self)
...
...
include/libvlc_internal.h
0 → 100644
View file @
68aa3ca3
/*****************************************************************************
* 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
include/
vlc_
control.h
→
include/
media
control
_internal
.h
View file @
68aa3ca3
...
...
@@ -21,15 +21,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLC_
PRIVATE_CONTRO
L_H
#define _VLC_
PRIVATE_CONTRO
L_H 1
#ifndef _VLC_
MEDIACONTROL_INTERNA
L_H
#define _VLC_
MEDIACONTROL_INTERNA
L_H 1
# ifdef __cplusplus
extern
"C"
{
# endif
#include <vlc/vlc.h>
#include "vlc/control_structures.h"
#include "vlc/
media
control_structures.h"
typedef
struct
{
vlc_object_t
*
p_vlc
;
...
...
include/vlc/libvlc.h
0 → 100644
View file @
68aa3ca3
/*****************************************************************************
* 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> */
include/vlc/control.h
→
include/vlc/
media
control.h
View file @
68aa3ca3
...
...
@@ -34,7 +34,7 @@ extern "C" {
#define WINDOWHANDLE int
#endif
#include <vlc/control_structures.h>
#include <vlc/
media
control_structures.h>
/************************************************************************
* Position Object Manipulation
...
...
include/vlc/control_structures.h
→
include/vlc/
media
control_structures.h
View file @
68aa3ca3
File moved
include/vlc/vlc.h
View file @
68aa3ca3
/*****************************************************************************
* vlc.h: global header for
vlc
* vlc.h: global header for
libvlc (old-style)
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
* $Id$
...
...
@@ -25,8 +25,9 @@
*****************************************************************************/
/**
* \defgroup libvlc Libvlc
* \defgroup libvlc
_old
Libvlc
Old
* This is libvlc, the base library of the VLC program.
* This is the legacy API. Please consider using the new libvlc API
*
* @{
*/
...
...
include/vlc_common.h
View file @
68aa3ca3
...
...
@@ -419,6 +419,7 @@ typedef struct vlc_meta_t vlc_meta_t;
typedef
struct
counter_t
counter_t
;
typedef
struct
counter_sample_t
counter_sample_t
;
typedef
struct
stats_handler_t
stats_handler_t
;
typedef
struct
input_stats_t
input_stats_t
;
/*****************************************************************************
...
...
src/control/core.c
View file @
68aa3ca3
/*****************************************************************************
* core.c: Core functions : init
, playlist, stream management
* core.c: Core
libvlc new API
functions : init
ialization, exceptions handling
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
*
* Authors:
Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr
>
* 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
...
...
@@ -21,413 +21,92 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vlc_
contro
l.h>
#include <vlc/
control
.h>
#include <
lib
vlc_
interna
l.h>
#include <vlc/
libvlc
.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include <vlc_demux.h>
#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
#ifdef HAS_SNAPSHOT
#include <snapshot.h>
#endif
#include <stdlib.h>
/* malloc(), free() */
#include <string.h>
#include <errno.h>
/* ENOMEM */
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#define RAISE( c, m ) exception->code = c; \
exception->message = strdup(m);
vlc_t
*
vlc_current_object
(
int
);
mediacontrol_Instance
*
mediacontrol_new_from_object
(
int
vlc_object_id
,
mediacontrol_Exception
*
exception
)
{
mediacontrol_Instance
*
retval
;
vlc_object_t
*
p_vlc
;
vlc_object_t
*
p_object
;
p_object
=
(
vlc_object_t
*
)
vlc_current_object
(
vlc_object_id
);
if
(
!
p_object
)
{
RAISE
(
mediacontrol_InternalException
,
"Unable to find vlc object"
);
return
NULL
;
}
p_vlc
=
vlc_object_find
(
p_object
,
VLC_OBJECT_ROOT
,
FIND_PARENT
);
if
(
!
p_vlc
)
{
RAISE
(
mediacontrol_InternalException
,
"Unable to initialize VLC"
);
return
NULL
;
}
retval
=
(
mediacontrol_Instance
*
)
malloc
(
sizeof
(
mediacontrol_Instance
)
);
retval
->
p_vlc
=
p_vlc
;
retval
->
vlc_object_id
=
p_vlc
->
i_object_id
;
/* We can keep references on these, which should not change. Is it true ? */
retval
->
p_playlist
=
vlc_object_find
(
p_vlc
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
retval
->
p_intf
=
vlc_object_find
(
p_vlc
,
VLC_OBJECT_INTF
,
FIND_ANYWHERE
);
if
(
!
retval
->
p_playlist
||
!
retval
->
p_intf
)
{
RAISE
(
mediacontrol_InternalException
,
"No available interface"
);
return
NULL
;
}
return
retval
;
};
/**************************************************************************
* Playback management
**************************************************************************/
mediacontrol_Position
*
mediacontrol_get_media_position
(
mediacontrol_Instance
*
self
,
const
mediacontrol_PositionOrigin
an_origin
,
const
mediacontrol_PositionKey
a_key
,
mediacontrol_Exception
*
exception
)
{
mediacontrol_Position
*
retval
;
vlc_value_t
val
;
input_thread_t
*
p_input
=
self
->
p_playlist
->
p_input
;
exception
=
mediacontrol_exception_init
(
exception
);
retval
=
(
mediacontrol_Position
*
)
malloc
(
sizeof
(
mediacontrol_Position
)
);
retval
->
origin
=
an_origin
;
retval
->
key
=
a_key
;
if
(
!
p_input
)
{
RAISE
(
mediacontrol_InternalException
,
"No input thread."
);
return
NULL
;
}
if
(
an_origin
!=
mediacontrol_AbsolutePosition
)
{
/* Relative or ModuloPosition make no sense */
RAISE
(
mediacontrol_PositionOriginNotSupported
,
"Only absolute position is valid."
);
return
NULL
;
}
/* We are asked for an AbsolutePosition. */
val
.
i_time
=
0
;
var_Get
(
p_input
,
"time"
,
&
val
);
/* FIXME: check val.i_time > 0 */
retval
->
value
=
mediacontrol_unit_convert
(
p_input
,
mediacontrol_MediaTime
,
a_key
,
val
.
i_time
/
1000
);
return
retval
;
}
/* Sets the media position */
void
mediacontrol_set_media_position
(
mediacontrol_Instance
*
self
,
const
mediacontrol_Position
*
a_position
,
mediacontrol_Exception
*
exception
)
{
vlc_value_t
val
;
input_thread_t
*
p_input
=
self
->
p_playlist
->
p_input
;
exception
=
mediacontrol_exception_init
(
exception
);
if
(
!
p_input
)
{
RAISE
(
mediacontrol_InternalException
,
"No input thread."
);
return
;
}
if
(
!
var_GetBool
(
p_input
,
"seekable"
)
)
{
RAISE
(
mediacontrol_InvalidPosition
,
"Stream not seekable"
);
return
;
}
val
.
i_time
=
mediacontrol_position2microsecond
(
p_input
,
a_position
);
var_Set
(
p_input
,
"time"
,
val
);
return
;
}
/* Starts playing a stream */
/*
* Known issues: since moving in the playlist using playlist_Next
* or playlist_Prev implies starting to play items, the a_position
* argument will be only honored for the 1st item in the list.
*
* XXX:FIXME split moving in the playlist and playing items two
* different actions or make playlist_<Next|Prev> accept a time
* value to start to play from.
*/
void
mediacontrol_start
(
mediacontrol_Instance
*
self
,
const
mediacontrol_Position
*
a_position
,
mediacontrol_Exception
*
exception
)
/*************************************************************************
* Exceptions handling
*************************************************************************/
inline
void
libvlc_exception_init
(
libvlc_exception_t
*
p_exception
)
{
playlist_t
*
p_playlist
=
self
->
p_playlist
;
exception
=
mediacontrol_exception_init
(
exception
);
if
(
!
p_playlist
)
{
RAISE
(
mediacontrol_PlaylistException
,
"No available playlist"
);
return
;
}
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
if
(
p_playlist
->
i_size
)
{
int
i_index
;
int
i_from
;
char
*
psz_from
=
(
char
*
)
malloc
(
20
*
sizeof
(
char
)
);
i_from
=
mediacontrol_position2microsecond
(
p_playlist
->
p_input
,
a_position
)
/
1000000
;
i_index
=
p_playlist
->
i_index
;
if
(
i_index
<
0
)
{
/* We know that there is at least 1 element, since i_size != 0 */
i_index
=
0
;
}
/* Set start time */
snprintf
(
psz_from
,
20
,
"start-time=%i"
,
i_from
);
playlist_ItemAddOption
(
p_playlist
->
pp_items
[
i_index
],
psz_from
);
free
(
psz_from
);
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
playlist_Play
(
p_playlist
);
}
else
{
RAISE
(
mediacontrol_PlaylistException
,
"Empty playlist."
);
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
}
return
;
p_exception
->
b_raised
=
0
;
p_exception
->
psz_message
=
NULL
;
}
void
mediacontrol_pause
(
mediacontrol_Instance
*
self
,
const
mediacontrol_Position
*
a_position
,
mediacontrol_Exception
*
exception
)
inline
int
libvlc_exception_raised
(
libvlc_exception_t
*
p_exception
)
{
input_thread_t
*
p_input
=
self
->
p_playlist
->
p_input
;
/* FIXME: use the a_position parameter */
exception
=
mediacontrol_exception_init
(
exception
);
if
(
p_input
!=
NULL
)
{
var_SetInteger
(
p_input
,
"state"
,
PAUSE_S
);
}
else
{
RAISE
(
mediacontrol_InternalException
,
"No input"
);
}
return
;
return
p_exception
->
b_raised
;
}
void
mediacontrol_resume
(
mediacontrol_Instance
*
self
,
const
mediacontrol_Position
*
a_position
,
mediacontrol_Exception
*
exception
)
inline
char
*
libvlc_exception_get_message
(
libvlc_exception_t
*
p_exception
)
{
input_thread_t
*
p_input
=
self
->
p_playlist
->
p_input
;
/* FIXME: use the a_position parameter */
exception
=
mediacontrol_exception_init
(
exception
);
if
(
p_input
!=
NULL
)
if
(
p_exception
->
b_raised
==
1
&&
p_exception
->
psz_message
)
{
var_SetInteger
(
p_input
,
"state"
,
PAUSE_S
);
}
else
{
RAISE
(
mediacontrol_InternalException
,
"No input"
);
return
p_exception
->
psz_message
;
}
return
NULL
;
}
void
mediacontrol_stop
(
mediacontrol_Instance
*
self
,
const
mediacontrol_Position
*
a_position
,
mediacontrol_Exception
*
exception
)
inline
void
libvlc_exception_raise
(
libvlc_exception_t
*
p_exception
,
char
*
psz_message
)
{