Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
1b927cdd
Commit
1b927cdd
authored
Apr 22, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: simplify hwaccel picture release
parent
30cb3147
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
38 deletions
+15
-38
modules/codec/avcodec/dxva2.c
modules/codec/avcodec/dxva2.c
+1
-0
modules/codec/avcodec/vaapi.c
modules/codec/avcodec/vaapi.c
+1
-0
modules/codec/avcodec/vda.c
modules/codec/avcodec/vda.c
+4
-2
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+7
-35
modules/hw/vdpau/avcodec.c
modules/hw/vdpau/avcodec.c
+2
-1
No files found.
modules/codec/avcodec/dxva2.c
View file @
1b927cdd
...
...
@@ -488,6 +488,7 @@ static void Release(void *opaque, uint8_t *data)
surface
->
refcount
--
;
pic
->
context
=
NULL
;
picture_Release
(
pic
);
(
void
)
data
;
}
...
...
modules/codec/avcodec/vaapi.c
View file @
1b927cdd
...
...
@@ -391,6 +391,7 @@ static void Release( void *opaque, uint8_t *data )
vlc_mutex_unlock
(
p_surface
->
p_lock
);
pic
->
context
=
NULL
;
picture_Release
(
pic
);
(
void
)
data
;
}
...
...
modules/codec/avcodec/vda.c
View file @
1b927cdd
...
...
@@ -307,7 +307,8 @@ static void Release( void *opaque, uint8_t *data )
if ( cv_buffer )
CVPixelBufferRelease( cv_buffer );
#endif
(
void
)
opaque
;
(
void
)
data
;
picture_Release
(
opaque
);
(
void
)
data
;
}
#else
...
...
@@ -385,7 +386,8 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, uint8_t *data )
static
void
Release
(
void
*
opaque
,
uint8_t
*
data
)
{
(
void
)
opaque
;
(
void
)
data
;
picture_Release
(
opaque
);
(
void
)
data
;
}
#endif
modules/codec/avcodec/video.c
View file @
1b927cdd
...
...
@@ -84,12 +84,6 @@ struct decoder_sys_t
vlc_sem_t
sem_mt
;
};
typedef
struct
{
vlc_va_t
*
va
;
picture_t
*
pic
;
}
lavc_va_picture_t
;
#ifdef HAVE_AVCODEC_MT
# define wait_mt(s) vlc_sem_wait( &s->sem_mt )
# define post_mt(s) vlc_sem_post( &s->sem_mt )
...
...
@@ -654,7 +648,6 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
while
(
!
p_block
||
p_block
->
i_buffer
>
0
||
p_sys
->
b_flush
)
{
int
i_used
,
b_gotpicture
;
picture_t
*
p_pic
;
AVPacket
pkt
;
post_mt
(
p_sys
);
...
...
@@ -791,7 +784,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if
(
!
b_drawpicture
||
(
!
p_sys
->
p_va
&&
!
p_sys
->
p_ff_pic
->
linesize
[
0
]
)
)
continue
;
if
(
p_sys
->
p_ff_pic
->
opaque
==
NULL
)
picture_t
*
p_pic
=
p_sys
->
p_ff_pic
->
opaque
;
if
(
p_pic
==
NULL
)
{
/* Get a new picture */
if
(
p_sys
->
p_va
==
NULL
)
...
...
@@ -807,17 +801,9 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
lavc_CopyPicture
(
p_dec
,
p_pic
,
p_sys
->
p_ff_pic
);
}
else
if
(
p_sys
->
p_va
!=
NULL
)
{
lavc_va_picture_t
*
vapic
=
p_sys
->
p_ff_pic
->
opaque
;
p_pic
=
vapic
->
pic
;
vlc_va_Extract
(
p_sys
->
p_va
,
p_pic
,
p_sys
->
p_ff_pic
->
data
[
3
]
);
picture_Hold
(
p_pic
);
}
else
{
p_pic
=
(
picture_t
*
)
p_sys
->
p_ff_pic
->
opaque
;
if
(
p_sys
->
p_va
!=
NULL
)
vlc_va_Extract
(
p_sys
->
p_va
,
p_pic
,
p_sys
->
p_ff_pic
->
data
[
3
]
);
picture_Hold
(
p_pic
);
}
...
...
@@ -959,15 +945,6 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
}
}
static
void
lavc_va_ReleaseFrame
(
void
*
opaque
,
uint8_t
*
data
)
{
lavc_va_picture_t
*
vapic
=
opaque
;
vlc_va_Release
(
vapic
->
va
,
vapic
->
pic
,
data
);
picture_Release
(
vapic
->
pic
);
free
(
vapic
);
}
static
int
lavc_va_GetFrame
(
struct
AVCodecContext
*
ctx
,
AVFrame
*
frame
,
int
flags
)
{
...
...
@@ -984,10 +961,6 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame,
if
(
pic
==
NULL
)
return
-
1
;
lavc_va_picture_t
*
vapic
=
xmalloc
(
sizeof
(
*
vapic
));
vapic
->
va
=
va
;
vapic
->
pic
=
pic
;
if
(
vlc_va_Get
(
va
,
pic
,
&
frame
->
data
[
0
]))
{
msg_Err
(
dec
,
"hardware acceleration picture allocation failed"
);
...
...
@@ -998,15 +971,14 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame,
* data[3] actually contains the format-specific surface handle. */
frame
->
data
[
3
]
=
frame
->
data
[
0
];
frame
->
buf
[
0
]
=
av_buffer_create
(
frame
->
data
[
0
],
0
,
lavc_va_ReleaseFrame
,
vapic
,
0
);
frame
->
buf
[
0
]
=
av_buffer_create
(
frame
->
data
[
0
],
0
,
va
->
release
,
pic
,
0
);
if
(
unlikely
(
frame
->
buf
[
0
]
==
NULL
))
{
lavc_va_ReleaseFrame
(
va
pic
,
frame
->
data
[
0
]);
vlc_va_Release
(
va
,
pic
,
frame
->
data
[
0
]);
return
-
1
;
}
frame
->
opaque
=
va
pic
;
frame
->
opaque
=
pic
;
assert
(
frame
->
data
[
0
]
!=
NULL
);
(
void
)
flags
;
return
0
;
...
...
modules/hw/vdpau/avcodec.c
View file @
1b927cdd
...
...
@@ -148,7 +148,8 @@ static int Lock(vlc_va_t *va, picture_t *pic, uint8_t **data)
static
void
Unlock
(
void
*
opaque
,
uint8_t
*
data
)
{
(
void
)
opaque
;
(
void
)
data
;
picture_Release
(
opaque
);
(
void
)
data
;
}
static
int
Copy
(
vlc_va_t
*
va
,
picture_t
*
pic
,
uint8_t
*
data
)
...
...
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