mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-14 19:35:39 +00:00
msdkmjpegenc: don't need conversion for BGRA and YUY2
jpeg encoder in MSDK can accept BGRA and YUY2 input.
This commit is contained in:
parent
fbeaa37b79
commit
e1b8b81e84
2 changed files with 29 additions and 0 deletions
|
@ -435,6 +435,18 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz)
|
|||
thiz->param.mfx.FrameInfo.BitDepthChroma = 10;
|
||||
break;
|
||||
#endif
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_RGB4;
|
||||
thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV444;
|
||||
thiz->param.mfx.FrameInfo.BitDepthLuma = 8;
|
||||
thiz->param.mfx.FrameInfo.BitDepthChroma = 8;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_YUY2;
|
||||
thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV422;
|
||||
thiz->param.mfx.FrameInfo.BitDepthLuma = 8;
|
||||
thiz->param.mfx.FrameInfo.BitDepthChroma = 8;
|
||||
break;
|
||||
default:
|
||||
thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
|
||||
thiz->param.mfx.FrameInfo.BitDepthLuma = 8;
|
||||
|
|
|
@ -131,6 +131,22 @@ gst_msdkmjpegenc_set_property (GObject * object, guint prop_id,
|
|||
GST_OBJECT_UNLOCK (thiz);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_msdkmjpegenc_need_conversion (GstMsdkEnc * encoder, GstVideoInfo * info,
|
||||
GstVideoFormat * out_format)
|
||||
{
|
||||
switch (GST_VIDEO_INFO_FORMAT (info)) {
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
*out_format = GST_VIDEO_FORMAT_NV12;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkmjpegenc_class_init (GstMsdkMJPEGEncClass * klass)
|
||||
{
|
||||
|
@ -145,6 +161,7 @@ gst_msdkmjpegenc_class_init (GstMsdkMJPEGEncClass * klass)
|
|||
encoder_class->set_format = gst_msdkmjpegenc_set_format;
|
||||
encoder_class->configure = gst_msdkmjpegenc_configure;
|
||||
encoder_class->set_src_caps = gst_msdkmjpegenc_set_src_caps;
|
||||
encoder_class->need_conversion = gst_msdkmjpegenc_need_conversion;
|
||||
|
||||
gobject_class->get_property = gst_msdkmjpegenc_get_property;
|
||||
gobject_class->set_property = gst_msdkmjpegenc_set_property;
|
||||
|
|
Loading…
Reference in a new issue