static int set_audio_decoder(aml_audio_dec_t *audec)
{
	int audio_id;
	int i;	
    int num;
	int ret;
    audio_type_t *t;
	char value[PROPERTY_VALUE_MAX];
	

	audio_id = audec->format;

    num = ARRAY_SIZE(audio_type);
    for (i = 0; i < num; i++) {
        t = &audio_type[i];
        if (t->audio_id == audio_id) {
            break;
        }
    }
	
#ifdef ANDROID
	ret = property_get("media.arm.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		audio_decoder = AUDIO_ARM_DECODER;
		return 0;
	} 
	
	ret = property_get("media.arc.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		if(audec->dspdec_not_supported == 0)
			audio_decoder = AUDIO_ARC_DECODER;
		else{
			audio_decoder = AUDIO_ARM_DECODER;	
			adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n",__FUNCTION__, __LINE__);
		}
		return 0;
	} 
	
	ret = property_get("media.ffmpeg.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		audio_decoder = AUDIO_FFMPEG_DECODER;
		return 0;
	} 
#endif
	
	audio_decoder = AUDIO_ARC_DECODER; //set arc decoder as default
	if(audec->dspdec_not_supported == 1){
		audio_decoder = AUDIO_ARM_DECODER;	
		adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n",__FUNCTION__, __LINE__);
	}	
	return 0;
}
static int set_audio_decoder(int codec_id)
{
	int audio_id;
#if 0
	int i;	
    int num;
	int ret;
    audio_type_t *t;
	char value[PROPERTY_VALUE_MAX];
	

	audio_id = codec_id;

    num = ARRAY_SIZE(audio_type);
    for (i = 0; i < num; i++) {
        t = &audio_type[i];
        if (t->audio_id == audio_id) {
            break;
        }
    }
	
	ret = property_get("media.arm.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		audio_decoder = AUDIO_ARM_DECODER;
		return 0;
	} 
	
	ret = property_get("media.arc.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		audio_decoder = AUDIO_ARC_DECODER;
		return 0;
	} 
	
	ret = property_get("media.ffmpeg.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		audio_decoder = AUDIO_FFMPEG_DECODER;
		return 0;
	} 
#endif	
	audio_decoder = AUDIO_ARC_DECODER; //set arc decoder as default
	return 0;
}
Esempio n. 3
0
static bool
dccp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
{
	const struct xt_dccp_info *info = par->matchinfo;
	const struct dccp_hdr *dh;
	struct dccp_hdr _dh;

	if (par->fragoff != 0)
		return false;

	dh = skb_header_pointer(skb, par->thoff, sizeof(_dh), &_dh);
	if (dh == NULL) {
		*par->hotdrop = true;
		return false;
	}

	return  DCCHECK(ntohs(dh->dccph_sport) >= info->spts[0]
			&& ntohs(dh->dccph_sport) <= info->spts[1],
			XT_DCCP_SRC_PORTS, info->flags, info->invflags)
		&& DCCHECK(ntohs(dh->dccph_dport) >= info->dpts[0]
			&& ntohs(dh->dccph_dport) <= info->dpts[1],
			XT_DCCP_DEST_PORTS, info->flags, info->invflags)
		&& DCCHECK(match_types(dh, info->typemask),
			   XT_DCCP_TYPE, info->flags, info->invflags)
		&& DCCHECK(match_option(info->option, skb, par->thoff, dh,
					par->hotdrop),
			   XT_DCCP_OPTION, info->flags, info->invflags);
}
static int
match(const struct sk_buff *skb,
      const struct net_device *in,
      const struct net_device *out,
      const void *matchinfo,
      int offset,
      unsigned int protoff,
      int *hotdrop)
{
	const struct xt_dccp_info *info = 
				(const struct xt_dccp_info *)matchinfo;
	struct dccp_hdr _dh, *dh;

	if (offset)
		return 0;
	
	dh = skb_header_pointer(skb, protoff, sizeof(_dh), &_dh);
	if (dh == NULL) {
		*hotdrop = 1;
		return 0;
       	}

	return  DCCHECK(((ntohs(dh->dccph_sport) >= info->spts[0]) 
			&& (ntohs(dh->dccph_sport) <= info->spts[1])), 
		   	XT_DCCP_SRC_PORTS, info->flags, info->invflags)
		&& DCCHECK(((ntohs(dh->dccph_dport) >= info->dpts[0]) 
			&& (ntohs(dh->dccph_dport) <= info->dpts[1])), 
			XT_DCCP_DEST_PORTS, info->flags, info->invflags)
		&& DCCHECK(match_types(dh, info->typemask),
			   XT_DCCP_TYPE, info->flags, info->invflags)
		&& DCCHECK(match_option(info->option, skb, protoff, dh,
					hotdrop),
			   XT_DCCP_OPTION, info->flags, info->invflags);
}
static int get_cpu_type(void)
{
    char value[PROPERTY_VALUE_MAX];
    int ret = property_get("ro.board.platform",value,NULL);
    adec_print("ro.board.platform = %s\n", value);
    if (ret>0 && match_types("meson6",value))
    	return 1;
    return 0;
}
Esempio n. 6
0
static int set_linux_audio_decoder(aml_audio_dec_t *audec)
{
    int audio_id;
    int i;	
    int num;
    int ret;
    audio_type_t *t;
    char *value;
    audio_id = audec->format;

    num = ARRAY_SIZE(audio_type);
    for (i = 0; i < num; i++) {
        t = &audio_type[i];
        if (t->audio_id == audio_id) {
            break;
        }
    }	
    value = getenv("media_arm_audio_decoder");
    adec_print("media.armdecode.audiocodec = %s, t->type = %s\n", value, t->type);
    if (value!=NULL && match_types(t->type,value))
    {	
        char type_value[] = "ac3,eac3";
        if(match_types(t->type,type_value))
        {   
        #ifdef DOLBY_USE_ARMDEC
            adec_print("DOLBY_USE_ARMDEC=%d",DOLBY_USE_ARMDEC);
            audio_decoder = AUDIO_ARM_DECODER;					  
        #else
            #if 0
            audio_decoder = AUDIO_ARC_DECODER;
            adec_print("<DOLBY_USE_ARMDEC> is not DEFINED,use ARC_Decoder\n!");
            #else
            audio_decoder = AUDIO_ARM_DECODER;
            adec_print("<DOLBY_USE_ARMDEC> is DEFINED,use ARM_DECODER\n!");
            #endif
        #endif
        }else{
            audio_decoder = AUDIO_ARM_DECODER;
        }		 
        return 0;
    } 
	
   value= getenv("media_arc_audio_decoder");
    adec_print("media.arcdecode.audiocodec = %s, t->type = %s\n", value, t->type);
    if (value!=NULL && match_types(t->type,value))
    {	
        if(audec->dspdec_not_supported == 0)
            audio_decoder = AUDIO_ARC_DECODER;
        else{
            audio_decoder = AUDIO_ARM_DECODER;	
            adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n",__FUNCTION__, __LINE__);
        }
        return 0;
    } 
	
    value = getenv("media.ffmpeg.audio.decoder");
    adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
    if (value!=NULL && match_types(t->type,value))
    {	
        audio_decoder = AUDIO_FFMPEG_DECODER;
        return 0;
    } 
	
    audio_decoder = AUDIO_ARC_DECODER; //set arc decoder as default
    if(audec->dspdec_not_supported == 1){
        audio_decoder = AUDIO_ARM_DECODER;	
    }
    return 0;
}
// see docstring in .h file
std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::string& pfx)
{
    // An undefined prototype means that any data is valid.
    // An undefined slot in an array or map prototype means that any data
    // may fill that slot.
    if (prototype.isUndefined())
        return "";
    // A prototype array must match a data array with at least as many
    // entries. Moreover, every prototype entry must match the
    // corresponding data entry.
    if (prototype.isArray())
    {
        if (! data.isArray())
        {
            return STRINGIZE(colon(pfx) << "Array" << op << sTypes.lookup(data.type()));
        }
        if (data.size() < prototype.size())
        {
            return STRINGIZE(colon(pfx) << "Array size " << prototype.size() << op
                             << "Array size " << data.size());
        }
        for (LLSD::Integer i = 0; i < prototype.size(); ++i)
        {
            std::string match(llsd_matches(prototype[i], data[i], STRINGIZE('[' << i << ']')));
            if (! match.empty())
            {
                return match;
            }
        }
        return "";
    }
    // A prototype map must match a data map. Every key in the prototype
    // must have a corresponding key in the data map; every value in the
    // prototype must match the corresponding key's value in the data.
    if (prototype.isMap())
    {
        if (! data.isMap())
        {
            return STRINGIZE(colon(pfx) << "Map" << op << sTypes.lookup(data.type()));
        }
        // If there are a number of keys missing from the data, it would be
        // frustrating to a coder to discover them one at a time, with a big
        // build each time. Enumerate all missing keys.
        std::ostringstream out;
        out << colon(pfx);
        const char* init = "Map missing keys: ";
        const char* sep = init;
        for (LLSD::map_const_iterator mi = prototype.beginMap(); mi != prototype.endMap(); ++mi)
        {
            if (! data.has(mi->first))
            {
                out << sep << mi->first;
                sep = ", ";
            }
        }
        // So... are we missing any keys?
        if (sep != init)
        {
            return out.str();
        }
        // Good, the data block contains all the keys required by the
        // prototype. Now match the prototype entries.
        for (LLSD::map_const_iterator mi2 = prototype.beginMap(); mi2 != prototype.endMap(); ++mi2)
        {
            std::string match(llsd_matches(mi2->second, data[mi2->first],
                                           STRINGIZE("['" << mi2->first << "']")));
            if (! match.empty())
            {
                return match;
            }
        }
        return "";
    }
    // A String prototype can match String, Boolean, Integer, Real, UUID,
    // Date and URI, because any of these can be converted to String.
    if (prototype.isString())
    {
        static LLSD::Type accept[] =
        {
            LLSD::TypeBoolean,
            LLSD::TypeInteger,
            LLSD::TypeReal,
            LLSD::TypeUUID,
            LLSD::TypeDate,
            LLSD::TypeURI
        };
        return match_types(prototype.type(),
                           TypeVector(boost::begin(accept), boost::end(accept)),
                           data.type(),
                           pfx);
    }
    // Boolean, Integer, Real match each other or String. TBD: ensure that
    // a String value is numeric.
    if (prototype.isBoolean() || prototype.isInteger() || prototype.isReal())
    {
        static LLSD::Type all[] =
        {
            LLSD::TypeBoolean,
            LLSD::TypeInteger,
            LLSD::TypeReal,
            LLSD::TypeString
        };
        // Funny business: shuffle the set of acceptable types to include all
        // but the prototype's type. Get the acceptable types in a set.
        std::set<LLSD::Type> rest(boost::begin(all), boost::end(all));
        // Remove the prototype's type because we pass that separately.
        rest.erase(prototype.type());
        return match_types(prototype.type(),
                           TypeVector(rest.begin(), rest.end()),
                           data.type(),
                           pfx);
    }
    // UUID, Date and URI match themselves or String.
    if (prototype.isUUID() || prototype.isDate() || prototype.isURI())
    {
        static LLSD::Type accept[] =
        {
            LLSD::TypeString
        };
        return match_types(prototype.type(),
                           TypeVector(boost::begin(accept), boost::end(accept)),
                           data.type(),
                           pfx);
    }
    // We don't yet know the conversion semantics associated with any new LLSD
    // data type that might be added, so until we've been extended to handle
    // them, assume it's strict: the new type matches only itself. (This is
    // true of Binary, which is why we don't handle that case separately.) Too
    // bad LLSD doesn't define isConvertible(Type to, Type from).
    return match_types(prototype.type(), TypeVector(), data.type(), pfx);
}
Esempio n. 8
0
static int set_audio_decoder(aml_audio_dec_t *audec)
{
	int audio_id;
	int i;	
    int num;
	int ret;
    audio_type_t *t;
	char value[PROPERTY_VALUE_MAX];
	

	audio_id = audec->format;

    num = ARRAY_SIZE(audio_type);
    for (i = 0; i < num; i++) {
        t = &audio_type[i];
        if (t->audio_id == audio_id) {
            break;
        }
    }

    if(match_types(t->type, "thd")||match_types(t->type, "wmavoi")){
        adec_print("audio format is %s, so chose AUDIO_ARM_DECODER",t->type);
        audio_decoder = AUDIO_ARM_DECODER;
        goto exit;
    }


	ret = property_get("media.arm.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		char type_value[] = "ac3,eac3";
		set_multichs_prop();
		if(match_types(t->type,type_value))
		{   
            #ifdef DOLBY_USE_ARMDEC
            adec_print("DOLBY_USE_ARMDEC=%d",DOLBY_USE_ARMDEC);
            audio_decoder = AUDIO_ARM_DECODER;
            #else
            audio_decoder = AUDIO_ARC_DECODER;
            adec_print("<DOLBY_USE_ARMDEC> is not DEFINED,use ARC_Decoder\n!");
            #endif
        }
        #ifndef USE_ARM_AUDIO_DEC
        else if(match_types(t->type, "dts")){
            if(access("/system/etc/firmware/audiodsp_codec_dtshd.bin",F_OK)){
                adec_print("using no license dts component");
                audio_decoder = AUDIO_ARM_DECODER;
            }else{
                adec_print("using audiodsp dts decoder");
                audio_decoder = AUDIO_ARC_DECODER;
            }
        }
        #endif
        else{
            audio_decoder = AUDIO_ARM_DECODER;
        }
        goto exit;
    }
	
	ret = property_get("media.arc.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		if(audec->dspdec_not_supported == 0)
			audio_decoder = AUDIO_ARC_DECODER;
		else{
			audio_decoder = AUDIO_ARM_DECODER;	
			adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n",__FUNCTION__, __LINE__);
		}
		goto exit;
	} 
	
	ret = property_get("media.ffmpeg.audio.decoder",value,NULL);
	adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
	if (ret>0 && match_types(t->type,value))
	{	
		audio_decoder = AUDIO_FFMPEG_DECODER;
		goto exit;
	} 
	
	audio_decoder = AUDIO_ARC_DECODER; //set arc decoder as default
	if(audec->dspdec_not_supported == 1){
		audio_decoder = AUDIO_ARM_DECODER;	
		adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n",__FUNCTION__, __LINE__);
	}
exit:
	if(am_getconfig_bool("media.libplayer.wfd") && (audio_id ==ACODEC_FMT_WIFIDISPLAY ||audio_id==ACODEC_FMT_AAC)){
		adec_print("wfd use arm decoder \n");
		audio_decoder = AUDIO_ARMWFD_DECODER;
	}	
	return 0;
}