/** * \brief start audio dec when receive START command. * \param audec pointer to audec */ static void start_adec(aml_audio_dec_t *audec) { int ret; audio_out_operations_t *aout_ops = &audec->aout_ops; dsp_operations_t *dsp_ops = &audec->adsp_ops; if (audec->state == INITTED) { audec->state = ACTIVE; while ((!audiodsp_get_first_pts_flag(dsp_ops)) && (!audec->need_stop)) { adec_print("wait first pts checkin complete !"); usleep(100000); } /*start the the pts scr,...*/ ret = adec_pts_start(audec); //adec_pts_droppcm(audec); if (audec->auto_mute) { avsync_en(0); audiodsp_automute_on(dsp_ops); adec_pts_pause(); while ((!audec->need_stop) && track_switch_pts(audec)) { usleep(1000); } audiodsp_automute_off(dsp_ops); avsync_en(1); adec_pts_resume(); audec->auto_mute = 0; } aout_ops->start(audec); } }
/** * \brief start audio dec when receive START command. * \param audec pointer to audec */ static void start_adec(aml_audio_dec_t *audec) { int ret; audio_out_operations_t *aout_ops = &audec->aout_ops; dsp_operations_t *dsp_ops = &audec->adsp_ops; if (audec->state == INITTED) { audec->state = ACTIVE; #if 1 //get info from the audiodsp == can get from amstreamer while ((!get_first_apts_flag(dsp_ops)) && (!audec->need_stop)) { adec_print("wait first pts checkin complete !"); usleep(100000); } /*start the the pts scr,...*/ ret = adec_pts_start(audec); if (audec->auto_mute) { avsync_en(0); adec_pts_pause(); while ((!audec->need_stop) && track_switch_pts(audec)) { usleep(1000); } avsync_en(1); adec_pts_resume(); audec->auto_mute = 0; } #endif aout_ops->start(audec); } }
/** * \brief start audio dec when receive START command. * \param audec pointer to audec */ static void start_adec(aml_audio_dec_t *audec) { int ret; audio_out_operations_t *aout_ops = &audec->aout_ops; dsp_operations_t *dsp_ops = &audec->adsp_ops; unsigned long vpts,apts; int times=0; char buf[32]; apts = vpts = 0; audec->no_first_apts = 0; if (audec->state == INITTED) { audec->state = ACTIVE; while ((!audiodsp_get_first_pts_flag(dsp_ops)) && (!audec->need_stop) && (!audec->no_first_apts)) { adec_print("wait first pts checkin complete times=%d,!\n",times); times++; if (times>=5) { // read vpts amsysfs_get_sysfs_str(TSYNC_VPTS, buf, sizeof(buf)); if (sscanf(buf, "0x%lx", &vpts) < 1) { adec_print("unable to get vpts from: %s", buf); return -1; } // save vpts to apts adec_print("## can't get first apts, save vpts to apts,vpts=%lx, \n",vpts); sprintf(buf, "0x%lx", vpts); amsysfs_set_sysfs_str(TSYNC_APTS, buf); audec->no_first_apts = 1; } usleep(100000); } /*Since audio_track->start consumed too much time *for the first time after platform restart, *so execute start cmd before adec_pts_start */ aout_ops->start(audec); aout_ops->pause(audec); /*start the the pts scr,...*/ ret = adec_pts_start(audec); //adec_pts_droppcm(audec); if (audec->auto_mute) { avsync_en(0); audiodsp_automute_on(dsp_ops); adec_pts_pause(); while ((!audec->need_stop) && track_switch_pts(audec)) { usleep(1000); } audiodsp_automute_off(dsp_ops); avsync_en(1); adec_pts_resume(); audec->auto_mute = 0; } aout_ops->resume(audec); } }