diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json index f0cf100bad..295488a2fb 100644 --- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json +++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json @@ -29633,7 +29633,7 @@ "presence": "always" }, "src": { - "caps": "video/x-raw:\n format: { I420, Y41B, Y42B, Y444, I420_10LE, I422_10LE, Y444_10LE, I420_12LE, I422_12LE, Y444_12LE, Y444_16LE, GRAY8, GRAY16_LE }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "caps": "video/x-raw:\n format: { I420, Y42B, Y41B, Y444, A444, GRAY8, I420_12LE, I422_12LE, Y444_12LE, I420_10LE, I422_10LE, Y444_10LE, GRAY10_LE16, GRAY16_LE }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", "direction": "src", "presence": "always" } @@ -29657,7 +29657,7 @@ "klass": "Codec/Encoder/Video", "pad-templates": { "sink": { - "caps": "video/x-raw:\n format: { IYUV, I420, Y42B, Y41B, Y444 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "caps": "video/x-raw:\n format: { I420, Y42B, Y41B, Y444, A444, GRAY8, I420_12LE, I422_12LE, Y444_12LE, I420_10LE, I422_10LE, Y444_10LE, GRAY10_LE16, GRAY16_LE }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", "direction": "sink", "presence": "always" }, diff --git a/subprojects/gst-plugins-good/gst/y4m/gsty4mdec.c b/subprojects/gst-plugins-good/gst/y4m/gsty4mdec.c index d274c358ca..ef8287f03d 100644 --- a/subprojects/gst-plugins-good/gst/y4m/gsty4mdec.c +++ b/subprojects/gst-plugins-good/gst/y4m/gsty4mdec.c @@ -77,12 +77,7 @@ static GstStaticPadTemplate gst_y4m_dec_src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ \ - I420,Y41B,Y42B,Y444, \ - I420_10LE,I422_10LE,Y444_10LE, \ - I420_12LE,I422_12LE,Y444_12LE, \ - Y444_16LE,GRAY8,GRAY16_LE \ - }"))); + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (Y4M_VIDEO_FORMATS))); /* class initialization */ #define gst_y4m_dec_parent_class parent_class diff --git a/subprojects/gst-plugins-good/gst/y4m/gsty4menc.c b/subprojects/gst-plugins-good/gst/y4m/gsty4menc.c index 1441e557ad..d5831751e3 100644 --- a/subprojects/gst-plugins-good/gst/y4m/gsty4menc.c +++ b/subprojects/gst-plugins-good/gst/y4m/gsty4menc.c @@ -68,7 +68,7 @@ static GstStaticPadTemplate y4mencode_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ IYUV, I420, Y42B, Y41B, Y444 }")) + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (Y4M_VIDEO_FORMATS)) ); GST_DEBUG_CATEGORY (y4menc_debug); diff --git a/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.c b/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.c index 9d91bae9a2..532c3eea20 100644 --- a/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.c +++ b/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.c @@ -83,8 +83,65 @@ gst_y4m_video_unpadded_info (GstVideoInfo * y4m_info, out_info.offset[2] = out_info.offset[1] * 2; out_info.size = out_info.stride[0] * height * 3; break; + case GST_VIDEO_FORMAT_GRAY8: + out_info.stride[0] = width; + out_info.stride[1] = 0; + out_info.offset[0] = 0; + out_info.size = width * height; + break; + case GST_VIDEO_FORMAT_GRAY16_LE: + case GST_VIDEO_FORMAT_GRAY10_LE16: + out_info.stride[0] = width * 2; + out_info.offset[0] = 0; + out_info.size = out_info.stride[0] * height; + break; + case GST_VIDEO_FORMAT_A444: + out_info.stride[0] = width; + out_info.stride[1] = out_info.stride[0]; + out_info.stride[2] = out_info.stride[0]; + out_info.stride[3] = out_info.stride[0]; + out_info.offset[0] = 0; + out_info.offset[1] = out_info.stride[0] * height; + out_info.offset[2] = out_info.offset[1] + out_info.stride[1] * height; + out_info.offset[3] = out_info.offset[2] + out_info.stride[2] * height; + out_info.size = out_info.offset[3] + out_info.stride[0] * height; + break; + case GST_VIDEO_FORMAT_I420_10LE: + case GST_VIDEO_FORMAT_I420_12LE: + out_info.stride[0] = width * 2; + out_info.stride[1] = width; + out_info.stride[2] = out_info.stride[1]; + out_info.offset[0] = 0; + out_info.offset[1] = out_info.stride[0] * height; + cr_h = GST_ROUND_UP_2 (height) / 2; + if (GST_VIDEO_INFO_IS_INTERLACED (vinfo)) + cr_h = GST_ROUND_UP_2 (cr_h); + out_info.offset[2] = out_info.offset[1] + out_info.stride[1] * cr_h; + out_info.size = out_info.offset[2] + out_info.stride[2] * cr_h; + break; + case GST_VIDEO_FORMAT_I422_10LE: + case GST_VIDEO_FORMAT_I422_12LE: + out_info.stride[0] = width * 2; + out_info.stride[1] = width; + out_info.stride[2] = out_info.stride[1]; + out_info.offset[0] = 0; + out_info.offset[1] = out_info.stride[0] * height; + out_info.offset[2] = out_info.offset[1] + out_info.stride[1] * height; + out_info.size = out_info.offset[2] + out_info.stride[2] * height; + break; + case GST_VIDEO_FORMAT_Y444_10LE: + case GST_VIDEO_FORMAT_Y444_12LE: + out_info.stride[0] = width * 2; + out_info.stride[1] = out_info.stride[0]; + out_info.stride[2] = out_info.stride[0]; + out_info.offset[0] = 0; + out_info.offset[1] = out_info.stride[0] * height; + out_info.offset[2] = out_info.offset[1] * 2; + out_info.size = out_info.stride[0] * height * 3; + break; default: GST_FIXME ("%s is not supported", gst_video_format_to_string (format)); + return FALSE; } *y4m_info = out_info; diff --git a/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.h b/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.h index dfcddb229d..cd3cf414ac 100644 --- a/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.h +++ b/subprojects/gst-plugins-good/gst/y4m/gsty4mformat.h @@ -23,6 +23,11 @@ #include #include +#define Y4M_VIDEO_FORMATS "{ " \ + "I420, Y42B, Y41B, Y444, A444, GRAY8, I420_12LE, I422_12LE, " \ + "Y444_12LE, I420_10LE, I422_10LE, Y444_10LE, GRAY10_LE16, GRAY16_LE " \ + "}" + gboolean gst_y4m_video_unpadded_info (GstVideoInfo * y4m_info, const GstVideoInfo * vinfo);