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
b13bd5a2
Commit
b13bd5a2
authored
Jul 25, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: pass data pointer to hwaccel release callbacks and simplify
parent
458ba518
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
46 deletions
+31
-46
modules/codec/avcodec/dxva2.c
modules/codec/avcodec/dxva2.c
+4
-1
modules/codec/avcodec/hwdummy.c
modules/codec/avcodec/hwdummy.c
+12
-10
modules/codec/avcodec/va.h
modules/codec/avcodec/va.h
+5
-4
modules/codec/avcodec/vaapi.c
modules/codec/avcodec/vaapi.c
+2
-1
modules/codec/avcodec/vda.c
modules/codec/avcodec/vda.c
+2
-1
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+4
-28
modules/hw/vdpau/avcodec.c
modules/hw/vdpau/avcodec.c
+2
-1
No files found.
modules/codec/avcodec/dxva2.c
View file @
b13bd5a2
...
...
@@ -471,12 +471,15 @@ static int Get(vlc_va_t *external, AVFrame *ff)
ff
->
opaque
=
surface
;
return
VLC_SUCCESS
;
}
static
void
Release
(
void
*
opaque
)
static
void
Release
(
void
*
opaque
,
uint8_t
*
data
)
{
vlc_va_surface_t
*
surface
=
opaque
;
surface
->
refcount
--
;
(
void
)
data
;
}
static
void
Close
(
vlc_va_t
*
external
)
{
vlc_va_dxva2_t
*
va
=
vlc_va_dxva2_Get
(
external
);
...
...
modules/codec/avcodec/hwdummy.c
View file @
b13bd5a2
...
...
@@ -47,8 +47,9 @@ vlc_module_begin()
add_shortcut
(
"dummy"
)
vlc_module_end
()
#define DECODER_MAGIC 0x12345678
#define SURFACE_MAGIC 0x87654321
#define DECODER_MAGIC 0xdec0dea0
#define DATA_MAGIC 0xda1a0000
#define OPAQUE_MAGIC 0x0da00e00
struct
vlc_va_sys_t
{
...
...
@@ -63,15 +64,16 @@ static int Lock(vlc_va_t *va, AVFrame *ff)
ff
->
linesize
[
i
]
=
0
;
}
ff
->
data
[
0
]
=
(
void
*
)(
uintptr_t
)
SURFACE
_MAGIC
;
/* must be non-NULL */
ff
->
data
[
3
]
=
(
void
*
)(
uintptr_t
)
SURFACE
_MAGIC
;
ff
->
opaque
=
(
void
*
)(
uintptr_t
)
SURFAC
E_MAGIC
;
ff
->
data
[
0
]
=
(
void
*
)(
uintptr_t
)
DATA
_MAGIC
;
/* must be non-NULL */
ff
->
data
[
3
]
=
(
void
*
)(
uintptr_t
)
DATA
_MAGIC
;
ff
->
opaque
=
(
void
*
)(
uintptr_t
)
OPAQU
E_MAGIC
;
return
VLC_SUCCESS
;
}
static
void
Unlock
(
void
*
opaque
)
static
void
Unlock
(
void
*
opaque
,
uint8_t
*
data
)
{
assert
((
uintptr_t
)
opaque
==
SURFACE_MAGIC
);
assert
((
uintptr_t
)
opaque
==
OPAQUE_MAGIC
);
assert
((
uintptr_t
)
data
==
DATA_MAGIC
);
}
static
VdpStatus
Render
(
VdpDecoder
decoder
,
VdpVideoSurface
target
,
...
...
@@ -82,7 +84,7 @@ static VdpStatus Render(VdpDecoder decoder, VdpVideoSurface target,
(
void
)
decoder
;
(
void
)
target
;
(
void
)
picture_info
;
(
void
)
bitstream_buffer_count
;
(
void
)
bitstream_buffers
;
assert
(
decoder
==
DECODER_MAGIC
);
assert
(
target
==
SURFACE
_MAGIC
);
assert
(
target
==
DATA
_MAGIC
);
return
VDP_STATUS_OK
;
}
...
...
@@ -90,8 +92,8 @@ static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *ff)
{
(
void
)
va
;
(
void
)
ff
;
assert
((
uintptr_t
)
ff
->
data
[
3
]
==
SURFACE
_MAGIC
);
assert
((
uintptr_t
)
ff
->
opaque
==
SURFAC
E_MAGIC
);
assert
((
uintptr_t
)
ff
->
data
[
3
]
==
DATA
_MAGIC
);
assert
((
uintptr_t
)
ff
->
opaque
==
OPAQU
E_MAGIC
);
/* Put some dummy picture content */
memset
(
pic
->
p
[
0
].
p_pixels
,
0xF0
,
...
...
modules/codec/avcodec/va.h
View file @
b13bd5a2
...
...
@@ -38,7 +38,7 @@ struct vlc_va_t {
int
(
*
setup
)(
vlc_va_t
*
,
void
**
hw
,
vlc_fourcc_t
*
output
,
int
width
,
int
height
);
int
(
*
get
)(
vlc_va_t
*
,
AVFrame
*
frame
);
void
(
*
release
)(
void
*
opaque
);
void
(
*
release
)(
void
*
opaque
,
uint8_t
*
surface
);
int
(
*
extract
)(
vlc_va_t
*
,
picture_t
*
dst
,
AVFrame
*
src
);
};
...
...
@@ -86,7 +86,8 @@ static inline int vlc_va_Get(vlc_va_t *va, AVFrame *frame)
* Releases a hardware surface from a libavcodec frame.
* The surface has been previously allocated with vlc_va_Get().
*
* @param opaque opaque data pointer of the AVFrame passed to vlc_va_Get().
* @param opaque opaque data pointer of the AVFrame set by vlc_va_Get()
* @param data data[0] pointer of the AVFrame set by vlc_va_Get()
*
* @note This function needs not be reentrant. However it may be called
* concurrently with vlc_va_Get() and/or vlc_va_Extract() from other threads
...
...
@@ -94,9 +95,9 @@ static inline int vlc_va_Get(vlc_va_t *va, AVFrame *frame)
*
* @param frame libavcodec frame previously allocated by vlc_va_Get()
*/
static
inline
void
vlc_va_Release
(
vlc_va_t
*
va
,
void
*
opaque
)
static
inline
void
vlc_va_Release
(
vlc_va_t
*
va
,
void
*
opaque
,
uint8_t
*
data
)
{
va
->
release
(
opaque
);
va
->
release
(
opaque
,
data
);
}
/**
...
...
modules/codec/avcodec/vaapi.c
View file @
b13bd5a2
...
...
@@ -518,13 +518,14 @@ static int Get( vlc_va_t *va, AVFrame *p_ff )
return
VLC_SUCCESS
;
}
static
void
Release
(
void
*
opaque
)
static
void
Release
(
void
*
opaque
,
uint8_t
*
data
)
{
vlc_va_surface_t
*
p_surface
=
opaque
;
vlc_mutex_lock
(
p_surface
->
p_lock
);
p_surface
->
i_refcount
--
;
vlc_mutex_unlock
(
p_surface
->
p_lock
);
(
void
)
data
;
}
static
void
Close
(
vlc_va_sys_t
*
sys
)
...
...
modules/codec/avcodec/vda.c
View file @
b13bd5a2
...
...
@@ -255,7 +255,7 @@ static int Extract( vlc_va_t *external, picture_t *p_picture, AVFrame *p_ff )
return
VLC_SUCCESS
;
}
static
void
Release
(
void
*
opaque
)
static
void
Release
(
void
*
opaque
,
uint8_t
*
data
)
{
assert
(
opaque
==
NULL
);
#if 0
...
...
@@ -264,6 +264,7 @@ static void Release( void *opaque )
if ( cv_buffer )
CVPixelBufferRelease( cv_buffer );
#endif
(
void
)
data
;
}
static
void
Close
(
vlc_va_t
*
external
)
...
...
modules/codec/avcodec/video.c
View file @
b13bd5a2
...
...
@@ -894,21 +894,6 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
}
#if LIBAVCODEC_VERSION_MAJOR >= 55
typedef
struct
{
vlc_va_t
*
va
;
void
*
opaque
;
}
lavc_hw_ref_t
;
static
void
lavc_va_ReleaseFrame
(
void
*
opaque
,
uint8_t
*
data
)
{
lavc_hw_ref_t
*
ref
=
opaque
;
vlc_va_Release
(
ref
->
va
,
ref
->
opaque
);
free
(
ref
);
(
void
)
data
;
}
static
int
lavc_va_GetFrame
(
struct
AVCodecContext
*
ctx
,
AVFrame
*
frame
,
int
flags
)
{
...
...
@@ -928,20 +913,11 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame,
return
-
1
;
}
lavc_hw_ref_t
*
ref
=
malloc
(
sizeof
(
*
ref
));
if
(
unlikely
(
ref
==
NULL
))
{
vlc_va_Release
(
va
,
frame
->
opaque
);
return
-
1
;
}
ref
->
va
=
va
;
ref
->
opaque
=
frame
->
opaque
;
frame
->
buf
[
0
]
=
av_buffer_create
(
frame
->
data
[
0
],
0
,
lavc_va_ReleaseFrame
,
ref
,
0
);
frame
->
buf
[
0
]
=
av_buffer_create
(
frame
->
data
[
0
],
0
,
va
->
release
,
frame
->
opaque
,
0
);
if
(
unlikely
(
frame
->
buf
[
0
]
==
NULL
))
{
lavc_va_ReleaseFrame
(
ref
,
frame
->
data
[
0
]);
vlc_va_Release
(
va
,
frame
->
opaque
,
frame
->
data
[
0
]);
return
-
1
;
}
assert
(
frame
->
data
[
0
]
!=
NULL
);
...
...
@@ -1262,7 +1238,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
p_sys
->
p_va
)
vlc_va_Release
(
p_sys
->
p_va
,
p_ff_pic
->
opaque
);
vlc_va_Release
(
p_sys
->
p_va
,
p_ff_pic
->
opaque
,
p_ff_pic
->
data
[
0
]
);
else
if
(
p_ff_pic
->
opaque
)
decoder_UnlinkPicture
(
p_dec
,
(
picture_t
*
)
p_ff_pic
->
opaque
);
else
if
(
p_ff_pic
->
type
==
FF_BUFFER_TYPE_INTERNAL
)
...
...
modules/hw/vdpau/avcodec.c
View file @
b13bd5a2
...
...
@@ -91,12 +91,13 @@ static int Lock(vlc_va_t *va, AVFrame *ff)
return
VLC_SUCCESS
;
}
static
void
Unlock
(
void
*
opaque
)
static
void
Unlock
(
void
*
opaque
,
uint8_t
*
data
)
{
vlc_vdp_video_field_t
*
field
=
opaque
;
assert
(
field
!=
NULL
);
field
->
destroy
(
field
);
(
void
)
data
;
}
static
int
Copy
(
vlc_va_t
*
va
,
picture_t
*
pic
,
AVFrame
*
ff
)
...
...
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