int audiodec_init(aml_audio_dec_t *audec)
{
    int ret = 0;
    pthread_t    tid;
    adec_print("audiodec_init!");
    adec_message_pool_init(audec);
    get_output_func(audec);
    int nCodecType=audec->format;
    set_audio_decoder(audec);
    audec->format_changed_flag=0;
    if (get_audio_decoder() == AUDIO_ARC_DECODER) {
    		audec->adsp_ops.dsp_file_fd = -1;
		ret = pthread_create(&tid, NULL, (void *)adec_message_loop, (void *)audec);
    }
    else 
    {
		int codec_type=get_audio_decoder();
		RegisterDecode(audec,codec_type);
		ret = pthread_create(&tid, NULL, (void *)adec_armdec_loop, (void *)audec);
    }
    if (ret != 0) {
        adec_print("Create adec main thread failed!\n");
        return ret;
    }
    adec_print("Create adec main thread success! tid = %d\n", tid);
    audec->thread_pid = tid;
    return ret;
}
Example #2
0
int audiodec_init(aml_audio_dec_t *audec)
{
    int ret = 0;
    pthread_t    tid;
    char value[PROPERTY_VALUE_MAX]={0};
    unsigned wfd = 0;	
    adec_print("audiodec_init!");
    adec_message_pool_init(audec);
    get_output_func(audec);
    int nCodecType=audec->format;
    set_audio_decoder(audec);
    audec->format_changed_flag=0;
    audec->audio_decoder_enabled  = -1;//default set a invalid value
    audec->mix_lr_channel_enable  = -1;
    audec->VersionNum=-1;
    if(am_getconfig_bool("media.libplayer.wfd"))  {
  	wfd = 1;
   }		
    if (get_audio_decoder() == AUDIO_ARC_DECODER) {
    		audec->adsp_ops.dsp_file_fd = -1;
		ret = amthreadpool_pthread_create(&tid, NULL, (void *)adec_message_loop, (void *)audec);
		pthread_setname_np(tid,"AmadecMsgloop");
    }
    else if(wfd && (nCodecType == ACODEC_FMT_AAC ||nCodecType ==  ACODEC_FMT_WIFIDISPLAY)){
		adec_print("using wfd audio decoder \n");
		ret = amthreadpool_pthread_create(&tid, NULL, (void *)adec_wfddec_msg_loop, (void *)audec);
		audec->audio_decoder_enabled = 0x1;
		pthread_setname_np(tid,"AmadecWFDMsgloop");
    }
    else 
    {
		int codec_type=get_audio_decoder();
		RegisterDecode(audec,codec_type);
		ret = amthreadpool_pthread_create(&tid, NULL, (void *)adec_armdec_loop, (void *)audec);
		pthread_mutex_init(&audec->thread_mgt.pthread_mutex, NULL);
		pthread_cond_init(&audec->thread_mgt.pthread_cond, NULL);
		audec->thread_mgt.pthread_id = tid;
		pthread_setname_np(tid,"AmadecArmdecLP");
    }
    if (ret != 0) {
        adec_print("Create adec main thread failed!\n");
        return ret;
    }
    adec_print("Create adec main thread success! tid = %d\n", tid);
    audec->thread_pid = tid;
    return ret;
}
Example #3
0
int audiodec_init(aml_audio_dec_t *audec)
{
    int ret = 0;
    int res = 0;	
    pthread_t    tid;
	char value[PROPERTY_VALUE_MAX]={0};
    adec_print("audiodec_init!\n");
    adec_message_pool_init(audec);
    get_output_func(audec);
    int nCodecType=audec->format;
#ifdef ANDROID
    set_audio_decoder(audec);
#else
    set_linux_audio_decoder(audec);

#endif
    audec->format_changed_flag=0;
		
    if (get_audio_decoder() == AUDIO_ARC_DECODER) {
    		audec->adsp_ops.dsp_file_fd = -1;
		ret = pthread_create(&tid, NULL, (void *)adec_message_loop, (void *)audec);
		//pthread_setname_np(tid,"AmadecMsgloop");
    }
    else 
    {   
        int codec_type=get_audio_decoder();
        res=RegisterDecode(audec,codec_type);
        if(!res){ 		
        ret = pthread_create(&tid, NULL, (void *)adec_armdec_loop, (void *)audec);
        //pthread_setname_np(tid,"AmadecArmdecLP");
        }else{
        adec_print("no arm decoding lib find,so change to arc dsp decoding\n");
        audec->adsp_ops.dsp_file_fd = -1;
        audec->adec_ops=NULL;
        ret = pthread_create(&tid, NULL, (void *)adec_message_loop, (void *)audec);
        //pthread_setname_np(tid,"AmadecMsgloop");
	}   
    }
    if (ret != 0) {
        adec_print("Create adec main thread failed!\n");
        return ret;
    }
    adec_print("Create adec main thread success! tid = %d\n", tid);
    audec->thread_pid = tid;
    return ret;
}