Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
52d191ff
Commit
52d191ff
authored
May 27, 2013
by
Rafaël Carré
Committed by
Rémi Denis-Courmont
Jun 04, 2013
Browse files
ffmpeg_GetFrameBuf: split out va code
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
0ec02c3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/codec/avcodec/video.c
View file @
52d191ff
...
...
@@ -886,6 +886,31 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
}
}
static
int
ffmpeg_va_GetFrameBuf
(
struct
AVCodecContext
*
p_context
,
AVFrame
*
p_ff_pic
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_context
->
opaque
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_va_t
*
p_va
=
p_sys
->
p_va
;
/* hwaccel_context is not present in old ffmpeg version */
if
(
vlc_va_Setup
(
p_va
,
&
p_context
->
hwaccel_context
,
&
p_dec
->
fmt_out
.
video
.
i_chroma
,
p_context
->
width
,
p_context
->
height
)
)
{
msg_Err
(
p_dec
,
"vlc_va_Setup failed"
);
return
-
1
;
}
if
(
vlc_va_Get
(
p_va
,
p_ff_pic
)
)
{
msg_Err
(
p_dec
,
"VaGrabSurface failed"
);
return
-
1
;
}
p_ff_pic
->
type
=
FF_BUFFER_TYPE_USER
;
return
0
;
}
/*****************************************************************************
* ffmpeg_GetFrameBuf: callback used by ffmpeg to get a frame buffer.
*****************************************************************************
...
...
@@ -906,30 +931,10 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
#endif
if
(
p_sys
->
p_va
)
{
/* hwaccel_context is not present in old ffmpeg version */
if
(
vlc_va_Setup
(
p_sys
->
p_va
,
&
p_context
->
hwaccel_context
,
&
p_dec
->
fmt_out
.
video
.
i_chroma
,
p_context
->
width
,
p_context
->
height
)
)
{
msg_Err
(
p_dec
,
"vlc_va_Setup failed"
);
return
-
1
;
}
return
ffmpeg_va_GetFrameBuf
(
p_context
,
p_ff_pic
);
if
(
vlc_va_Get
(
p_sys
->
p_va
,
p_ff_pic
)
)
{
msg_Err
(
p_dec
,
"VaGrabSurface failed"
);
return
-
1
;
}
p_ff_pic
->
type
=
FF_BUFFER_TYPE_USER
;
return
0
;
}
else
if
(
!
p_sys
->
b_direct_rendering
)
{
/* Not much to do in indirect rendering mode. */
if
(
!
p_sys
->
b_direct_rendering
)
return
avcodec_default_get_buffer
(
p_context
,
p_ff_pic
);
}
wait_mt
(
p_sys
);
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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