[vlc-devel] [PATCH 4/8] avcodec: video: move call to lavc_GetVideoFormat outside of SetupHardwareFormat
Steve Lhomme
robux4 at videolabs.io
Fri May 5 18:42:20 CEST 2017
---
modules/codec/avcodec/video.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 886eadebf3..0a5dad39fc 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -396,7 +396,8 @@ static int OpenVideoCodec( decoder_t *p_dec )
}
static int SetupHardwareFormat(decoder_t *p_dec, AVCodecContext *p_context,
- enum AVPixelFormat hwfmt, enum AVPixelFormat swfmt)
+ enum AVPixelFormat hwfmt, enum AVPixelFormat swfmt,
+ video_format_t *fmt_out)
{
p_dec->fmt_out.video.i_chroma = vlc_va_GetChroma(hwfmt, swfmt);
if (p_dec->fmt_out.video.i_chroma == 0)
@@ -407,9 +408,7 @@ static int SetupHardwareFormat(decoder_t *p_dec, AVCodecContext *p_context,
return VLC_EGENERIC;
}
- video_format_t fmt_out;
- if ( lavc_GetVideoFormat(p_dec, &fmt_out, p_context, hwfmt, swfmt) ||
- lavc_UpdateVideoFormat(p_dec, &fmt_out) )
+ if ( lavc_UpdateVideoFormat(p_dec, fmt_out) )
return VLC_EGENERIC;
post_mt(p_dec->p_sys);
@@ -1508,7 +1507,10 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
for( size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++ )
{
- if (SetupHardwareFormat(p_dec, p_context, pi_fmt[i], swfmt))
+ video_format_t fmt_out;
+ if (lavc_GetVideoFormat(p_dec, &fmt_out, p_context, pi_fmt[i], swfmt))
+ continue;
+ if (SetupHardwareFormat(p_dec, p_context, pi_fmt[i], swfmt, &fmt_out))
continue;
return pi_fmt[i];
--
2.12.1
More information about the vlc-devel
mailing list