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
72210bb4
Commit
72210bb4
authored
Mar 26, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: inline vlc_object_kill() and simplify
parent
7066acb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
40 deletions
+20
-40
src/input/input.c
src/input/input.c
+2
-23
src/libvlc.h
src/libvlc.h
+1
-2
src/misc/objects.c
src/misc/objects.c
+17
-15
No files found.
src/input/input.c
View file @
72210bb4
...
...
@@ -70,8 +70,6 @@ static int Init ( input_thread_t *p_input );
static
void
End
(
input_thread_t
*
p_input
);
static
void
MainLoop
(
input_thread_t
*
p_input
,
bool
b_interactive
);
static
void
ObjectKillChildrens
(
input_thread_t
*
,
vlc_object_t
*
);
static
inline
int
ControlPop
(
input_thread_t
*
,
int
*
,
vlc_value_t
*
,
mtime_t
i_deadline
,
bool
b_postpone_seek
);
static
void
ControlRelease
(
int
i_type
,
vlc_value_t
val
);
static
bool
ControlIsSeekRequest
(
int
i_type
);
...
...
@@ -242,7 +240,7 @@ void input_Stop( input_thread_t *p_input, bool b_abort )
/* Set die for input and ALL of this childrens (even (grand-)grand-childrens)
* It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to
* unlock the control loop */
ObjectKillChildrens
(
p_input
,
VLC_OBJECT
(
p_input
)
);
ObjectKillChildrens
(
VLC_OBJECT
(
p_input
)
);
vlc_mutex_lock
(
&
p_input
->
p
->
lock_control
);
p_input
->
p
->
b_abort
|=
b_abort
;
...
...
@@ -285,25 +283,6 @@ input_item_t *input_GetItem( input_thread_t *p_input )
return
p_input
->
p
->
p_item
;
}
/*****************************************************************************
* ObjectKillChildrens
*****************************************************************************/
static
void
ObjectKillChildrens
(
input_thread_t
*
p_input
,
vlc_object_t
*
p_obj
)
{
vlc_list_t
*
p_list
;
/* FIXME ObjectKillChildrens seems a very bad idea in fact */
if
(
p_obj
==
VLC_OBJECT
(
p_input
->
p
->
p_sout
)
)
return
;
vlc_object_kill
(
p_obj
);
p_list
=
vlc_list_children
(
p_obj
);
for
(
int
i
=
0
;
i
<
p_list
->
i_count
;
i
++
)
ObjectKillChildrens
(
p_input
,
p_list
->
p_values
[
i
].
p_object
);
vlc_list_release
(
p_list
);
}
/*****************************************************************************
* This function creates a new input, and returns a pointer
* to its description. On error, it returns NULL.
...
...
@@ -1686,7 +1665,7 @@ static bool Control( input_thread_t *p_input,
msg_Dbg
(
p_input
,
"control: stopping input"
);
/* Mark all submodules to die */
ObjectKillChildrens
(
p_input
,
VLC_OBJECT
(
p_input
)
);
ObjectKillChildrens
(
VLC_OBJECT
(
p_input
)
);
break
;
case
INPUT_CONTROL_SET_POSITION
:
...
...
src/libvlc.h
View file @
72210bb4
...
...
@@ -58,8 +58,7 @@ void vlc_CPU_dump(vlc_object_t *);
int
vlc_clone_detach
(
vlc_thread_t
*
,
void
*
(
*
)(
void
*
),
void
*
,
int
);
int
vlc_object_waitpipe
(
vlc_object_t
*
obj
);
void
vlc_object_kill
(
vlc_object_t
*
)
VLC_DEPRECATED
;
#define vlc_object_kill(o) vlc_object_kill(VLC_OBJECT(o))
void
ObjectKillChildrens
(
vlc_object_t
*
);
int
vlc_set_priority
(
vlc_thread_t
,
int
);
...
...
src/misc/objects.c
View file @
72210bb4
...
...
@@ -378,34 +378,36 @@ int vlc_object_waitpipe( vlc_object_t *obj )
return
internals
->
pipes
[
0
];
}
#undef vlc_object_kill
/**
* Requests termination of an object, cancels the object thread, and make the
* object wait pipe (if it exists) readable. Not a cancellation point.
* Hack for input objects. Should be removed eventually.
*/
void
vlc_object_kill
(
vlc_object_t
*
p_this
)
void
ObjectKillChildrens
(
vlc_object_t
*
p_obj
)
{
vlc_object_internals_t
*
priv
=
vlc_internals
(
p_this
);
int
fd
=
-
1
;
/* FIXME ObjectKillChildrens seems a very bad idea in fact */
/*if( p_obj == VLC_OBJECT(p_input->p->p_sout) ) return;*/
vlc_object_internals_t
*
priv
=
vlc_internals
(
p_obj
);
if
(
atomic_exchange
(
&
priv
->
alive
,
false
))
{
int
fd
;
vlc_mutex_lock
(
&
pipe_lock
);
fd
=
priv
->
pipes
[
1
];
vlc_mutex_unlock
(
&
pipe_lock
);
if
(
fd
!=
-
1
)
{
write
(
fd
,
&
(
uint64_t
){
1
},
sizeof
(
uint64_t
));
msg_Dbg
(
p_obj
,
"object waitpipe triggered"
);
}
}
if
(
fd
!=
-
1
)
{
int
canc
=
vlc_savecancel
();
/* write _after_ setting b_die, so vlc_object_alive() returns false */
write
(
fd
,
&
(
uint64_t
){
1
},
sizeof
(
uint64_t
));
msg_Dbg
(
p_this
,
"waitpipe: object killed"
);
vlc_restorecancel
(
canc
);
}
vlc_list_t
*
p_list
=
vlc_list_children
(
p_obj
);
for
(
int
i
=
0
;
i
<
p_list
->
i_count
;
i
++
)
ObjectKillChildrens
(
p_list
->
p_values
[
i
].
p_object
);
vlc_list_release
(
p_list
);
}
#undef vlc_object_find_name
/**
* Finds a named object and increment its reference count.
...
...
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