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
7e7f8be1
Commit
7e7f8be1
authored
May 21, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified the prototype of vout_Request and unexport unused vout_Create.
It will simplify improvements of vout_Request.
parent
9c1e5242
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
90 deletions
+75
-90
include/vlc_vout.h
include/vlc_vout.h
+19
-30
src/audio_output/input.c
src/audio_output/input.c
+5
-1
src/input/resource.c
src/input/resource.c
+5
-1
src/libvlccore.sym
src/libvlccore.sym
+0
-1
src/video_output/control.c
src/video_output/control.c
+1
-0
src/video_output/control.h
src/video_output/control.h
+2
-4
src/video_output/video_output.c
src/video_output/video_output.c
+43
-53
No files found.
include/vlc_vout.h
View file @
7e7f8be1
...
@@ -47,6 +47,14 @@
...
@@ -47,6 +47,14 @@
* @{
* @{
*/
*/
/**
* Vout configuration
*/
typedef
struct
{
vout_thread_t
*
vout
;
const
video_format_t
*
fmt
;
}
vout_configuration_t
;
/**
/**
* Video ouput thread private structure
* Video ouput thread private structure
*/
*/
...
@@ -59,8 +67,7 @@ typedef struct vout_thread_sys_t vout_thread_sys_t;
...
@@ -59,8 +67,7 @@ typedef struct vout_thread_sys_t vout_thread_sys_t;
* is represented by a video output thread, and described using the following
* is represented by a video output thread, and described using the following
* structure.
* structure.
*/
*/
struct
vout_thread_t
struct
vout_thread_t
{
{
VLC_COMMON_MEMBERS
VLC_COMMON_MEMBERS
/* Private vout_thread data */
/* Private vout_thread data */
...
@@ -83,42 +90,24 @@ struct vout_thread_t
...
@@ -83,42 +90,24 @@ struct vout_thread_t
*****************************************************************************/
*****************************************************************************/
/**
/**
* This function will
* Returns a suitable vout or release the given one.
* - returns a suitable vout (if requested by a non NULL p_fmt)
* - recycles an old vout (if given) by either destroying it or by saving it
* for latter usage.
*
*
* The purpose of this function is to avoid unnecessary creation/destruction of
* If cfg->fmt is non NULL and valid, a vout will be returned, reusing cfg->vout
* vout (and to allow optional vout reusing).
* is possible, otherwise it returns NULL.
* If cfg->vout is not used, it will be closed and released.
*
*
* You can call vout_Request on a vout created by vout_Create or by a previous
* call to vout_Request.
* You can release the returned value either by vout_Request or vout_Close()
* You can release the returned value either by vout_Request or vout_Close()
* followed by a vlc_object_release() or shorter vout_CloseAndRelease()
* followed by a vlc_object_release() or shorter vout_CloseAndRelease()
*
*
* \param p_this a vlc object
* \param object a vlc object
* \param p_vout a vout candidate
* \param cfg the video configuration requested.
* \param p_fmt the video format requested or NULL
* \return a vout
* \return a vout if p_fmt is non NULL and the request is successfull, NULL
* otherwise
*/
VLC_EXPORT
(
vout_thread_t
*
,
vout_Request
,
(
vlc_object_t
*
p_this
,
vout_thread_t
*
p_vout
,
const
video_format_t
*
p_fmt
)
);
#define vout_Request(a,b,c) vout_Request(VLC_OBJECT(a),b,c)
/**
* This function will create a suitable vout for a given p_fmt. It will never
* reuse an already existing unused vout.
*
* You have to call either vout_Close or vout_Request on the returned value
* \param p_this a vlc object to which the returned vout will be attached
* \param p_fmt the video format requested
* \return a vout if the request is successfull, NULL otherwise
*/
*/
VLC_EXPORT
(
vout_thread_t
*
,
vout_
Create
,
(
vlc_object_t
*
p_this
,
const
video_format_t
*
p_fmt
)
);
VLC_EXPORT
(
vout_thread_t
*
,
vout_
Request
,
(
vlc_object_t
*
object
,
const
vout_configuration_t
*
cfg
)
);
#define vout_
Create(a,b) vout_Create
(VLC_OBJECT(a),b)
#define vout_
Request(a,b) vout_Request
(VLC_OBJECT(a),b)
/**
/**
* This function will close a vout created by vout_
Create or vout_
Request.
* This function will close a vout created by vout_Request.
* The associated vout module is closed.
* The associated vout module is closed.
* Note: It is not released yet, you'll have to call vlc_object_release()
* Note: It is not released yet, you'll have to call vlc_object_release()
* or use the convenient vout_CloseAndRelease().
* or use the convenient vout_CloseAndRelease().
...
...
src/audio_output/input.c
View file @
7e7f8be1
...
@@ -815,7 +815,11 @@ static vout_thread_t *RequestVout( void *p_private,
...
@@ -815,7 +815,11 @@ static vout_thread_t *RequestVout( void *p_private,
{
{
aout_instance_t
*
p_aout
=
p_private
;
aout_instance_t
*
p_aout
=
p_private
;
VLC_UNUSED
(
b_recycle
);
VLC_UNUSED
(
b_recycle
);
return
vout_Request
(
p_aout
,
p_vout
,
p_fmt
);
vout_configuration_t
cfg
=
{
.
vout
=
p_vout
,
.
fmt
=
p_fmt
,
};
return
vout_Request
(
p_aout
,
&
cfg
);
}
}
vout_thread_t
*
aout_filter_RequestVout
(
filter_t
*
p_filter
,
vout_thread_t
*
aout_filter_RequestVout
(
filter_t
*
p_filter
,
...
...
src/input/resource.c
View file @
7e7f8be1
...
@@ -242,7 +242,11 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
...
@@ -242,7 +242,11 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
}
}
/* */
/* */
p_vout
=
vout_Request
(
p_resource
->
p_input
,
p_vout
,
p_fmt
);
vout_configuration_t
cfg
=
{
.
vout
=
p_vout
,
.
fmt
=
p_fmt
,
};
p_vout
=
vout_Request
(
p_resource
->
p_input
,
&
cfg
);
if
(
!
p_vout
)
if
(
!
p_vout
)
return
NULL
;
return
NULL
;
...
...
src/libvlccore.sym
View file @
7e7f8be1
...
@@ -611,7 +611,6 @@ vlm_MessageNew
...
@@ -611,7 +611,6 @@ vlm_MessageNew
vlm_MessageSimpleNew
vlm_MessageSimpleNew
vlm_New
vlm_New
vout_Close
vout_Close
vout_Create
vout_GetPicture
vout_GetPicture
vout_PutPicture
vout_PutPicture
vout_HoldPicture
vout_HoldPicture
...
...
src/video_output/control.c
View file @
7e7f8be1
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#endif
#endif
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_vout.h>
#include "control.h"
#include "control.h"
/* */
/* */
...
...
src/video_output/control.h
View file @
7e7f8be1
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
enum
{
enum
{
VOUT_CONTROL_INIT
,
VOUT_CONTROL_INIT
,
VOUT_CONTROL_CLEAN
,
VOUT_CONTROL_CLEAN
,
VOUT_CONTROL_REINIT
,
/*
reinit
*/
VOUT_CONTROL_REINIT
,
/*
cfg
*/
#if 0
#if 0
/* */
/* */
...
@@ -91,9 +91,7 @@ typedef struct {
...
@@ -91,9 +91,7 @@ typedef struct {
unsigned
width
;
unsigned
width
;
unsigned
height
;
unsigned
height
;
}
window
;
}
window
;
struct
{
const
vout_configuration_t
*
cfg
;
const
video_format_t
*
fmt
;
}
reinit
;
}
u
;
}
u
;
}
vout_control_cmd_t
;
}
vout_control_cmd_t
;
...
...
src/video_output/video_output.c
View file @
7e7f8be1
...
@@ -92,55 +92,11 @@ static int VoutValidateFormat(video_format_t *dst,
...
@@ -92,55 +92,11 @@ static int VoutValidateFormat(video_format_t *dst,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
static
vout_thread_t
*
VoutCreate
(
vlc_object_t
*
object
,
* vout_Request: find a video output thread, create one, or destroy one.
const
vout_configuration_t
*
cfg
)
*****************************************************************************
* 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
*
object
,
vout_thread_t
*
vout
,
const
video_format_t
*
fmt
)
{
if
(
!
fmt
)
{
if
(
vout
)
vout_CloseAndRelease
(
vout
);
return
NULL
;
}
/* If a vout is provided, try reusing it */
if
(
vout
)
{
spu_Attach
(
vout
->
p
->
p_spu
,
VLC_OBJECT
(
vout
),
false
);
vlc_object_detach
(
vout
);
vlc_object_attach
(
vout
,
object
);
spu_Attach
(
vout
->
p
->
p_spu
,
VLC_OBJECT
(
vout
),
true
);
vout_control_cmd_t
cmd
;
vout_control_cmd_Init
(
&
cmd
,
VOUT_CONTROL_REINIT
);
cmd
.
u
.
reinit
.
fmt
=
fmt
;
vout_control_Push
(
&
vout
->
p
->
control
,
&
cmd
);
vout_control_WaitEmpty
(
&
vout
->
p
->
control
);
if
(
!
vout
->
p
->
dead
)
{
msg_Dbg
(
object
,
"reusing provided vout"
);
return
vout
;
}
vout_CloseAndRelease
(
vout
);
msg_Warn
(
object
,
"cannot reuse provided vout"
);
}
return
vout_Create
(
object
,
fmt
);
}
/*****************************************************************************
* vout_Create: creates a new video output thread
*****************************************************************************
* This function creates a new video output thread, and returns a pointer
* to its description. On error, it returns NULL.
*****************************************************************************/
vout_thread_t
*
(
vout_Create
)(
vlc_object_t
*
object
,
const
video_format_t
*
fmt
)
{
{
video_format_t
original
;
video_format_t
original
;
if
(
VoutValidateFormat
(
&
original
,
fmt
))
if
(
VoutValidateFormat
(
&
original
,
cfg
->
fmt
))
return
NULL
;
return
NULL
;
/* Allocate descriptor */
/* Allocate descriptor */
...
@@ -214,11 +170,45 @@ vout_thread_t *(vout_Create)(vlc_object_t *object, const video_format_t *fmt)
...
@@ -214,11 +170,45 @@ vout_thread_t *(vout_Create)(vlc_object_t *object, const video_format_t *fmt)
return
vout
;
return
vout
;
}
}
vout_thread_t
*
(
vout_Request
)(
vlc_object_t
*
object
,
const
vout_configuration_t
*
cfg
)
{
vout_thread_t
*
vout
=
cfg
->
vout
;
if
(
!
cfg
->
fmt
)
{
if
(
vout
)
vout_CloseAndRelease
(
vout
);
return
NULL
;
}
/* If a vout is provided, try reusing it */
if
(
vout
)
{
spu_Attach
(
vout
->
p
->
p_spu
,
VLC_OBJECT
(
vout
),
false
);
vlc_object_detach
(
vout
);
vlc_object_attach
(
vout
,
object
);
spu_Attach
(
vout
->
p
->
p_spu
,
VLC_OBJECT
(
vout
),
true
);
vout_control_cmd_t
cmd
;
vout_control_cmd_Init
(
&
cmd
,
VOUT_CONTROL_REINIT
);
cmd
.
u
.
cfg
=
cfg
;
vout_control_Push
(
&
vout
->
p
->
control
,
&
cmd
);
vout_control_WaitEmpty
(
&
vout
->
p
->
control
);
if
(
!
vout
->
p
->
dead
)
{
msg_Dbg
(
object
,
"reusing provided vout"
);
return
vout
;
}
vout_CloseAndRelease
(
vout
);
msg_Warn
(
object
,
"cannot reuse provided vout"
);
}
return
VoutCreate
(
object
,
cfg
);
}
/*****************************************************************************
/*****************************************************************************
* vout_Close: Close a vout created by
vout_
Create.
* vout_Close: Close a vout created by
Vout
Create.
*****************************************************************************
*****************************************************************************
* You HAVE to call it on vout created by
vout_
Create before vlc_object_release.
* You HAVE to call it on vout created by
Vout
Create before vlc_object_release.
* You should NEVER call it on vout not obtained through
vout_
Create
* You should NEVER call it on vout not obtained through
Vout
Create
* (like with vout_Request or vlc_object_find.)
* (like with vout_Request or vlc_object_find.)
* You can use vout_CloseAndRelease() as a convenience method.
* You can use vout_CloseAndRelease() as a convenience method.
*****************************************************************************/
*****************************************************************************/
...
@@ -1019,10 +1009,10 @@ static void ThreadClean(vout_thread_t *vout)
...
@@ -1019,10 +1009,10 @@ static void ThreadClean(vout_thread_t *vout)
}
}
static
int
ThreadReinit
(
vout_thread_t
*
vout
,
static
int
ThreadReinit
(
vout_thread_t
*
vout
,
const
v
ideo_format_t
*
fmt
)
const
v
out_configuration_t
*
cfg
)
{
{
video_format_t
original
;
video_format_t
original
;
if
(
VoutValidateFormat
(
&
original
,
fmt
))
{
if
(
VoutValidateFormat
(
&
original
,
cfg
->
fmt
))
{
ThreadStop
(
vout
,
NULL
);
ThreadStop
(
vout
,
NULL
);
ThreadClean
(
vout
);
ThreadClean
(
vout
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -1092,7 +1082,7 @@ static void *Thread(void *object)
...
@@ -1092,7 +1082,7 @@ static void *Thread(void *object)
ThreadClean
(
vout
);
ThreadClean
(
vout
);
return
NULL
;
return
NULL
;
case
VOUT_CONTROL_REINIT
:
case
VOUT_CONTROL_REINIT
:
if
(
ThreadReinit
(
vout
,
cmd
.
u
.
reinit
.
fmt
))
if
(
ThreadReinit
(
vout
,
cmd
.
u
.
cfg
))
return
NULL
;
return
NULL
;
break
;
break
;
case
VOUT_CONTROL_OSD_TITLE
:
case
VOUT_CONTROL_OSD_TITLE
:
...
...
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