mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gstffmpegcodecmap: Avoid string operations on NULL
This commit is contained in:
parent
3b230ce9b6
commit
b4ca4b5cfd
1 changed files with 22 additions and 19 deletions
|
@ -2377,23 +2377,26 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
||||||
{
|
{
|
||||||
const gchar *format;
|
const gchar *format;
|
||||||
|
|
||||||
format = gst_structure_get_string (str, "format");
|
if ((format = gst_structure_get_string (str, "format"))) {
|
||||||
|
|
||||||
if (g_str_equal (format, "YUY2"))
|
if (g_str_equal (format, "YUY2"))
|
||||||
context->pix_fmt = PIX_FMT_YUYV422;
|
context->pix_fmt = PIX_FMT_YUYV422;
|
||||||
else if (g_str_equal (format, "I420"))
|
else if (g_str_equal (format, "I420"))
|
||||||
context->pix_fmt = PIX_FMT_YUV420P;
|
context->pix_fmt = PIX_FMT_YUV420P;
|
||||||
else if (g_str_equal (format, "A420"))
|
else if (g_str_equal (format, "A420"))
|
||||||
context->pix_fmt = PIX_FMT_YUVA420P;
|
context->pix_fmt = PIX_FMT_YUVA420P;
|
||||||
else if (g_str_equal (format, "Y41B"))
|
else if (g_str_equal (format, "Y41B"))
|
||||||
context->pix_fmt = PIX_FMT_YUV411P;
|
context->pix_fmt = PIX_FMT_YUV411P;
|
||||||
else if (g_str_equal (format, "Y42B"))
|
else if (g_str_equal (format, "Y42B"))
|
||||||
context->pix_fmt = PIX_FMT_YUV422P;
|
context->pix_fmt = PIX_FMT_YUV422P;
|
||||||
else if (g_str_equal (format, "YUV9"))
|
else if (g_str_equal (format, "YUV9"))
|
||||||
context->pix_fmt = PIX_FMT_YUV410P;
|
context->pix_fmt = PIX_FMT_YUV410P;
|
||||||
else {
|
else {
|
||||||
GST_WARNING ("couldn't convert format %s" " to a pixel format", format);
|
GST_WARNING ("couldn't convert format %s" " to a pixel format",
|
||||||
}
|
format);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
GST_WARNING ("No specified format");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CODEC_ID_H263P:
|
case CODEC_ID_H263P:
|
||||||
|
@ -2858,11 +2861,11 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
|
||||||
|
|
||||||
/* WMV3 unless the fourcc exists and says otherwise */
|
/* WMV3 unless the fourcc exists and says otherwise */
|
||||||
id = CODEC_ID_WMV3;
|
id = CODEC_ID_WMV3;
|
||||||
format = gst_structure_get_string (structure, "format");
|
|
||||||
|
|
||||||
if (g_str_equal (format, "WVC1") || g_str_equal (format, "WMVA")) {
|
if ((format = gst_structure_get_string (structure, "format")) &&
|
||||||
|
(g_str_equal (format, "WVC1") || g_str_equal (format, "WMVA")))
|
||||||
id = CODEC_ID_VC1;
|
id = CODEC_ID_VC1;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue