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
d331a853
Commit
d331a853
authored
Apr 23, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: test for decoder hardware output support before decoding
parent
af9c67a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+19
-9
No files found.
modules/codec/avcodec/video.c
View file @
d331a853
...
...
@@ -111,10 +111,9 @@ static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
/**
* Sets the decoder output format.
*/
static
int
lavc_UpdateVideoFormat
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
)
static
int
lavc_UpdateVideoFormat
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
,
bool
hwaccel
)
{
bool
hwaccel
=
p_dec
->
p_sys
->
p_va
!=
NULL
;
int
width
=
p_context
->
coded_width
;
int
height
=
p_context
->
coded_height
;
...
...
@@ -186,7 +185,9 @@ static int lavc_UpdateVideoFormat( decoder_t *p_dec,
static
inline
picture_t
*
ffmpeg_NewPictBuf
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
)
{
if
(
lavc_UpdateVideoFormat
(
p_dec
,
p_context
))
bool
hwaccel
=
p_dec
->
p_sys
->
p_va
!=
NULL
;
if
(
lavc_UpdateVideoFormat
(
p_dec
,
p_context
,
hwaccel
))
return
NULL
;
return
decoder_NewPicture
(
p_dec
);
}
...
...
@@ -1102,7 +1103,9 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
}
/* Enumerate available formats */
enum
PixelFormat
swfmt
=
avcodec_default_get_format
(
p_context
,
pi_fmt
);
bool
can_hwaccel
=
false
;
for
(
size_t
i
=
0
;
pi_fmt
[
i
]
!=
PIX_FMT_NONE
;
i
++
)
{
const
AVPixFmtDescriptor
*
dsc
=
av_pix_fmt_desc_get
(
pi_fmt
[
i
]);
...
...
@@ -1117,14 +1120,22 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
}
if
(
!
can_hwaccel
)
goto
end
;
return
swfmt
;
for
(
size_t
i
=
0
;
pi_fmt
[
i
]
!=
PIX_FMT_NONE
;
i
++
)
{
vlc_va_t
*
va
=
vlc_va_New
(
VLC_OBJECT
(
p_dec
),
p_context
,
pi_fmt
[
i
],
enum
PixelFormat
hwfmt
=
pi_fmt
[
i
];
p_dec
->
fmt_out
.
video
.
i_chroma
=
vlc_va_GetChroma
(
hwfmt
,
swfmt
);
if
(
p_dec
->
fmt_out
.
video
.
i_chroma
==
0
)
continue
;
/* Unknown brand of hardware acceleration */
if
(
lavc_UpdateVideoFormat
(
p_dec
,
p_context
,
true
))
continue
;
/* Unsupported brand of hardware acceleration */
vlc_va_t
*
va
=
vlc_va_New
(
VLC_OBJECT
(
p_dec
),
p_context
,
hwfmt
,
&
p_dec
->
fmt_in
);
if
(
va
==
NULL
)
continue
;
continue
;
/* Unsupported codec profile or such */
/* We try to call vlc_va_Setup when possible to detect errors when
* possible (later is too late) */
...
...
@@ -1148,7 +1159,6 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
return
pi_fmt
[
i
];
}
end:
/* Fallback to default behaviour */
return
avcodec_default_get_format
(
p_context
,
pi_fmt
)
;
return
swfmt
;
}
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