Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
664fa731
Commit
664fa731
authored
Aug 07, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control/media_instance.c: Code factorization.
parent
6a1415be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
25 deletions
+15
-25
src/control/media_instance.c
src/control/media_instance.c
+15
-25
No files found.
src/control/media_instance.c
View file @
664fa731
...
...
@@ -48,7 +48,7 @@ static void release_input_thread( libvlc_media_instance_t *p_mi )
if
(
!
p_input_thread
)
return
;
/* release for previous vlc_object_get */
vlc_object_release
(
p_input_thread
);
...
...
@@ -101,13 +101,12 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_instance_t *p_mi,
return
p_input_thread
;
}
/**************************************************************************
* Create a Media Instance object
**************************************************************************/
libvlc_media_instance_t
*
libvlc_media_instance_new
(
libvlc_instance_t
*
p_libvlc_instance
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
libvlc_media_instance_t
*
p_mi
;
...
...
@@ -146,22 +145,12 @@ libvlc_media_instance_new_from_media_descriptor(
libvlc_exception_t
*
p_e
)
{
libvlc_media_instance_t
*
p_mi
;
p_mi
=
libvlc_media_instance_new
(
p_md
->
p_libvlc_instance
,
p_e
);
if
(
!
p_md
)
{
libvlc_exception_raise
(
p_e
,
"invalid media descriptor"
);
if
(
!
p_mi
)
return
NULL
;
}
p_mi
=
malloc
(
sizeof
(
libvlc_media_instance_t
)
);
p_mi
->
p_md
=
libvlc_media_descriptor_duplicate
(
p_md
);
p_mi
->
p_libvlc_instance
=
p_mi
->
p_md
->
p_libvlc_instance
;
p_mi
->
i_input_id
=
-
1
;
/* same strategy as before */
p_mi
->
i_refcount
=
1
;
/* same strategy as before */
vlc_mutex_init
(
p_mi
->
p_libvlc_instance
->
p_libvlc_int
,
&
p_mi
->
object_lock
);
return
p_mi
;
}
...
...
@@ -182,25 +171,23 @@ libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread(
return
NULL
;
}
p_mi
=
malloc
(
sizeof
(
libvlc_media_instance_t
)
);
p_mi
=
libvlc_media_instance_new
(
p_libvlc_instance
,
p_e
);
if
(
!
p_mi
)
return
NULL
;
p_mi
->
p_md
=
libvlc_media_descriptor_new_from_input_item
(
p_libvlc_instance
,
p_input
->
p
->
input
.
p_item
,
p_e
);
if
(
!
p_mi
->
p_md
)
{
free
(
p_mi
);
libvlc_media_instance_destroy
(
p_mi
);
return
NULL
;
}
p_mi
->
p_libvlc_instance
=
p_libvlc_instance
;
p_mi
->
i_input_id
=
p_input
->
i_object_id
;
/* same strategy as before */
p_mi
->
i_refcount
=
1
;
/* same strategy as before */
vlc_mutex_init
(
p_mi
->
p_libvlc_instance
->
p_libvlc_int
,
&
p_mi
->
object_lock
);
/* will be released in media_instance_release() */
vlc_object_yield
(
p_input
);
...
...
@@ -229,8 +216,11 @@ void libvlc_media_instance_destroy( libvlc_media_instance_t *p_mi )
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
&
p_e
);
if
(
libvlc_exception_raised
(
&
p_e
)
)
{
free
(
p_mi
);
return
;
/* no need to worry about no input thread */
}
input_DestroyThread
(
p_input_thread
);
libvlc_media_descriptor_destroy
(
p_mi
->
p_md
);
...
...
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