[vlc-commits] [Git][videolan/vlc][master] 6 commits: omxil: remove unused function
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Apr 13 14:30:09 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
0d483050 by Thomas Guillem at 2023-04-13T14:13:38+00:00
omxil: remove unused function
- - - - -
19bdb733 by Thomas Guillem at 2023-04-13T14:13:38+00:00
omxil: prepare convert_omx_to_profile_idc() to handle more codecs
Refs #20873
- - - - -
5bec0a0d by Thomas Guillem at 2023-04-13T14:13:38+00:00
mediacodec: also pass vlc_foucc_t to MediaCodec_GetName()
Alongside the codec mimetype.
Refs #20873
- - - - -
275a1bcb by Thomas Guillem at 2023-04-13T14:13:38+00:00
omxil: handle hevc in convert_omx_to_profile_idc()
Refs #20873
- - - - -
eb0e5fb4 by Thomas Guillem at 2023-04-13T14:13:38+00:00
mediacodec: use convert_omx_to_profile_idc() for all codecs
Refs #20873
- - - - -
4b8cc497 by Thomas Guillem at 2023-04-13T14:13:38+00:00
omxil: handle mpeg2 in convert_omx_to_profile_idc()
Fixes #20873
- - - - -
4 changed files:
- modules/codec/omxil/mediacodec_jni.c
- modules/codec/omxil/mediacodec_ndk.c
- modules/codec/omxil/omxil_utils.h
- modules/codec/omxil/utils.c
Changes:
=====================================
modules/codec/omxil/mediacodec_jni.c
=====================================
@@ -34,13 +34,12 @@
#include <OMX_Core.h>
#include <OMX_Component.h>
#include "omxil_utils.h"
-#include "../../packetizer/hevc_nal.h"
#include "mediacodec.h"
#include "../../video_output/android/env.h"
-char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
- int profile, int *p_quirks);
+char* MediaCodec_GetName(vlc_object_t *p_obj, vlc_fourcc_t codec,
+ const char *psz_mime, int profile, int *p_quirks);
#define THREAD_NAME "mediacodec_jni"
@@ -348,8 +347,8 @@ end:
/*****************************************************************************
* MediaCodec_GetName
*****************************************************************************/
-char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
- int profile, int *p_quirks)
+char* MediaCodec_GetName(vlc_object_t *p_obj, vlc_fourcc_t codec,
+ const char *psz_mime, int profile, int *p_quirks)
{
JNIEnv *env;
int num_codecs;
@@ -448,22 +447,8 @@ char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
int omx_profile = (*env)->GetIntField(env, profile_level, jfields.profile_field);
(*env)->DeleteLocalRef(env, profile_level);
- int codec_profile = 0;
- if (strcmp(psz_mime, "video/avc") == 0)
- codec_profile = convert_omx_to_profile_idc(omx_profile);
- else if (strcmp(psz_mime, "video/hevc") == 0)
- {
- switch (omx_profile)
- {
- case 0x1: /* OMX_VIDEO_HEVCProfileMain */
- codec_profile = VLC_HEVC_PROFILE_MAIN;
- break;
- case 0x2: /* OMX_VIDEO_HEVCProfileMain10 */
- case 0x1000: /* OMX_VIDEO_HEVCProfileMain10HDR10 */
- codec_profile = VLC_HEVC_PROFILE_MAIN_10;
- break;
- }
- }
+ int codec_profile =
+ convert_omx_to_profile_idc(codec, omx_profile);
if (codec_profile != profile)
continue;
/* Some encoders set the level too high, thus we ignore it for the moment.
@@ -1071,7 +1056,7 @@ static int Prepare(mc_api *api, int i_profile)
free(api->psz_name);
api->i_quirks = 0;
- api->psz_name = MediaCodec_GetName(api->p_obj, api->psz_mime,
+ api->psz_name = MediaCodec_GetName(api->p_obj, api->i_codec, api->psz_mime,
i_profile, &api->i_quirks);
if (!api->psz_name)
return MC_API_ERROR;
=====================================
modules/codec/omxil/mediacodec_ndk.c
=====================================
@@ -46,8 +46,8 @@ static_assert(MC_API_NO_QUIRKS == OMXCODEC_NO_QUIRKS
&& MC_API_AUDIO_QUIRKS_NEED_CHANNELS == OMXCODEC_AUDIO_QUIRKS_NEED_CHANNELS,
"mediacodec.h/omx_utils.h mismatch");
-char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
- int hxxx_profile, int *p_quirks);
+char* MediaCodec_GetName(vlc_object_t *p_obj, vlc_fourcc_t codec,
+ const char *psz_mime, int profile, int *p_quirks);
#define THREAD_NAME "mediacodec_ndk"
@@ -582,7 +582,7 @@ static int Prepare(mc_api * api, int i_profile)
free(api->psz_name);
api->i_quirks = 0;
- api->psz_name = MediaCodec_GetName(api->p_obj, api->psz_mime,
+ api->psz_name = MediaCodec_GetName(api->p_obj, api->i_codec, api->psz_mime,
i_profile, &api->i_quirks);
if (!api->psz_name)
return MC_API_ERROR;
=====================================
modules/codec/omxil/omxil_utils.h
=====================================
@@ -284,6 +284,4 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index);
/*****************************************************************************
* H264 specific code
*****************************************************************************/
-size_t convert_omx_to_profile_idc(OMX_VIDEO_AVCPROFILETYPE profile_type);
-
-size_t convert_omx_to_level_idc(OMX_VIDEO_AVCLEVELTYPE level_type);
+int convert_omx_to_profile_idc(vlc_fourcc_t codec, int profile_type);
=====================================
modules/codec/omxil/utils.c
=====================================
@@ -37,6 +37,8 @@
#include "qcom.h"
#include "../../video_chroma/copy.h"
#include "../../packetizer/h264_nal.h"
+#include "../../packetizer/hevc_nal.h"
+#include "../../packetizer/mpegvideo.h"
/*****************************************************************************
* Events utility functions
@@ -1213,11 +1215,13 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port)
}
}
-static const struct
+struct omx_to_profile_idc
{
- OMX_VIDEO_AVCPROFILETYPE omx_profile;
- size_t profile_idc;
-} omx_to_profile_idc[] =
+ int omx_profile;
+ int profile_idc;
+};
+
+static const struct omx_to_profile_idc avc_omx_to_profile_idc[] =
{
{ OMX_VIDEO_AVCProfileBaseline, PROFILE_H264_BASELINE },
{ OMX_VIDEO_AVCProfileMain, PROFILE_H264_MAIN },
@@ -1228,46 +1232,49 @@ static const struct
{ OMX_VIDEO_AVCProfileHigh444, PROFILE_H264_HIGH_444 },
};
-size_t convert_omx_to_profile_idc(OMX_VIDEO_AVCPROFILETYPE profile_type)
+static const struct omx_to_profile_idc hevc_omx_to_profile_idc[] =
{
- size_t array_length = sizeof(omx_to_profile_idc)/sizeof(omx_to_profile_idc[0]);
- for (size_t i = 0; i < array_length; ++i) {
- if (omx_to_profile_idc[i].omx_profile == profile_type)
- return omx_to_profile_idc[i].profile_idc;
- }
- return 0;
-}
+ { 0x1 /* OMX_VIDEO_HEVCProfileMain */, VLC_HEVC_PROFILE_MAIN },
+ { 0x2 /* OMX_VIDEO_HEVCProfileMain10 */, VLC_HEVC_PROFILE_MAIN_10 },
+ { 0x1000 /* OMX_VIDEO_HEVCProfileMain10HDR10 */, VLC_HEVC_PROFILE_MAIN_10 },
+};
-static const struct
+static const struct omx_to_profile_idc mpeg2_omx_to_profile_idc[] =
{
- OMX_VIDEO_AVCLEVELTYPE omx_level;
- size_t level_idc;
-} omx_to_level_idc[] =
-{
- { OMX_VIDEO_AVCLevel1, 10 },
- { OMX_VIDEO_AVCLevel1b, 9 },
- { OMX_VIDEO_AVCLevel11, 11 },
- { OMX_VIDEO_AVCLevel12, 12 },
- { OMX_VIDEO_AVCLevel13, 13 },
- { OMX_VIDEO_AVCLevel2, 20 },
- { OMX_VIDEO_AVCLevel21, 21 },
- { OMX_VIDEO_AVCLevel22, 22 },
- { OMX_VIDEO_AVCLevel3, 30 },
- { OMX_VIDEO_AVCLevel31, 31 },
- { OMX_VIDEO_AVCLevel32, 32 },
- { OMX_VIDEO_AVCLevel4, 40 },
- { OMX_VIDEO_AVCLevel41, 41 },
- { OMX_VIDEO_AVCLevel42, 42 },
- { OMX_VIDEO_AVCLevel5, 50 },
- { OMX_VIDEO_AVCLevel51, 51 },
+ { OMX_VIDEO_MPEG2ProfileHigh, PROFILE_MPEG2_HIGH },
+ { OMX_VIDEO_MPEG2ProfileSpatial, PROFILE_MPEG2_SPATIALLY_SCALABLE },
+ { OMX_VIDEO_MPEG2ProfileSNR, PROFILE_MPEG2_SNR_SCALABLE },
+ { OMX_VIDEO_MPEG2ProfileMain, PROFILE_MPEG2_MAIN },
+ { OMX_VIDEO_MPEG2ProfileSimple, PROFILE_MPEG2_SIMPLE },
+ { OMX_VIDEO_MPEG2Profile422, PROFILE_MPEG2_422 },
};
-size_t convert_omx_to_level_idc(OMX_VIDEO_AVCLEVELTYPE level_type)
+int convert_omx_to_profile_idc(vlc_fourcc_t codec, int profile_type)
{
- size_t array_length = sizeof(omx_to_level_idc)/sizeof(omx_to_level_idc[0]);
+ const struct omx_to_profile_idc *omx_to_profile_idc = NULL;
+ size_t array_length;
+ switch (codec)
+ {
+ case VLC_CODEC_H264:
+ omx_to_profile_idc = avc_omx_to_profile_idc;
+ array_length = ARRAY_SIZE(avc_omx_to_profile_idc);
+ break;
+ case VLC_CODEC_HEVC:
+ omx_to_profile_idc = hevc_omx_to_profile_idc;
+ array_length = ARRAY_SIZE(hevc_omx_to_profile_idc);
+ break;
+ case VLC_CODEC_MPGV:
+ case VLC_CODEC_MP2V:
+ omx_to_profile_idc = mpeg2_omx_to_profile_idc;
+ array_length = ARRAY_SIZE(mpeg2_omx_to_profile_idc);
+ break;
+ default:
+ return 0;
+ }
+
for (size_t i = 0; i < array_length; ++i) {
- if (omx_to_level_idc[i].omx_level == level_type)
- return omx_to_level_idc[i].level_idc;
+ if (omx_to_profile_idc[i].omx_profile == profile_type)
+ return omx_to_profile_idc[i].profile_idc;
}
return 0;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/11d7708b1a6540b7473d159c6c2ac5c7f73b0b60...4b8cc4971d7eeabfff9be32fa228e98c5695a44c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/11d7708b1a6540b7473d159c6c2ac5c7f73b0b60...4b8cc4971d7eeabfff9be32fa228e98c5695a44c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list