mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 14:18:34 +00:00
msdk: replace strcmp with g_strcmp0
Because strcmp doesn't handle NULL. Fixes: #3721 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7349>
This commit is contained in:
parent
6500fc7666
commit
85b4fbf40b
7 changed files with 27 additions and 28 deletions
|
@ -126,7 +126,7 @@ gst_msdkav1enc_set_format (GstMsdkEnc * encoder)
|
|||
profile = gst_structure_get_string (s, "profile");
|
||||
|
||||
if (profile) {
|
||||
if (!strcmp (profile, "main"))
|
||||
if (!g_strcmp0 (profile, "main"))
|
||||
thiz->profile = MFX_PROFILE_AV1_MAIN;
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
|
|
@ -130,8 +130,8 @@ get_device_path (void)
|
|||
dev = (GUdevDevice *) l->data;
|
||||
|
||||
parent = g_udev_device_get_parent (dev);
|
||||
if (strcmp (g_udev_device_get_subsystem (parent), "pci") != 0 ||
|
||||
strcmp (g_udev_device_get_driver (parent), "i915") != 0) {
|
||||
if (g_strcmp0 (g_udev_device_get_subsystem (parent), "pci") != 0 ||
|
||||
g_strcmp0 (g_udev_device_get_driver (parent), "i915") != 0) {
|
||||
g_object_unref (parent);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -305,13 +305,13 @@ gst_msdkh264enc_set_format (GstMsdkEnc * encoder)
|
|||
|
||||
profile = gst_structure_get_string (s, "profile");
|
||||
if (profile) {
|
||||
if (!strcmp (profile, "high")) {
|
||||
if (!g_strcmp0 (profile, "high")) {
|
||||
thiz->profile = MFX_PROFILE_AVC_HIGH;
|
||||
} else if (!strcmp (profile, "main")) {
|
||||
} else if (!g_strcmp0 (profile, "main")) {
|
||||
thiz->profile = MFX_PROFILE_AVC_MAIN;
|
||||
} else if (!strcmp (profile, "baseline")) {
|
||||
} else if (!g_strcmp0 (profile, "baseline")) {
|
||||
thiz->profile = MFX_PROFILE_AVC_BASELINE;
|
||||
} else if (!strcmp (profile, "constrained-baseline")) {
|
||||
} else if (!g_strcmp0 (profile, "constrained-baseline")) {
|
||||
thiz->profile = MFX_PROFILE_AVC_CONSTRAINED_BASELINE;
|
||||
} else {
|
||||
thiz->profile = MFX_PROFILE_UNKNOWN;
|
||||
|
|
|
@ -371,11 +371,11 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder)
|
|||
if (h265enc->profile_name) {
|
||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN;
|
||||
|
||||
if (!strcmp (h265enc->profile_name, "main-10"))
|
||||
if (!g_strcmp0 (h265enc->profile_name, "main-10"))
|
||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN10;
|
||||
else if (!strcmp (h265enc->profile_name, "main-still-picture"))
|
||||
else if (!g_strcmp0 (h265enc->profile_name, "main-still-picture"))
|
||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAINSP;
|
||||
else if (!strcmp (h265enc->profile_name, "main-10-still-picture")) {
|
||||
else if (!g_strcmp0 (h265enc->profile_name, "main-10-still-picture")) {
|
||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN10;
|
||||
h265enc->ext_param.Header.BufferId = MFX_EXTBUFF_HEVC_PARAM;
|
||||
h265enc->ext_param.Header.BufferSz = sizeof (h265enc->ext_param);
|
||||
|
@ -383,17 +383,16 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder)
|
|||
MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY;
|
||||
gst_msdkenc_add_extra_param (encoder,
|
||||
(mfxExtBuffer *) & h265enc->ext_param);
|
||||
} else if (!strcmp (h265enc->profile_name, "main-444") ||
|
||||
!strcmp (h265enc->profile_name, "main-422-10") ||
|
||||
!strcmp (h265enc->profile_name, "main-444-10") ||
|
||||
!strcmp (h265enc->profile_name, "main-12"))
|
||||
} else if (!g_strcmp0 (h265enc->profile_name, "main-444") ||
|
||||
!g_strcmp0 (h265enc->profile_name, "main-422-10") ||
|
||||
!g_strcmp0 (h265enc->profile_name, "main-444-10") ||
|
||||
!g_strcmp0 (h265enc->profile_name, "main-12"))
|
||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_REXT;
|
||||
|
||||
#if (MFX_VERSION >= 1032)
|
||||
else if (!strcmp (h265enc->profile_name, "screen-extended-main") ||
|
||||
!strcmp (h265enc->profile_name, "screen-extended-main-10") ||
|
||||
!strcmp (h265enc->profile_name, "screen-extended-main-444") ||
|
||||
!strcmp (h265enc->profile_name, "screen-extended-main-444-10"))
|
||||
else if (!g_strcmp0 (h265enc->profile_name, "screen-extended-main") ||
|
||||
!g_strcmp0 (h265enc->profile_name, "screen-extended-main-10") ||
|
||||
!g_strcmp0 (h265enc->profile_name, "screen-extended-main-444") ||
|
||||
!g_strcmp0 (h265enc->profile_name, "screen-extended-main-444-10"))
|
||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_SCC;
|
||||
#endif
|
||||
} else {
|
||||
|
|
|
@ -109,11 +109,11 @@ gst_msdkmpeg2enc_set_format (GstMsdkEnc * encoder)
|
|||
|
||||
profile = gst_structure_get_string (s, "profile");
|
||||
if (profile) {
|
||||
if (!strcmp (profile, "high")) {
|
||||
if (!g_strcmp0 (profile, "high")) {
|
||||
thiz->profile = MFX_PROFILE_MPEG2_HIGH;
|
||||
} else if (!strcmp (profile, "main")) {
|
||||
} else if (!g_strcmp0 (profile, "main")) {
|
||||
thiz->profile = MFX_PROFILE_MPEG2_MAIN;
|
||||
} else if (!strcmp (profile, "simple")) {
|
||||
} else if (!g_strcmp0 (profile, "simple")) {
|
||||
thiz->profile = MFX_PROFILE_MPEG2_SIMPLE;
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
|
|
|
@ -97,9 +97,9 @@ gst_msdkvc1dec_configure (GstMsdkDec * decoder)
|
|||
|
||||
profile_str = gst_structure_get_string (structure, "profile");
|
||||
|
||||
if (!strcmp (profile_str, "simple"))
|
||||
if (!g_strcmp0 (profile_str, "simple"))
|
||||
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_SIMPLE;
|
||||
else if (!strcmp (profile_str, "main"))
|
||||
else if (!g_strcmp0 (profile_str, "main"))
|
||||
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_MAIN;
|
||||
else {
|
||||
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_ADVANCED;
|
||||
|
|
|
@ -113,13 +113,13 @@ gst_msdkvp9enc_set_format (GstMsdkEnc * encoder)
|
|||
profile = gst_structure_get_string (s, "profile");
|
||||
|
||||
if (profile) {
|
||||
if (!strcmp (profile, "3")) {
|
||||
if (!g_strcmp0 (profile, "3")) {
|
||||
thiz->profile = MFX_PROFILE_VP9_3;
|
||||
} else if (!strcmp (profile, "2")) {
|
||||
} else if (!g_strcmp0 (profile, "2")) {
|
||||
thiz->profile = MFX_PROFILE_VP9_2;
|
||||
} else if (!strcmp (profile, "1")) {
|
||||
} else if (!g_strcmp0 (profile, "1")) {
|
||||
thiz->profile = MFX_PROFILE_VP9_1;
|
||||
} else if (!strcmp (profile, "0")) {
|
||||
} else if (!g_strcmp0 (profile, "0")) {
|
||||
thiz->profile = MFX_PROFILE_VP9_0;
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
|
|
Loading…
Reference in a new issue