Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
c365acef
Commit
c365acef
authored
Mar 19, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
media_instance: Don't rely on vlc_object_find now that input refcounting is fixed.
parent
af3a9f1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
40 deletions
+25
-40
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+1
-2
src/control/media_instance.c
src/control/media_instance.c
+22
-35
src/control/video.c
src/control/video.c
+2
-3
No files found.
src/control/libvlc_internal.h
View file @
c365acef
...
...
@@ -183,8 +183,7 @@ struct libvlc_media_instance_t
{
int
i_refcount
;
vlc_mutex_t
object_lock
;
int
i_input_id
;
/* Input object id. We don't use a pointer to
avoid any crash */
input_thread_t
*
p_input_thread
;
struct
libvlc_instance_t
*
p_libvlc_instance
;
/* Parent instance */
libvlc_media_descriptor_t
*
p_md
;
/* current media descriptor */
libvlc_event_manager_t
*
p_event_manager
;
...
...
src/control/media_instance.c
View file @
c365acef
...
...
@@ -74,18 +74,12 @@ static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
*/
static
void
release_input_thread
(
libvlc_media_instance_t
*
p_mi
)
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
if
(
!
p_mi
||
p_mi
->
i_input_id
==
-
1
)
if
(
!
p_mi
||
!
p_mi
->
p_input_thread
)
return
;
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
p_mi
->
i_input_id
);
p_mi
->
i_input_id
=
-
1
;
if
(
!
p_input_thread
)
return
;
p_input_thread
=
p_mi
->
p_input_thread
;
/* No one is tracking this input_thread appart us. Destroy it */
if
(
p_mi
->
b_own_its_input_thread
)
...
...
@@ -101,13 +95,10 @@ static void release_input_thread( libvlc_media_instance_t *p_mi )
var_Destroy
(
p_input_thread
,
"drawable"
);
}
else
{
vlc_object_release
(
p_input_thread
);
}
/* release for previous vlc_object_get */
vlc_object_release
(
p_input_thread
);
p_mi
->
p_input_thread
=
NULL
;
}
/*
...
...
@@ -121,27 +112,21 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_instance_t *p_mi,
{
input_thread_t
*
p_input_thread
;
if
(
!
p_mi
)
{
RAISENULL
(
"Input is NULL"
);
}
if
(
!
p_mi
)
RAISENULL
(
"Media Instance is NULL"
);
vlc_mutex_lock
(
&
p_mi
->
object_lock
);
if
(
!
p_mi
||
p_mi
->
i_input_id
==
-
1
)
if
(
!
p_mi
->
p_input_thread
)
{
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
RAISENULL
(
"Input is NULL"
);
}
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
p_mi
->
i_input_id
);
if
(
!
p_input_thread
)
{
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
RAISENULL
(
"Input does not exist"
);
}
p_input_thread
=
p_mi
->
p_input_thread
;
vlc_object_yield
(
p_input_thread
);
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
return
p_input_thread
;
}
...
...
@@ -308,7 +293,7 @@ libvlc_media_instance_new( libvlc_instance_t * p_libvlc_instance,
p_mi
->
p_md
=
NULL
;
p_mi
->
drawable
=
0
;
p_mi
->
p_libvlc_instance
=
p_libvlc_instance
;
p_mi
->
i_input_id
=
-
1
;
p_mi
->
p_input_thread
=
NULL
;
/* refcount strategy:
* - All items created by _new start with a refcount set to 1
* - Accessor _release decrease the refcount by 1, if after that
...
...
@@ -401,12 +386,12 @@ libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread(
return
NULL
;
}
p_mi
->
i_input_id
=
p_input
->
i_object_id
;
p_mi
->
b_own_its_input_thread
=
VLC_FALSE
;
/* will be released in media_instance_release() */
vlc_object_yield
(
p_input
);
p_mi
->
p_input_thread
=
p_input
;
p_mi
->
b_own_its_input_thread
=
VLC_FALSE
;
return
p_mi
;
}
...
...
@@ -580,17 +565,20 @@ void libvlc_media_instance_play( libvlc_media_instance_t *p_mi,
return
;
}
p_mi
->
i_input_id
=
input_Read
(
p_mi
->
p_libvlc_instance
->
p_libvlc_int
,
p_mi
->
p_md
->
p_input_item
,
VLC_FALSE
);
int
i_input_id
=
input_Read
(
p_mi
->
p_libvlc_instance
->
p_libvlc_int
,
p_mi
->
p_md
->
p_input_item
,
VLC_FALSE
);
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
p_mi
->
i_input_id
);
/* Released in input_release */
p_mi
->
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
i_input_id
);
if
(
!
p_input_thread
)
if
(
!
p_
mi
->
p_
input_thread
)
{
return
;
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
}
p_input_thread
=
p_mi
->
p_input_thread
;
if
(
p_mi
->
drawable
)
{
vlc_value_t
val
;
...
...
@@ -604,7 +592,6 @@ void libvlc_media_instance_play( libvlc_media_instance_t *p_mi,
var_AddCallback
(
p_input_thread
,
"intf-change"
,
input_position_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"intf-change"
,
input_time_changed
,
p_mi
);
vlc_object_release
(
p_input_thread
);
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
}
...
...
src/control/video.c
View file @
c365acef
...
...
@@ -147,8 +147,8 @@ libvlc_video_take_snapshot( libvlc_media_instance_t *p_mi, char *psz_filepath,
var_SetInteger
(
p_vout
,
"snapshot-width"
,
i_width
);
var_SetInteger
(
p_vout
,
"snapshot-height"
,
i_height
);
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
p_mi
->
i_input_id
)
;
if
(
!
p_input_thread
)
p_input_thread
=
p_mi
->
p_input_thread
;
if
(
!
p_
mi
->
p_
input_thread
)
{
libvlc_exception_raise
(
p_e
,
"Input does not exist"
);
return
;
...
...
@@ -159,7 +159,6 @@ libvlc_video_take_snapshot( libvlc_media_instance_t *p_mi, char *psz_filepath,
vout_Control
(
p_vout
,
VOUT_SNAPSHOT
);
vlc_object_release
(
p_vout
);
vlc_object_release
(
p_input_thread
);
}
int
libvlc_video_get_height
(
libvlc_media_instance_t
*
p_mi
,
...
...
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