Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
8444ce12
Commit
8444ce12
authored
Feb 15, 2006
by
zorglub
Browse files
More VLM API stuff
parent
73c29a6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/vlc/libvlc.h
View file @
8444ce12
...
...
@@ -346,6 +346,42 @@ void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
void
libvlc_vlm_set_enabled
(
libvlc_instance_t
*
,
char
*
,
int
,
libvlc_exception_t
*
);
/**
* Set the output for a media
* \param p_instance the instance
* \param psz_name the media to work on
* \param psz_output the output MRL (the parameter to the "sout" variable)
* \param p_exception an initialized exception
*/
void
libvlc_vlm_set_output
(
libvlc_instance_t
*
,
char
*
,
char
*
,
libvlc_exception_t
*
);
/**
* Set a media's input MRL. This will delete all existing inputs and
* add the specified one.
* \param p_instance the instance
* \param psz_name the media to work on
* \param psz_input the input MRL
* \param p_exception an initialized exception
*/
void
libvlc_vlm_set_input
(
libvlc_instance_t
*
,
char
*
,
char
*
,
libvlc_exception_t
*
);
/**
* Set output for a media
* \param p_instance the instance
* \param psz_name the media to work on
* \param b_loop the new status
* \param p_exception an initialized exception
*/
void
libvlc_vlm_set_loop
(
libvlc_instance_t
*
,
char
*
,
int
,
libvlc_exception_t
*
);
/**
* Edit the parameters of a media. This will delete all existing inputs and
* add the specified one.
...
...
src/control/vlm.c
View file @
8444ce12
...
...
@@ -39,6 +39,13 @@ void InitVLM( libvlc_instance_t *p_instance )
libvlc_exception_raise( p_exception, \
"Unable to create VLM" ); return; } }
#define GET_MEDIA { p_media = vlm_MediaSearch( p_instance->p_vlm, psz_name );\
if( !p_media ) \
{ \
libvlc_exception_raise( p_exception, \
"Media %s does not exist", \
psz_name ); return; } }
void
libvlc_vlm_add_broadcast
(
libvlc_instance_t
*
p_instance
,
char
*
psz_name
,
char
*
psz_input
,
char
*
psz_output
,
int
i_options
,
char
**
ppsz_options
,
...
...
@@ -82,36 +89,103 @@ void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, char *psz_name,
{
vlm_media_t
*
p_media
;
CHECK_VLM
;
GET_MEDIA
;
if
(
b_enabled
!=
0
)
b_enabled
=
1
;
p_media
=
vlm_MediaSearch
(
p_instance
->
p_vlm
,
psz_name
);
if
(
!
p_media
)
{
libvlc_exception_raise
(
p_exception
,
"Media %s does not exist"
,
psz_name
);
return
;
}
p_media
->
b_enabled
=
b_enabled
;
}
void
libvlc_vlm_set_loop
(
libvlc_instance_t
*
p_instance
,
char
*
psz_name
,
int
b_loop
,
libvlc_exception_t
*
p_exception
)
{
vlm_media_t
*
p_media
;
CHECK_VLM
;
GET_MEDIA
;
if
(
b_loop
!=
0
)
b_loop
=
1
;
p_media
->
b_loop
=
b_loop
;
}
void
libvlc_vlm_set_output
(
libvlc_instance_t
*
p_instance
,
char
*
psz_name
,
char
*
psz_output
,
libvlc_exception_t
*
p_exception
)
{
vlm_media_t
*
p_media
;
int
i_ret
;
CHECK_VLM
;
GET_MEDIA
;
vlc_mutex_lock
(
&
p_instance
->
p_vlm
->
lock
);
i_ret
=
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"output"
,
psz_output
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to set output"
);
return
;}
vlc_mutex_unlock
(
&
p_instance
->
p_vlm
->
lock
);
}
void
libvlc_vlm_set_input
(
libvlc_instance_t
*
p_instance
,
char
*
psz_name
,
char
*
psz_input
,
libvlc_exception_t
*
p_exception
)
{
vlm_media_t
*
p_media
;
int
i_ret
;
CHECK_VLM
;
GET_MEDIA
;
vlc_mutex_lock
(
&
p_instance
->
p_vlm
->
lock
);
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"inputdel"
,
"all"
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to change input"
);
return
;}
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"input"
,
psz_input
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to change input"
);
return
;}
vlc_mutex_unlock
(
&
p_instance
->
p_vlm
->
lock
);
}
void
libvlc_vlm_add_input
(
libvlc_instance_t
*
p_instance
,
char
*
psz_name
,
char
*
psz_input
,
libvlc_exception_t
*
p_exception
)
{
vlm_media_t
*
p_media
;
int
i_ret
;
CHECK_VLM
;
GET_MEDIA
;
vlc_mutex_lock
(
&
p_instance
->
p_vlm
->
lock
);
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"input"
,
psz_input
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to change input"
);
return
;}
vlc_mutex_unlock
(
&
p_instance
->
p_vlm
->
lock
);
}
void
libvlc_vlm_change_media
(
libvlc_instance_t
*
p_instance
,
char
*
psz_name
,
char
*
psz_input
,
char
*
psz_output
,
int
i_options
,
char
**
ppsz_options
,
int
b_enabled
,
int
b_loop
,
libvlc_exception_t
*
p_exception
)
{
vlm_media_t
*
p_media
;
int
i_ret
;
CHECK_VLM
;
GET_MEDIA
;
if
(
b_enabled
!=
0
)
b_enabled
=
1
;
if
(
b_loop
!=
0
)
b_loop
=
1
;
p_media
=
vlm_MediaSearch
(
p_instance
->
p_vlm
,
psz_name
);
if
(
!
p_media
)
{
libvlc_exception_raise
(
p_exception
,
"Media %s does not exist"
,
psz_name
);
return
;
}
vlc_mutex_lock
(
&
p_instance
->
p_vlm
->
lock
);
i_ret
=
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"output"
,
psz_output
);
if
(
i_ret
)
libvlc_exception_raise
(
p_exception
,
"Unable to set output"
);
p_media
->
b_enabled
=
b_enabled
;
p_media
->
b_loop
=
b_loop
;
i_ret
=
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"output"
,
psz_output
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to set output"
);
return
;}
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"inputdel"
,
"all"
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to change input"
);
return
;}
vlm_MediaSetup
(
p_instance
->
p_vlm
,
p_media
,
"input"
,
psz_input
);
if
(
i_ret
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to change input"
);
return
;}
vlc_mutex_unlock
(
&
p_instance
->
p_vlm
->
lock
);
}
test/native/libvlc.c
View file @
8444ce12
...
...
@@ -93,15 +93,55 @@ static PyObject *vlm_test( PyObject *self, PyObject *args )
{
libvlc_instance_t
*
p_instance
;
char
*
argv
[]
=
{
"vlc"
,
"--quiet"
};
char
*
ppsz_empty
[]
=
{};
libvlc_exception_t
exception
;
libvlc_exception_init
(
&
exception
);
p_instance
=
libvlc_new
(
2
,
argv
,
&
exception
);
ASSERT_NOEXCEPTION
;
/* Test that working on unexisting streams fail */
libvlc_vlm_set_enabled
(
p_instance
,
"test"
,
1
,
&
exception
);
ASSERT_EXCEPTION
;
libvlc_exception_clear
(
&
exception
);
libvlc_vlm_set_input
(
p_instance
,
"test"
,
"input"
,
&
exception
);
ASSERT_EXCEPTION
;
libvlc_exception_clear
(
&
exception
);
libvlc_vlm_del_media
(
p_instance
,
"test"
,
&
exception
);
ASSERT_EXCEPTION
;
libvlc_exception_clear
(
&
exception
);
/******* Broadcast *******/
/* Now create a media */
libvlc_vlm_add_broadcast
(
p_instance
,
"test"
,
"input_test"
,
"output_test"
,
0
,
ppsz_empty
,
1
,
1
,
&
exception
);
ASSERT_NOEXCEPTION
;
libvlc_exception_clear
(
&
exception
);
/* Change its parameters */
libvlc_vlm_set_enabled
(
p_instance
,
"test"
,
0
,
&
exception
);
ASSERT_NOEXCEPTION
;
libvlc_exception_clear
(
&
exception
);
libvlc_vlm_set_output
(
p_instance
,
"test"
,
"output_test2"
,
&
exception
);
ASSERT_NOEXCEPTION
;
libvlc_exception_clear
(
&
exception
);
/* Check the parameters */
fprintf
(
stderr
,
"The code for this is not written yet
\n
"
);
/* Control it a bit */
fprintf
(
stderr
,
"The code for this is not written yet
\n
"
);
/* Try to delete it */
libvlc_vlm_del_media
(
p_instance
,
"test"
,
&
exception
);
ASSERT_NOEXCEPTION
;
libvlc_exception_clear
(
&
exception
);
libvlc_vlm_del_media
(
p_instance
,
"test"
,
&
exception
);
ASSERT_EXCEPTION
;
libvlc_exception_clear
(
&
exception
);
/******* VOD *******/
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment