mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 22:21:13 +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/7347>
This commit is contained in:
parent
cf30e875de
commit
a275694939
7 changed files with 31 additions and 31 deletions
|
@ -126,7 +126,7 @@ gst_msdkav1enc_set_format (GstMsdkEnc * encoder)
|
||||||
profile = gst_structure_get_string (s, "profile");
|
profile = gst_structure_get_string (s, "profile");
|
||||||
|
|
||||||
if (profile) {
|
if (profile) {
|
||||||
if (!strcmp (profile, "main"))
|
if (!g_strcmp0 (profile, "main"))
|
||||||
thiz->profile = MFX_PROFILE_AV1_MAIN;
|
thiz->profile = MFX_PROFILE_AV1_MAIN;
|
||||||
else
|
else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
|
@ -92,8 +92,8 @@ get_device_path (void)
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
drmVersionPtr drm_version = drmGetVersion (fd);
|
drmVersionPtr drm_version = drmGetVersion (fd);
|
||||||
|
|
||||||
if (!drm_version || (strncmp (drm_version->name, "i915", 4) &&
|
if (!drm_version || (strncmp (drm_version->name, "i915", 4)
|
||||||
strncmp (drm_version->name, "xe", 2))) {
|
&& strncmp (drm_version->name, "xe", 2))) {
|
||||||
GST_ERROR ("The specified device isn't an Intel device");
|
GST_ERROR ("The specified device isn't an Intel device");
|
||||||
drmFreeVersion (drm_version);
|
drmFreeVersion (drm_version);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
@ -131,9 +131,9 @@ get_device_path (void)
|
||||||
dev = (GUdevDevice *) l->data;
|
dev = (GUdevDevice *) l->data;
|
||||||
|
|
||||||
parent = g_udev_device_get_parent (dev);
|
parent = g_udev_device_get_parent (dev);
|
||||||
if (strcmp (g_udev_device_get_subsystem (parent), "pci") != 0 ||
|
if (g_strcmp0 (g_udev_device_get_subsystem (parent), "pci") != 0
|
||||||
(strcmp (g_udev_device_get_driver (parent), "i915") != 0 &&
|
|| (g_strcmp0 (g_udev_device_get_driver (parent), "i915") != 0
|
||||||
strcmp (g_udev_device_get_driver (parent), "xe") != 0)) {
|
&& g_strcmp0 (g_udev_device_get_driver (parent), "xe") != 0)) {
|
||||||
g_object_unref (parent);
|
g_object_unref (parent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,13 +305,13 @@ gst_msdkh264enc_set_format (GstMsdkEnc * encoder)
|
||||||
|
|
||||||
profile = gst_structure_get_string (s, "profile");
|
profile = gst_structure_get_string (s, "profile");
|
||||||
if (profile) {
|
if (profile) {
|
||||||
if (!strcmp (profile, "high")) {
|
if (!g_strcmp0 (profile, "high")) {
|
||||||
thiz->profile = MFX_PROFILE_AVC_HIGH;
|
thiz->profile = MFX_PROFILE_AVC_HIGH;
|
||||||
} else if (!strcmp (profile, "main")) {
|
} else if (!g_strcmp0 (profile, "main")) {
|
||||||
thiz->profile = MFX_PROFILE_AVC_MAIN;
|
thiz->profile = MFX_PROFILE_AVC_MAIN;
|
||||||
} else if (!strcmp (profile, "baseline")) {
|
} else if (!g_strcmp0 (profile, "baseline")) {
|
||||||
thiz->profile = MFX_PROFILE_AVC_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;
|
thiz->profile = MFX_PROFILE_AVC_CONSTRAINED_BASELINE;
|
||||||
} else {
|
} else {
|
||||||
thiz->profile = MFX_PROFILE_UNKNOWN;
|
thiz->profile = MFX_PROFILE_UNKNOWN;
|
||||||
|
|
|
@ -371,11 +371,11 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder)
|
||||||
if (h265enc->profile_name) {
|
if (h265enc->profile_name) {
|
||||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN;
|
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;
|
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;
|
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;
|
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN10;
|
||||||
h265enc->ext_param.Header.BufferId = MFX_EXTBUFF_HEVC_PARAM;
|
h265enc->ext_param.Header.BufferId = MFX_EXTBUFF_HEVC_PARAM;
|
||||||
h265enc->ext_param.Header.BufferSz = sizeof (h265enc->ext_param);
|
h265enc->ext_param.Header.BufferSz = sizeof (h265enc->ext_param);
|
||||||
|
@ -383,18 +383,18 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder)
|
||||||
MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY;
|
MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY;
|
||||||
gst_msdkenc_add_extra_param (encoder,
|
gst_msdkenc_add_extra_param (encoder,
|
||||||
(mfxExtBuffer *) & h265enc->ext_param);
|
(mfxExtBuffer *) & h265enc->ext_param);
|
||||||
} else if (!strcmp (h265enc->profile_name, "main-444") ||
|
} else if (!g_strcmp0 (h265enc->profile_name, "main-444") ||
|
||||||
!strcmp (h265enc->profile_name, "main-422-10") ||
|
!g_strcmp0 (h265enc->profile_name, "main-422-10") ||
|
||||||
!strcmp (h265enc->profile_name, "main-444-10") ||
|
!g_strcmp0 (h265enc->profile_name, "main-444-10") ||
|
||||||
!strcmp (h265enc->profile_name, "main-12") ||
|
!g_strcmp0 (h265enc->profile_name, "main-12") ||
|
||||||
!strcmp (h265enc->profile_name, "main-422-12"))
|
!g_strcmp0 (h265enc->profile_name, "main-422-12"))
|
||||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_REXT;
|
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_REXT;
|
||||||
|
|
||||||
#if (MFX_VERSION >= 1032)
|
#if (MFX_VERSION >= 1032)
|
||||||
else if (!strcmp (h265enc->profile_name, "screen-extended-main") ||
|
else if (!g_strcmp0 (h265enc->profile_name, "screen-extended-main") ||
|
||||||
!strcmp (h265enc->profile_name, "screen-extended-main-10") ||
|
!g_strcmp0 (h265enc->profile_name, "screen-extended-main-10") ||
|
||||||
!strcmp (h265enc->profile_name, "screen-extended-main-444") ||
|
!g_strcmp0 (h265enc->profile_name, "screen-extended-main-444") ||
|
||||||
!strcmp (h265enc->profile_name, "screen-extended-main-444-10"))
|
!g_strcmp0 (h265enc->profile_name, "screen-extended-main-444-10"))
|
||||||
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_SCC;
|
encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_SCC;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -109,11 +109,11 @@ gst_msdkmpeg2enc_set_format (GstMsdkEnc * encoder)
|
||||||
|
|
||||||
profile = gst_structure_get_string (s, "profile");
|
profile = gst_structure_get_string (s, "profile");
|
||||||
if (profile) {
|
if (profile) {
|
||||||
if (!strcmp (profile, "high")) {
|
if (!g_strcmp0 (profile, "high")) {
|
||||||
thiz->profile = MFX_PROFILE_MPEG2_HIGH;
|
thiz->profile = MFX_PROFILE_MPEG2_HIGH;
|
||||||
} else if (!strcmp (profile, "main")) {
|
} else if (!g_strcmp0 (profile, "main")) {
|
||||||
thiz->profile = MFX_PROFILE_MPEG2_MAIN;
|
thiz->profile = MFX_PROFILE_MPEG2_MAIN;
|
||||||
} else if (!strcmp (profile, "simple")) {
|
} else if (!g_strcmp0 (profile, "simple")) {
|
||||||
thiz->profile = MFX_PROFILE_MPEG2_SIMPLE;
|
thiz->profile = MFX_PROFILE_MPEG2_SIMPLE;
|
||||||
} else {
|
} else {
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
|
@ -97,9 +97,9 @@ gst_msdkvc1dec_configure (GstMsdkDec * decoder)
|
||||||
|
|
||||||
profile_str = gst_structure_get_string (structure, "profile");
|
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;
|
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;
|
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_MAIN;
|
||||||
else {
|
else {
|
||||||
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_ADVANCED;
|
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");
|
profile = gst_structure_get_string (s, "profile");
|
||||||
|
|
||||||
if (profile) {
|
if (profile) {
|
||||||
if (!strcmp (profile, "3")) {
|
if (!g_strcmp0 (profile, "3")) {
|
||||||
thiz->profile = MFX_PROFILE_VP9_3;
|
thiz->profile = MFX_PROFILE_VP9_3;
|
||||||
} else if (!strcmp (profile, "2")) {
|
} else if (!g_strcmp0 (profile, "2")) {
|
||||||
thiz->profile = MFX_PROFILE_VP9_2;
|
thiz->profile = MFX_PROFILE_VP9_2;
|
||||||
} else if (!strcmp (profile, "1")) {
|
} else if (!g_strcmp0 (profile, "1")) {
|
||||||
thiz->profile = MFX_PROFILE_VP9_1;
|
thiz->profile = MFX_PROFILE_VP9_1;
|
||||||
} else if (!strcmp (profile, "0")) {
|
} else if (!g_strcmp0 (profile, "0")) {
|
||||||
thiz->profile = MFX_PROFILE_VP9_0;
|
thiz->profile = MFX_PROFILE_VP9_0;
|
||||||
} else {
|
} else {
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
Loading…
Reference in a new issue