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
b0a1ac2e
Commit
b0a1ac2e
authored
Feb 02, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC media: remove exceptions
parent
c8869bbd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
57 deletions
+35
-57
include/vlc/libvlc_media.h
include/vlc/libvlc_media.h
+7
-13
src/control/media.c
src/control/media.c
+10
-22
src/control/media_discoverer.c
src/control/media_discoverer.c
+3
-4
src/control/media_internal.h
src/control/media_internal.h
+1
-2
src/control/media_list.c
src/control/media_list.c
+2
-4
test/libvlc/media_list.c
test/libvlc/media_list.c
+8
-8
test/libvlc/media_player.c
test/libvlc/media_player.c
+4
-4
No files found.
include/vlc/libvlc_media.h
View file @
b0a1ac2e
...
...
@@ -174,26 +174,22 @@ typedef struct libvlc_media_es_t
*
* \param p_instance the instance
* \param psz_mrl the MRL to read
* \param p_e an initialized exception pointer
* \return the newly created media
* \return the newly created media or NULL on error
*/
VLC_PUBLIC_API
libvlc_media_t
*
libvlc_media_new
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_mrl
,
libvlc_exception_t
*
p_e
);
const
char
*
psz_mrl
);
/**
* Create a media as an empty node with
the passed
name.
* Create a media as an empty node with
a given
name.
*
* \param p_instance the instance
* \param psz_name the name of the node
* \param p_e an initialized exception pointer
* \return the new empty media
* \return the new empty media or NULL on error
*/
VLC_PUBLIC_API
libvlc_media_t
*
libvlc_media_new_as_node
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_name
,
libvlc_exception_t
*
p_e
);
const
char
*
psz_name
);
/**
* Add an option to the media.
...
...
@@ -353,12 +349,10 @@ VLC_PUBLIC_API libvlc_event_manager_t *
* Get duration (in ms) of media descriptor object item.
*
* \param p_md media descriptor object
* \param p_e an initialized exception object
* \return duration of media item
* \return duration of media item or -1 on error
*/
VLC_PUBLIC_API
libvlc_time_t
libvlc_media_get_duration
(
libvlc_media_t
*
p_md
,
libvlc_exception_t
*
p_e
);
libvlc_media_get_duration
(
libvlc_media_t
*
p_md
);
/**
* Get preparsed status for media descriptor object.
...
...
src/control/media.c
View file @
b0a1ac2e
...
...
@@ -96,7 +96,7 @@ static void input_item_subitem_added( const vlc_event_t *p_event,
p_md_child
=
libvlc_media_new_from_input_item
(
p_md
->
p_libvlc_instance
,
p_event
->
u
.
input_item_subitem_added
.
p_new_child
,
NULL
);
p_event
->
u
.
input_item_subitem_added
.
p_new_child
);
/* Add this to our media list */
if
(
!
p_md
->
p_subitems
)
...
...
@@ -240,14 +240,12 @@ static void preparse_if_needed( libvlc_media_t *p_md )
**************************************************************************/
libvlc_media_t
*
libvlc_media_new_from_input_item
(
libvlc_instance_t
*
p_instance
,
input_item_t
*
p_input_item
,
libvlc_exception_t
*
p_e
)
input_item_t
*
p_input_item
)
{
libvlc_media_t
*
p_md
;
if
(
!
p_input_item
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"No input item given"
);
return
NULL
;
}
...
...
@@ -255,7 +253,6 @@ libvlc_media_t * libvlc_media_new_from_input_item(
p_md
=
calloc
(
1
,
sizeof
(
libvlc_media_t
)
);
if
(
!
p_md
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
...
...
@@ -297,10 +294,8 @@ libvlc_media_t * libvlc_media_new_from_input_item(
/**************************************************************************
* Create a new media descriptor object
**************************************************************************/
libvlc_media_t
*
libvlc_media_new
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_mrl
,
libvlc_exception_t
*
p_e
)
libvlc_media_t
*
libvlc_media_new
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_mrl
)
{
input_item_t
*
p_input_item
;
libvlc_media_t
*
p_md
;
...
...
@@ -309,13 +304,11 @@ libvlc_media_t * libvlc_media_new(
if
(
!
p_input_item
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
p_md
=
libvlc_media_new_from_input_item
(
p_instance
,
p_input_item
,
p_e
);
p_md
=
libvlc_media_new_from_input_item
(
p_instance
,
p_input_item
);
/* The p_input_item is retained in libvlc_media_new_from_input_item */
vlc_gc_decref
(
p_input_item
);
...
...
@@ -326,10 +319,8 @@ libvlc_media_t * libvlc_media_new(
/**************************************************************************
* Create a new media descriptor object
**************************************************************************/
libvlc_media_t
*
libvlc_media_new_as_node
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_name
,
libvlc_exception_t
*
p_e
)
libvlc_media_t
*
libvlc_media_new_as_node
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_name
)
{
input_item_t
*
p_input_item
;
libvlc_media_t
*
p_md
;
...
...
@@ -338,13 +329,11 @@ libvlc_media_t * libvlc_media_new_as_node(
if
(
!
p_input_item
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
p_md
=
libvlc_media_new_from_input_item
(
p_instance
,
p_input_item
,
p_e
);
p_md
=
libvlc_media_new_from_input_item
(
p_instance
,
p_input_item
);
p_md
->
p_subitems
=
libvlc_media_list_new
(
p_md
->
p_libvlc_instance
);
...
...
@@ -427,7 +416,7 @@ libvlc_media_t *
libvlc_media_duplicate
(
libvlc_media_t
*
p_md_orig
)
{
return
libvlc_media_new_from_input_item
(
p_md_orig
->
p_libvlc_instance
,
p_md_orig
->
p_input_item
,
NULL
);
p_md_orig
->
p_libvlc_instance
,
p_md_orig
->
p_input_item
);
}
/**************************************************************************
...
...
@@ -585,13 +574,12 @@ libvlc_media_event_manager( libvlc_media_t * p_md )
* Get duration of media object (in ms)
**************************************************************************/
int64_t
libvlc_media_get_duration
(
libvlc_media_t
*
p_md
,
libvlc_exception_t
*
p_e
)
libvlc_media_get_duration
(
libvlc_media_t
*
p_md
)
{
assert
(
p_md
);
if
(
!
p_md
->
p_input_item
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"No input item"
);
return
-
1
;
}
...
...
src/control/media_discoverer.c
View file @
b0a1ac2e
...
...
@@ -66,9 +66,8 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
libvlc_media_discoverer_t
*
p_mdis
=
user_data
;
libvlc_media_list_t
*
p_mlist
=
p_mdis
->
p_mlist
;
p_md
=
libvlc_media_new_from_input_item
(
p_mdis
->
p_libvlc_instance
,
p_item
,
NULL
);
p_md
=
libvlc_media_new_from_input_item
(
p_mdis
->
p_libvlc_instance
,
p_item
);
/* If we have a category, that mean we have to group the items having
* that category in a media_list. */
...
...
@@ -79,7 +78,7 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
if
(
p_mlist
==
kVLCDictionaryNotFound
)
{
libvlc_media_t
*
p_catmd
;
p_catmd
=
libvlc_media_new_as_node
(
p_mdis
->
p_libvlc_instance
,
psz_cat
,
NULL
);
p_catmd
=
libvlc_media_new_as_node
(
p_mdis
->
p_libvlc_instance
,
psz_cat
);
p_mlist
=
libvlc_media_subitems
(
p_catmd
);
p_mlist
->
b_read_only
=
true
;
...
...
src/control/media_internal.h
View file @
b0a1ac2e
...
...
@@ -46,8 +46,7 @@ struct libvlc_media_t
/* Media Descriptor */
libvlc_media_t
*
libvlc_media_new_from_input_item
(
libvlc_instance_t
*
,
input_item_t
*
,
libvlc_exception_t
*
);
libvlc_instance_t
*
,
input_item_t
*
);
void
libvlc_media_set_state
(
libvlc_media_t
*
,
libvlc_state_t
);
...
...
src/control/media_list.c
View file @
b0a1ac2e
...
...
@@ -265,10 +265,8 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
return
;
}
p_md
=
libvlc_media_new_from_input_item
(
p_mlist
->
p_libvlc_instance
,
p_input_item
,
p_e
);
p_md
=
libvlc_media_new_from_input_item
(
p_mlist
->
p_libvlc_instance
,
p_input_item
);
if
(
!
p_md
)
{
vlc_gc_decref
(
p_input_item
);
...
...
test/libvlc/media_list.c
View file @
b0a1ac2e
...
...
@@ -38,12 +38,12 @@ static void test_media_list (const char ** argv, int argc)
ml
=
libvlc_media_list_new
(
vlc
);
assert
(
ml
!=
NULL
);
md1
=
libvlc_media_new
(
vlc
,
"/dev/null"
,
&
ex
);
catch
(
);
md2
=
libvlc_media_new
(
vlc
,
"/dev/null"
,
&
ex
);
catch
(
);
md3
=
libvlc_media_new
(
vlc
,
"/dev/null"
,
&
ex
);
catch
(
);
md1
=
libvlc_media_new
(
vlc
,
"/dev/null"
);
assert
(
md1
!=
NULL
);
md2
=
libvlc_media_new
(
vlc
,
"/dev/null"
);
assert
(
md2
!=
NULL
);
md3
=
libvlc_media_new
(
vlc
,
"/dev/null"
);
assert
(
md3
!=
NULL
);
libvlc_media_list_add_media
(
ml
,
md1
,
&
ex
);
catch
();
...
...
@@ -105,8 +105,8 @@ static void test_media_list (const char ** argv, int argc)
p_non_exist
=
libvlc_media_list_item_at_index
(
ml
,
-
1
,
&
ex
);
assert
(
have_exception
());
md4
=
libvlc_media_new
(
vlc
,
"/dev/null"
,
&
ex
);
catch
(
);
md4
=
libvlc_media_new
(
vlc
,
"/dev/null"
);
assert
(
md4
!=
NULL
);
/* try to find non inserted item */
int
i_non_exist
=
0
;
...
...
test/libvlc/media_player.c
View file @
b0a1ac2e
...
...
@@ -36,8 +36,8 @@ static void test_media_player_play_stop(const char** argv, int argc)
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
(
);
md
=
libvlc_media_new
(
vlc
,
file
);
assert
(
md
!=
NULL
);
mi
=
libvlc_media_player_new_from_media
(
md
);
assert
(
mi
!=
NULL
);
...
...
@@ -74,8 +74,8 @@ static void test_media_player_pause_stop(const char** argv, int argc)
vlc
=
libvlc_new
(
argc
,
argv
);
assert
(
vlc
!=
NULL
);
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
(
);
md
=
libvlc_media_new
(
vlc
,
file
);
assert
(
md
!=
NULL
);
mi
=
libvlc_media_player_new_from_media
(
md
);
assert
(
mi
!=
NULL
);
...
...
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