Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
09020b63
Commit
09020b63
authored
Jan 31, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC core: remove exceptions
parent
0851b345
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
51 additions
and
94 deletions
+51
-94
bin/cachegen.c
bin/cachegen.c
+1
-4
bin/vlc.c
bin/vlc.c
+2
-5
bin/winvlc.c
bin/winvlc.c
+3
-9
include/vlc/libvlc.h
include/vlc/libvlc.h
+3
-5
src/control/core.c
src/control/core.c
+14
-31
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+0
-9
src/control/mediacontrol_core.c
src/control/mediacontrol_core.c
+3
-5
test/libvlc/core.c
test/libvlc/core.c
+2
-2
test/libvlc/events.c
test/libvlc/events.c
+2
-2
test/libvlc/media_list.c
test/libvlc/media_list.c
+2
-2
test/libvlc/media_list_player.c
test/libvlc/media_list_player.c
+11
-11
test/libvlc/media_player.c
test/libvlc/media_player.c
+4
-4
test/libvlc/meta.c
test/libvlc/meta.c
+2
-2
test/src/misc/variables.c
test/src/misc/variables.c
+2
-3
No files found.
bin/cachegen.c
View file @
09020b63
...
...
@@ -96,10 +96,7 @@ int main (int argc, char *argv[])
};
size_t
vlc_argc
=
sizeof
(
vlc_argv
)
/
sizeof
(
vlc_argv
[
0
])
-
1
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_instance_t
*
vlc
=
libvlc_new
(
vlc_argc
,
vlc_argv
,
&
ex
);
libvlc_instance_t
*
vlc
=
libvlc_new
(
vlc_argc
,
vlc_argv
);
if
(
vlc
!=
NULL
)
libvlc_release
(
vlc
);
free
(
arg
);
...
...
bin/vlc.c
View file @
09020b63
...
...
@@ -150,11 +150,8 @@ int main( int i_argc, const char *ppsz_argv[] )
return
1
;
// BOOM!
argv
[
argc
]
=
NULL
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
/* Initialize libvlc */
libvlc_instance_t
*
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
libvlc_instance_t
*
vlc
=
libvlc_new
(
argc
,
argv
);
if
(
vlc
!=
NULL
)
{
...
...
@@ -174,5 +171,5 @@ int main( int i_argc, const char *ppsz_argv[] )
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
LocaleFree
(
argv
[
i
]);
return
vlc
==
NULL
||
libvlc_exception_raised
(
&
ex
)
;
return
0
;
}
bin/winvlc.c
View file @
09020b63
...
...
@@ -123,7 +123,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
#endif
int
nCmdShow
)
{
int
argc
,
ret
;
int
argc
;
#ifndef UNDER_CE
HeapSetInformation
(
NULL
,
HeapEnableTerminationOnCorruption
,
NULL
,
0
);
wchar_t
**
wargv
=
CommandLineToArgvW
(
GetCommandLine
(),
&
argc
);
...
...
@@ -169,12 +169,9 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
argc
=
parse_cmdline
(
psz_cmdline
,
&
argv
);
#endif
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
/* Initialize libvlc */
libvlc_instance_t
*
vlc
;
vlc
=
libvlc_new
(
argc
,
(
const
char
**
)
argv
,
&
ex
);
vlc
=
libvlc_new
(
argc
,
(
const
char
**
)
argv
);
if
(
vlc
!=
NULL
)
{
libvlc_add_intf
(
vlc
,
"globalhotkeys,none"
);
...
...
@@ -184,14 +181,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
libvlc_release
(
vlc
);
}
ret
=
libvlc_exception_raised
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
free
(
argv
[
i
]);
(
void
)
hInstance
;
(
void
)
hPrevInstance
;
(
void
)
lpCmdLine
;
(
void
)
nCmdShow
;
return
ret
;
return
0
;
}
#if !defined( UNDER_CE ) && !defined( _WIN64 )
...
...
include/vlc/libvlc.h
View file @
09020b63
...
...
@@ -162,13 +162,11 @@ const char *libvlc_printerr (const char *fmt, ...);
* Create and initialize a libvlc instance.
*
* \param argc the number of arguments
* \param argv command-line-type arguments. argv[0] must be the path of the
* calling program.
* \param p_e an initialized exception pointer
* \return the libvlc instance
* \param argv command-line-type arguments
* \return the libvlc instance or NULL in case of error
*/
VLC_PUBLIC_API
libvlc_instance_t
*
libvlc_new
(
int
,
const
char
*
const
*
,
libvlc_exception_t
*
);
libvlc_new
(
int
,
const
char
*
const
*
);
/**
* Decrement the reference count of a libvlc instance, and destroy it
...
...
src/control/core.c
View file @
09020b63
...
...
@@ -78,49 +78,28 @@ void libvlc_exception_raise( libvlc_exception_t *p_exception )
p_exception
->
b_raised
=
1
;
}
libvlc_instance_t
*
libvlc_new
(
int
argc
,
const
char
*
const
*
argv
,
libvlc_exception_t
*
p_e
)
libvlc_instance_t
*
libvlc_new
(
int
argc
,
const
char
*
const
*
argv
)
{
libvlc_instance_t
*
p_new
;
int
i_ret
;
libvlc_instance_t
*
p_new
=
malloc
(
sizeof
(
*
p_new
));
if
(
unlikely
(
p_new
==
NULL
))
return
NULL
;
libvlc_init_threads
();
libvlc_int_t
*
p_libvlc_int
=
libvlc_InternalCreate
();
if
(
!
p_libvlc_int
)
{
libvlc_deinit_threads
();
RAISENULL
(
"VLC initialization failed"
);
}
p_new
=
malloc
(
sizeof
(
libvlc_instance_t
)
);
if
(
!
p_new
)
{
libvlc_deinit_threads
();
RAISENULL
(
"Out of memory"
);
}
const
char
*
my_argv
[
argc
+
2
];
my_argv
[
0
]
=
"libvlc"
;
/* dummy arg0, skipped by getopt() et al */
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
my_argv
[
i
+
1
]
=
argv
[
i
];
my_argv
[
argc
+
1
]
=
NULL
;
/* C calling conventions require a NULL */
/** \todo Look for interface settings. If we don't have any, add -I dummy */
/* Because we probably don't want a GUI by default */
libvlc_int_t
*
p_libvlc_int
=
libvlc_InternalCreate
();
if
(
unlikely
(
p_libvlc_int
==
NULL
))
goto
error
;
i_ret
=
libvlc_InternalInit
(
p_libvlc_int
,
argc
+
1
,
my_argv
);
if
(
i_ret
)
if
(
libvlc_InternalInit
(
p_libvlc_int
,
argc
+
1
,
my_argv
))
{
libvlc_InternalDestroy
(
p_libvlc_int
);
free
(
p_new
);
libvlc_deinit_threads
();
if
(
i_ret
==
VLC_EEXITSUCCESS
)
return
NULL
;
else
RAISENULL
(
"VLC initialization failed"
);
goto
error
;
}
p_new
->
p_libvlc_int
=
p_libvlc_int
;
...
...
@@ -131,8 +110,12 @@ libvlc_instance_t * libvlc_new( int argc, const char *const *argv,
p_new
->
verbosity
=
1
;
p_new
->
p_callback_list
=
NULL
;
vlc_mutex_init
(
&
p_new
->
instance_lock
);
return
p_new
;
error:
libvlc_deinit_threads
();
free
(
p_new
);
return
NULL
;
}
void
libvlc_retain
(
libvlc_instance_t
*
p_instance
)
...
...
src/control/libvlc_internal.h
View file @
09020b63
...
...
@@ -99,15 +99,6 @@ void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager,
libvlc_callback_t
pf_callback
,
void
*
p_user_data
);
/* Exception shorcuts */
#define RAISENULL( ... ) { libvlc_printerr(__VA_ARGS__); \
libvlc_exception_raise( p_e ); \
return NULL; }
#define RAISEZERO( ... ) { libvlc_printerr(__VA_ARGS__); \
libvlc_exception_raise( p_e ); \
return 0; }
static
inline
libvlc_time_t
from_mtime
(
mtime_t
time
)
{
return
(
time
+
500ULL
)
/
1000ULL
;
...
...
src/control/mediacontrol_core.c
View file @
09020b63
...
...
@@ -51,17 +51,15 @@
mediacontrol_Instance
*
mediacontrol_new
(
int
argc
,
char
**
argv
,
mediacontrol_Exception
*
exception
)
{
mediacontrol_Instance
*
retval
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
mediacontrol_exception_init
(
exception
);
retval
=
(
mediacontrol_Instance
*
)
malloc
(
sizeof
(
mediacontrol_Instance
)
);
if
(
!
retval
)
RAISE_NULL
(
mediacontrol_InternalException
,
"Out of memory"
);
retval
->
p_instance
=
libvlc_new
(
argc
,
(
const
char
**
)
argv
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_NULL
(
&
ex
);
retval
->
p_instance
=
libvlc_new
(
argc
,
(
const
char
**
)
argv
);
if
(
!
retval
->
p_instance
)
RAISE_NULL
(
mediacontrol_InternalException
,
"Out of memory"
);
retval
->
p_media_player
=
libvlc_media_player_new
(
retval
->
p_instance
);
if
(
!
retval
->
p_media_player
)
RAISE_NULL
(
mediacontrol_InternalException
,
"Out of memory"
);
...
...
test/libvlc/core.c
View file @
09020b63
...
...
@@ -30,8 +30,8 @@ static void test_core (const char ** argv, int argc)
log
(
"Testing core
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
libvlc_retain
(
vlc
);
libvlc_release
(
vlc
);
...
...
test/libvlc/events.c
View file @
09020b63
...
...
@@ -75,8 +75,8 @@ static void test_events (const char ** argv, int argc)
log
(
"Testing events
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
mi
=
libvlc_media_player_new
(
vlc
);
assert
(
mi
!=
NULL
);
...
...
test/libvlc/media_list.c
View file @
09020b63
...
...
@@ -32,8 +32,8 @@ static void test_media_list (const char ** argv, int argc)
log
(
"Testing media_list
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
ml
=
libvlc_media_list_new
(
vlc
);
assert
(
ml
!=
NULL
);
...
...
test/libvlc/media_list_player.c
View file @
09020b63
...
...
@@ -101,8 +101,8 @@ static void test_media_list_player_items_queue(const char** argv, int argc)
log
(
"Testing media player item queue-ing
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
@@ -172,8 +172,8 @@ static void test_media_list_player_previous(const char** argv, int argc)
log
(
"Testing media player previous()
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
@@ -249,8 +249,8 @@ static void test_media_list_player_next(const char** argv, int argc)
log
(
"Testing media player next()
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
@@ -325,8 +325,8 @@ static void test_media_list_player_pause_stop(const char** argv, int argc)
log
(
"Testing play and pause of %s using the media list.
\n
"
,
file
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
@@ -373,7 +373,7 @@ static void test_media_list_player_play_item_at_index(const char** argv, int arg
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
@@ -428,8 +428,8 @@ static void test_media_list_player_playback_options (const char** argv, int argc
log
(
"Testing media player playback options()
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
/*
* Create the following media tree:
...
...
test/libvlc/media_player.c
View file @
09020b63
...
...
@@ -33,8 +33,8 @@ static void test_media_player_play_stop(const char** argv, int argc)
log
(
"Testing play and pause of %s
\n
"
,
file
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
@@ -71,8 +71,8 @@ static void test_media_player_pause_stop(const char** argv, int argc)
log
(
"Testing pause and stop of %s
\n
"
,
file
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
...
...
test/libvlc/meta.c
View file @
09020b63
...
...
@@ -35,8 +35,8 @@ static void test_meta (const char ** argv, int argc)
log
(
"Testing meta
\n
"
);
libvlc_exception_init
(
&
ex
);
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
(
);
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
media
=
libvlc_media_new
(
vlc
,
"samples/meta.sample"
,
&
ex
);
catch
();
...
...
test/src/misc/variables.c
View file @
09020b63
...
...
@@ -446,9 +446,8 @@ int main( void )
test_init
();
log
(
"Testing the core variables
\n
"
);
libvlc_exception_init
(
&
ex
);
p_vlc
=
libvlc_new
(
test_defaults_nargs
,
test_defaults_args
,
&
ex
);
catch
();
p_vlc
=
libvlc_new
(
test_defaults_nargs
,
test_defaults_args
);
assert
(
p_vlc
!=
NULL
);
test_variables
(
p_vlc
);
...
...
Write
Preview
Markdown
is supported
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