CTsPlayer::CTsPlayer() { memset(&aPara,0,sizeof(aPara)); memset(&vPara,0,sizeof(vPara)); memset(&codec,0,sizeof(codec)); player_pid=-1; pcodec=&codec; codec_audio_basic_init(); }
int player_init(void) { print_version_info(); update_loglevel_setting(); /*register all formats and codecs*/ ffmpeg_init(); player_id_pool_init(); codec_audio_basic_init(); /*register all support decoder */ ts_register_stream_decoder(); es_register_stream_decoder(); ps_register_stream_decoder(); rm_register_stream_decoder(); audio_register_stream_decoder(); video_register_stream_decoder(); return PLAYER_SUCCESS; }
void ES_PlayInit() { int ret = CODEC_ERROR_NONE; //Init Video Codecs vpcodec = &v_codec_para; memset(vpcodec, 0, sizeof(codec_para_t )); codec_audio_basic_init(); vpcodec->has_video = 1; vpcodec->video_type = VFORMAT_H264; vpcodec->am_sysinfo.format = VIDEO_DEC_FORMAT_H264; vpcodec->am_sysinfo.param = (void *)(EXTERNAL_PTS | SYNC_OUTSIDE); vpcodec->stream_type = STREAM_TYPE_ES_VIDEO; vpcodec->am_sysinfo.rate = 96000/24 ;//96000 / atoi(argv[4]); //vpcodec->am_sysinfo.height = atoi(argv[3]); //vpcodec->am_sysinfo.width = atoi(argv[2]); vpcodec->has_audio = 0; vpcodec->noblock = 0; apcodec = &a_codec_para; memset(apcodec, 0, sizeof(codec_para_t )); apcodec->audio_type = AFORMAT_AAC; apcodec->stream_type = STREAM_TYPE_ES_AUDIO; // apcodec->audio_pid = 0x1023; apcodec->has_audio = 1; apcodec->noblock = 0; //Do NOT set audio info if we do not know it apcodec->audio_channels = 0; apcodec->audio_samplerate = 0; apcodec->audio_info.channels = 0; apcodec->audio_info.sample_rate = 0; //apcodec->audio_channels = 2; //apcodec->audio_samplerate = 44100; //apcodec->audio_info.channels = 2; //apcodec->audio_info.sample_rate = 44100; ret = codec_init(vpcodec); if(ret != CODEC_ERROR_NONE) { printf("v codec init failed, ret=-0x%x", -ret); return; } ret = codec_init(apcodec); if(ret != CODEC_ERROR_NONE) { printf("a codec init failed, ret=-0x%x", -ret); return; } //codec_set_av_threshold(apcodec, 180); }