mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
avcodecmap: Remove redundant function to map PixelFormat to GstVideoFormat
And merge everything into a single one.
This commit is contained in:
parent
7eec659460
commit
c9125dd6f0
1 changed files with 8 additions and 73 deletions
|
@ -1757,76 +1757,6 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
|||
return caps;
|
||||
}
|
||||
|
||||
/* Convert a FFMPEG Pixel Format to a GStreamer VideoFormat */
|
||||
GstVideoFormat
|
||||
gst_ffmpeg_pixfmt_to_video_format (enum PixelFormat pix_fmt)
|
||||
{
|
||||
GstVideoFormat fmt;
|
||||
|
||||
switch (pix_fmt) {
|
||||
case PIX_FMT_YUVJ420P:
|
||||
case PIX_FMT_YUV420P:
|
||||
fmt = GST_VIDEO_FORMAT_I420;
|
||||
break;
|
||||
case PIX_FMT_YUVA420P:
|
||||
fmt = GST_VIDEO_FORMAT_A420;
|
||||
break;
|
||||
case PIX_FMT_YUYV422:
|
||||
fmt = GST_VIDEO_FORMAT_YUY2;
|
||||
break;
|
||||
case PIX_FMT_RGB24:
|
||||
fmt = GST_VIDEO_FORMAT_RGB;
|
||||
break;
|
||||
case PIX_FMT_BGR24:
|
||||
fmt = GST_VIDEO_FORMAT_BGR;
|
||||
break;
|
||||
case PIX_FMT_YUVJ422P:
|
||||
case PIX_FMT_YUV422P:
|
||||
fmt = GST_VIDEO_FORMAT_Y42B;
|
||||
break;
|
||||
case PIX_FMT_YUVJ444P:
|
||||
case PIX_FMT_YUV444P:
|
||||
fmt = GST_VIDEO_FORMAT_Y444;
|
||||
break;
|
||||
case PIX_FMT_RGB32:
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
fmt = GST_VIDEO_FORMAT_xRGB;
|
||||
#else
|
||||
fmt = GST_VIDEO_FORMAT_BGRx;
|
||||
#endif
|
||||
break;
|
||||
case PIX_FMT_YUV410P:
|
||||
fmt = GST_VIDEO_FORMAT_YUV9;
|
||||
break;
|
||||
case PIX_FMT_YUV411P:
|
||||
fmt = GST_VIDEO_FORMAT_Y41B;
|
||||
break;
|
||||
case PIX_FMT_RGB565:
|
||||
fmt = GST_VIDEO_FORMAT_RGB16;
|
||||
break;
|
||||
case PIX_FMT_RGB555:
|
||||
fmt = GST_VIDEO_FORMAT_RGB15;
|
||||
break;
|
||||
case PIX_FMT_PAL8:
|
||||
fmt = GST_VIDEO_FORMAT_RGB8P;
|
||||
break;
|
||||
case PIX_FMT_GRAY8:
|
||||
fmt = GST_VIDEO_FORMAT_GRAY8;
|
||||
break;
|
||||
case PIX_FMT_YUV420P10LE:
|
||||
fmt = GST_VIDEO_FORMAT_I420_10LE;
|
||||
break;
|
||||
case PIX_FMT_YUV420P10BE:
|
||||
fmt = GST_VIDEO_FORMAT_I420_10BE;
|
||||
break;
|
||||
default:
|
||||
/* give up ... */
|
||||
fmt = GST_VIDEO_FORMAT_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
||||
/* Convert a FFMPEG Pixel Format and optional AVCodecContext
|
||||
* to a GstCaps. If the context is ommitted, no fixed values
|
||||
* for video/audio size will be included in the GstCaps
|
||||
|
@ -1841,7 +1771,7 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
|
|||
GstCaps *caps = NULL;
|
||||
GstVideoFormat format;
|
||||
|
||||
format = gst_ffmpeg_pixfmt_to_video_format (pix_fmt);
|
||||
format = gst_ffmpeg_pixfmt_to_videoformat (pix_fmt);
|
||||
|
||||
if (format != GST_VIDEO_FORMAT_UNKNOWN) {
|
||||
caps = gst_ff_vid_caps_new (context, codec_id, TRUE, "video/x-raw",
|
||||
|
@ -2195,11 +2125,13 @@ static const PixToFmt pixtofmttable[] = {
|
|||
/* GST_VIDEO_FORMAT_xRGB, */
|
||||
/* GST_VIDEO_FORMAT_xBGR, */
|
||||
/* GST_VIDEO_FORMAT_RGBA, */
|
||||
{GST_VIDEO_FORMAT_RGBA, PIX_FMT_RGB32},
|
||||
{GST_VIDEO_FORMAT_RGBA, PIX_FMT_RGBA},
|
||||
/* GST_VIDEO_FORMAT_BGRA, */
|
||||
{GST_VIDEO_FORMAT_BGRA, PIX_FMT_BGR32},
|
||||
{GST_VIDEO_FORMAT_BGRA, PIX_FMT_BGRA},
|
||||
/* GST_VIDEO_FORMAT_ARGB, */
|
||||
{GST_VIDEO_FORMAT_ARGB, PIX_FMT_ARGB},
|
||||
/* GST_VIDEO_FORMAT_ABGR, */
|
||||
{GST_VIDEO_FORMAT_ABGR, PIX_FMT_ABGR},
|
||||
/* GST_VIDEO_FORMAT_RGB, */
|
||||
{GST_VIDEO_FORMAT_RGB, PIX_FMT_RGB24},
|
||||
/* GST_VIDEO_FORMAT_BGR, */
|
||||
|
@ -2240,11 +2172,14 @@ static const PixToFmt pixtofmttable[] = {
|
|||
/* GST_VIDEO_FORMAT_RGB8_PALETTED, */
|
||||
{GST_VIDEO_FORMAT_RGB8P, PIX_FMT_PAL8},
|
||||
/* GST_VIDEO_FORMAT_YUV9, */
|
||||
{GST_VIDEO_FORMAT_YUV9, PIX_FMT_YUV410P},
|
||||
/* GST_VIDEO_FORMAT_YVU9, */
|
||||
/* GST_VIDEO_FORMAT_IYU1, */
|
||||
/* GST_VIDEO_FORMAT_ARGB64, */
|
||||
/* GST_VIDEO_FORMAT_AYUV64, */
|
||||
/* GST_VIDEO_FORMAT_r210, */
|
||||
{GST_VIDEO_FORMAT_I420_10LE, PIX_FMT_YUV420P10LE},
|
||||
{GST_VIDEO_FORMAT_I420_10BE, PIX_FMT_YUV420P10BE},
|
||||
{GST_VIDEO_FORMAT_I422_10LE, PIX_FMT_YUV422P10LE},
|
||||
{GST_VIDEO_FORMAT_I422_10BE, PIX_FMT_YUV422P10BE},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue