}
#define CHECK_EXCEPTION() check_exception( env )
+static bool codec_is_blacklisted( const char *p_name, int i_name_len )
+{
+ static const char *blacklisted_codecs[] = {
+ /* software decoders */
+ "OMX.google.",
+ /* crashes mediaserver */
+ "OMX.MTK.VIDEO.DECODER.MPEG4",
+ NULL,
+ };
+
+ for( const char **pp_bl_codecs = blacklisted_codecs; *pp_bl_codecs != NULL;
+ pp_bl_codecs++ )
+ {
+ if( !strncmp( p_name, *pp_bl_codecs,
+ __MIN( strlen(*pp_bl_codecs), i_name_len ) ) )
+ return true;
+ }
+ return false;
+}
+
/*****************************************************************************
* OpenDecoder: Create the decoder instance
*****************************************************************************/
name_ptr = (*env)->GetStringUTFChars(env, name, NULL);
found = false;
- if (!strncmp(name_ptr, "OMX.google.", __MIN(11, name_len)))
- goto loopclean;
- if (!strncmp(name_ptr, "OMX.MTK.VIDEO.DECODER.MPEG4", name_len))
+ if (codec_is_blacklisted( name_ptr, name_len))
goto loopclean;
for (int j = 0; j < num_types && !found; j++) {
jobject type = (*env)->GetObjectArrayElement(env, types, j);