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
Gautam Chitnis
web-ui-redesign
Commits
d3bb1243
Commit
d3bb1243
authored
Sep 25, 2006
by
Olivier Aubert
Browse files
mediacontrol_new: new API (pass argc and argv), use the new libvlc_new API
parent
8261a227
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/mediacontrol_internal.h
View file @
d3bb1243
...
...
@@ -49,8 +49,8 @@ vlc_int64_t mediacontrol_position2microsecond(
#define RAISE( c, m ) exception->code = c; \
exception->message = strdup(m);
#define RAISE_NULL( c, m ) RAISE( c, m ); return NULL;
#define RAISE_VOID( c, m ) RAISE( c, m ); return;
#define RAISE_NULL( c, m )
{
RAISE( c, m ); return NULL;
}
#define RAISE_VOID( c, m )
{
RAISE( c, m ); return;
}
#define HANDLE_LIBVLC_EXCEPTION_VOID( e ) if( libvlc_exception_raised( e ) ) { \
RAISE( mediacontrol_InternalException, libvlc_exception_get_message( e )); \
...
...
include/vlc/mediacontrol.h
View file @
d3bb1243
...
...
@@ -112,7 +112,7 @@ void mediacontrol_exception_free(mediacontrol_Exception *exception);
* Core functions
*****************************************************************************/
mediacontrol_Instance
*
mediacontrol_new
(
char
**
arg
s
,
mediacontrol_Exception
*
exception
);
mediacontrol_new
(
int
argc
,
char
**
arg
v
,
mediacontrol_Exception
*
exception
);
/* Bridge with the libvlc API */
mediacontrol_Instance
*
...
...
src/control/mediacontrol_core.c
View file @
d3bb1243
...
...
@@ -55,49 +55,19 @@
# include <sys/types.h>
#endif
mediacontrol_Instance
*
mediacontrol_new
(
char
**
arg
s
,
mediacontrol_Exception
*
exception
)
mediacontrol_Instance
*
mediacontrol_new
(
int
argc
,
char
**
arg
v
,
mediacontrol_Exception
*
exception
)
{
mediacontrol_Instance
*
retval
;
libvlc_exception_t
ex
;
char
**
ppsz_argv
;
int
i_count
=
0
;
int
i_index
;
char
**
p_tmp
;
libvlc_exception_init
(
&
ex
);
exception
=
mediacontrol_exception_init
(
exception
);
/* Copy args array */
if
(
args
)
{
for
(
p_tmp
=
args
;
*
p_tmp
!=
NULL
;
p_tmp
++
)
i_count
++
;
}
ppsz_argv
=
malloc
(
(
i_count
+
2
)
*
sizeof
(
char
*
)
)
;
if
(
!
ppsz_argv
)
{
RAISE_NULL
(
mediacontrol_InternalException
,
"out of memory"
);
}
ppsz_argv
[
0
]
=
"vlc"
;
for
(
i_index
=
0
;
i_index
<
i_count
;
i_index
++
)
{
ppsz_argv
[
i_index
+
1
]
=
strdup
(
args
[
i_index
]
);
if
(
!
ppsz_argv
[
i_index
+
1
]
)
{
RAISE_NULL
(
mediacontrol_InternalException
,
"out of memory"
);
}
}
ppsz_argv
[
i_count
+
2
]
=
NULL
;
retval
=
(
mediacontrol_Instance
*
)
malloc
(
sizeof
(
mediacontrol_Instance
)
);
if
(
!
retval
)
{
RAISE_NULL
(
mediacontrol_InternalException
,
"out of memory"
);
}
if
(
!
retval
)
RAISE_NULL
(
mediacontrol_InternalException
,
"Out of memory"
);
retval
->
p_instance
=
libvlc_new
(
i_count
+
1
,
ppsz_
argv
,
&
ex
);
retval
->
p_instance
=
libvlc_new
(
argc
,
argv
,
&
ex
);
retval
->
p_playlist
=
retval
->
p_instance
->
p_libvlc_int
->
p_playlist
;
HANDLE_LIBVLC_EXCEPTION_NULL
(
&
ex
);
return
retval
;
...
...
@@ -127,7 +97,7 @@ mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
retval
=
(
mediacontrol_Instance
*
)
malloc
(
sizeof
(
mediacontrol_Instance
)
);
if
(
!
retval
)
{
RAISE_NULL
(
mediacontrol_InternalException
,
"
o
ut of memory"
);
RAISE_NULL
(
mediacontrol_InternalException
,
"
O
ut of memory"
);
}
retval
->
p_instance
=
p_instance
;
retval
->
p_playlist
=
retval
->
p_instance
->
p_libvlc_int
->
p_playlist
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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