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
acbdb684
Commit
acbdb684
authored
May 18, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepared for a better vout reuse.
parent
933b7aa1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
47 deletions
+44
-47
src/video_output/control.h
src/video_output/control.h
+4
-0
src/video_output/video_output.c
src/video_output/video_output.c
+40
-47
No files found.
src/video_output/control.h
View file @
acbdb684
...
...
@@ -32,6 +32,7 @@
enum
{
VOUT_CONTROL_INIT
,
VOUT_CONTROL_CLEAN
,
VOUT_CONTROL_REINIT
,
/* reinit */
#if 0
/* */
...
...
@@ -89,6 +90,9 @@ typedef struct {
unsigned
width
;
unsigned
height
;
}
window
;
struct
{
const
video_format_t
*
fmt
;
}
reinit
;
}
u
;
}
vout_control_cmd_t
;
...
...
src/video_output/video_output.c
View file @
acbdb684
...
...
@@ -98,63 +98,38 @@ static int VoutValidateFormat(video_format_t *dst,
* This function looks for a video output thread matching the current
* properties. If not found, it spawns a new one.
*****************************************************************************/
vout_thread_t
*
(
vout_Request
)(
vlc_object_t
*
p_this
,
vout_thread_t
*
p_
vout
,
const
video_format_t
*
p_
fmt
)
vout_thread_t
*
(
vout_Request
)(
vlc_object_t
*
object
,
vout_thread_t
*
vout
,
const
video_format_t
*
fmt
)
{
if
(
!
p_fmt
)
{
/* Video output is no longer used.
* TODO: support for reusing video outputs with proper _thread-safe_
* reference handling. */
if
(
p_vout
)
vout_CloseAndRelease
(
p_vout
);
if
(
!
fmt
)
{
if
(
vout
)
vout_CloseAndRelease
(
vout
);
return
NULL
;
}
/* If a video output was provided, lock it, otherwise look for one. */
if
(
p_vout
)
{
vlc_object_hold
(
p_vout
);
}
/* TODO: find a suitable unused video output */
/* If we now have a video output, check it has the right properties */
if
(
p_vout
)
{
if
(
!
video_format_IsSimilar
(
&
p_vout
->
p
->
original
,
p_fmt
)
)
{
/* We are not interested in this format, close this vout */
vout_CloseAndRelease
(
p_vout
);
vlc_object_release
(
p_vout
);
p_vout
=
NULL
;
}
else
{
/* This video output is cool! Hijack it. */
vlc_object_release
(
p_vout
);
}
/* If a vout is provided, try reusing it */
if
(
vout
)
{
spu_Attach
(
vout
->
p
->
p_spu
,
VLC_OBJECT
(
vout
),
false
);
vlc_object_detach
(
vout
);
if
(
p_vout
)
{
msg_Dbg
(
p_this
,
"reusing provided vout"
)
;
vout_control_cmd_t
cmd
;
vout_control_cmd_Init
(
&
cmd
,
VOUT_CONTROL_REINIT
);
cmd
.
u
.
reinit
.
fmt
=
fmt
;
spu_Attach
(
p_vout
->
p
->
p_spu
,
VLC_OBJECT
(
p_vout
),
false
);
vlc_object_detach
(
p_vout
);
vout_control_Push
(
&
vout
->
p
->
control
,
&
cmd
);
vout_control_WaitEmpty
(
&
vout
->
p
->
control
);
if
(
!
vout
->
p
->
dead
)
{
vlc_object_attach
(
vout
,
object
);
spu_Attach
(
vout
->
p
->
p_spu
,
VLC_OBJECT
(
vout
),
true
);
vlc_object_attach
(
p_vout
,
p_this
);
spu_Attach
(
p_vout
->
p
->
p_spu
,
VLC_OBJECT
(
p_vout
),
true
)
;
msg_Dbg
(
object
,
"reusing provided vout"
);
return
vout
;
}
}
if
(
!
p_vout
)
{
msg_Dbg
(
p_this
,
"no usable vout present, spawning one"
);
vout_CloseAndRelease
(
vout
);
p_vout
=
vout_Create
(
p_this
,
p_fmt
);
msg_Warn
(
object
,
"cannot reuse provided vout"
);
}
return
p_vout
;
return
vout_Create
(
object
,
fmt
);
}
/*****************************************************************************
...
...
@@ -958,6 +933,18 @@ static void ThreadClean(vout_thread_t *vout)
vout
->
p
->
dead
=
true
;
vout_control_Dead
(
&
vout
->
p
->
control
);
}
static
int
ThreadReinit
(
vout_thread_t
*
vout
,
const
video_format_t
*
fmt
)
{
video_format_t
original
;
if
(
VoutValidateFormat
(
&
original
,
fmt
))
return
VLC_EGENERIC
;
if
(
video_format_IsSimilar
(
&
original
,
&
vout
->
p
->
original
))
return
VLC_SUCCESS
;
/* TODO */
return
VLC_EGENERIC
;
}
/*****************************************************************************
* Thread: video output thread
...
...
@@ -995,6 +982,12 @@ static void *Thread(void *object)
case
VOUT_CONTROL_CLEAN
:
ThreadClean
(
vout
);
return
NULL
;
case
VOUT_CONTROL_REINIT
:
if
(
ThreadReinit
(
vout
,
cmd
.
u
.
reinit
.
fmt
))
{
ThreadClean
(
vout
);
return
NULL
;
}
break
;
case
VOUT_CONTROL_OSD_TITLE
:
ThreadDisplayOsdTitle
(
vout
,
cmd
.
u
.
string
);
break
;
...
...
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