⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileplayer.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 5 页
字号:
				channel_count = specificInfo.data.wave.channels;				audio_opt->skip_first_n_bytes = specificInfo.data.wave.payloadOffset;				audio_opt->send_n_bytes = specificInfo.data.wave.payloadLength;				audio_opt->PcmCdaParams.BitsPerSample = specificInfo.data.wave.bitsPerSample; /*bitrate/(frequency*channel_count);*/				if(audio_opt->PcmCdaParams.BitsPerSample <=8)					audio_opt->SignedPCM = FALSE; 								audio_opt->SubCodec = 0;				/* if the detector could tell it is PCM, it must be from a WAVE file */				audio_opt->PcmCdaParams.MsbFirst = FALSE;				switch(channel_count){				case 1:					audio_opt->PcmCdaParams.ChannelAssign = PcmCda1_C;					audio_opt->OutputDualMode = DualMode_MixMono;					break;				case 2:					audio_opt->PcmCdaParams.ChannelAssign = PcmCda2_LR;					audio_opt->OutputDualMode = DualMode_Stereo;					break;				case 6:					audio_opt->PcmCdaParams.ChannelAssign = PcmCda6_LfRfCLfeLsRs;					audio_opt->OutputDualMode = DualMode_Stereo;					break;				}				break;			case eAudioFormat_AC3:				RMDBGLOG((ENABLE, "AC3\n"));								bitrate = specificInfo.data.ac3.bitrate;				frequency = specificInfo.data.ac3.sampleRate;				channel_count = specificInfo.data.ac3.channels;				break;			case eAudioFormat_DTS:				RMDBGLOG((ENABLE, "DTS\n"));								bitrate = specificInfo.data.dts.bitrate;				frequency = specificInfo.data.dts.sampleRate;				channel_count = specificInfo.data.dts.channels;				break;			case eAudioFormat_MPEG1:			case eAudioFormat_MPEG2_LAYER1:			case eAudioFormat_MPEG2:			case eAudioFormat_MPEG2_LAYER2:			case eAudioFormat_MPEG1_LAYER3:			case eAudioFormat_MPEG2_LAYER3:				RMDBGLOG((ENABLE, "MPEG\n"));								if (!specificInfo.data.mpegAudio.isVBR)					bitrate = specificInfo.data.mpegAudio.bitrate;				else					bitrate = 0;				frequency = specificInfo.data.mpegAudio.sampleRate;				channel_count = specificInfo.data.mpegAudio.channels;				break;			case eAudioFormat_AAC_ADTS:				RMDBGLOG((ENABLE, "AAC ADTS\n"));								bitrate = 0;				frequency = specificInfo.data.adts.sampleRate;				channel_count = specificInfo.data.adts.channels;						break;			case eAudioFormat_AAC_ADIF:				RMDBGLOG((ENABLE, "AAC ADIF\n"));								if (!specificInfo.data.adif.isVBR)					bitrate = specificInfo.data.adif.bitrate;				else					bitrate = 0;				frequency = specificInfo.data.adif.sampleRate;				channel_count = specificInfo.data.adif.channels;				break;							case eAudioFormat_UNKNOWN:				RMDBGLOG((ENABLE, "the specific info request seems to be invalid\n"));				break;			default:				RMDBGLOG((ENABLE, "unrecognised specific info!\n"));				break;			}			RMDBGLOG((ENABLE, "sampleRate %lu, bitrate %lu, channels %lu\n", frequency, bitrate, channel_count));			stream_info->audio_type = detectedAudioType;		}				if (bitrate) {			play_opt->duration = (8000*file_size)/bitrate;			RMDBGLOG((LOCALDBG, "estimated duration is %lld (bitrate %lu)\n", play_opt->duration, bitrate));		}		else			RMDBGLOG((ENABLE, "Could not estimate duration\n"));		AudioFormatToCodec(stream_info->audio_type, audio_opt);				audio_opt->SamplingFrequency = 0;  // default: same as SampleRate		if (audio_opt->dh_info && audio_opt->dh_info->pDH) {  // HDMI is active, up/downsample to basic HDMI audio frequencies			if (audio_opt->Codec == AudioDecoder_Codec_PCM) {				RMDBGLOG((LOCALDBG, "Setting PCM audio sampling rate to %ld\n", frequency));				audio_opt->SamplingFrequency = frequency;  // maintain source sample rate for uncompressed audio			}			switch (frequency) {			case 8000: 			case 12000: 			case 16000: 			case 32000: 			case 64000: 			case 128000: 				audio_opt->SampleRate = 32000;				break;			case 11025: 			case 22050: 			case 44100: 			case 88200: 			case 176400: 				audio_opt->SampleRate = 44100;				break;			case 24000: 			case 48000: 			case 96000: 			case 192000: 			default:				audio_opt->SampleRate = 48000;				break;			}		} else {			audio_opt->SampleRate = frequency;		}		audio_opt->ForceSampleRate = TRUE;		RMDBGLOG((LOCALDBG, "Setting audio sample rate to %ld\n", audio_opt->SampleRate));		stream_info->system_type = RM_SYSTEM_ELEMENTARY_AUDIO;		break;	case DETECTOR_VIDEO_MPEG1:	case DETECTOR_VIDEO_MPEG2:		fprintf(stderr, "video\n");		RMFDetectVideo(detector, NULL, 0, &stream_info->video_type, &bitrate, &detected);		VideoFormatToCodec(stream_info->video_type, video_opt, detect_opt);		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		break;	case DETECTOR_VIDEO_MPEG4:		fprintf(stderr, "video\n");		VideoFormatToCodec(RM_VIDEO_MPEG4, video_opt, detect_opt);		stream_info->video_type = RM_VIDEO_MPEG4;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		break;	case DETECTOR_VIDEO_H263:		fprintf(stderr, "video\n");		VideoFormatToCodec(RM_VIDEO_H263, video_opt, detect_opt);		stream_info->video_type = RM_VIDEO_H263;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		break;	case DETECTOR_VIDEO_H264:		fprintf(stderr, "video\n");		VideoFormatToCodec(RM_VIDEO_H264, video_opt, detect_opt);		stream_info->video_type = RM_VIDEO_H264;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		break;	case DETECTOR_VIDEO_VC1:		fprintf(stderr, "video\n");		VideoFormatToCodec(RM_VIDEO_VC1, video_opt, detect_opt);		stream_info->video_type = RM_VIDEO_VC1;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		break;	case DETECTOR_SYSTEM_M1S:		fprintf(stderr, "m1s\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_M1S (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG1;		demux_opt->repack_sample = FALSE;		stream_info->system_type = RM_SYSTEM_MPEG1;		break;	case DETECTOR_SYSTEM_M2P:		fprintf(stderr, "m2p\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_M2P (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG2_PROGRAM;		demux_opt->repack_sample = FALSE;		stream_info->system_type = RM_SYSTEM_MPEG2_PROGRAM;		break;	case DETECTOR_SYSTEM_M2T_192:		fprintf(stderr, "m2t_192\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_M2T_192 (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG2_TRANSPORT_192;		demux_opt->repack_sample = TRUE;		stream_info->system_type = RM_SYSTEM_MPEG2_TRANSPORT_192;		break;	case DETECTOR_SYSTEM_M2T:		fprintf(stderr, "m2t\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_M2T (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG2_TRANSPORT;		demux_opt->repack_sample = TRUE;		stream_info->system_type = RM_SYSTEM_MPEG2_TRANSPORT;		break;	case DETECTOR_SYSTEM_M4T:		fprintf(stderr, "m4t\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_M4T (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG2_TRANSPORT;		demux_opt->repack_sample = TRUE;		stream_info->system_type = RM_SYSTEM_MPEG2_TRANSPORT;		break;	case DETECTOR_SYSTEM_M4P:		fprintf(stderr, "m4p\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_M4P (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG2_PROGRAM;		stream_info->system_type = RM_SYSTEM_MPEG2_PROGRAM;		demux_opt->repack_sample = FALSE;		break;	case DETECTOR_SYSTEM_VOB:		fprintf(stderr, "vob\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_VOB (%ld)\n", type));		demux_opt->system_type = RM_SYSTEM_MPEG2_DVD;		demux_opt->repack_sample = FALSE;		stream_info->system_type = RM_SYSTEM_MPEG2_DVD;		break;	case DETECTOR_SYSTEM_AVI:		fprintf(stderr, "avi\n");				/* create a avi demux, demux video and find user data */		{			struct parse_avi_context context = {0,};			/* #### Begin DTCP code #### */			if (!app_params->dtcpCookieHandle)			/* #### End DTCP code #### */				parse_avi(file, &context);						/* #### Begin DTCP code #### */			else {				RMfile dtcp_file;							/* Open the stream with caching if it is DTCP, because we seek a lot during parsing */				app_params->stream_opts.http_flags |=  RM_HTTP_OPEN_CACHED;				dtcp_file = open_stream(play_opt->filename, RM_FILE_OPEN_READ, &app_params->stream_opts);				if (dtcp_file == NULL) {					RMDBGLOG((ENABLE, "Cannot open file %s\n", play_opt->filename));					break;				}				parse_avi(dtcp_file, &context);				RMCloseFile(dtcp_file);							}			/* #### End DTCP code #### */				if (context.packed) {				RMDBGLOG((ENABLE, "PACKED!!     version %lu, build %lu\n", context.version, context.build));				video_opt->skipNCP = TRUE;			}			else {				RMDBGLOG((ENABLE, "NOT PACKED!! version %lu, build %lu\n", context.version, context.build));				video_opt->skipNCP = FALSE;			}		}		{			struct RM_Detection_Specific_Info specificInfo;			err = RMFGetSystemSpecificInfo(detector, RM_SYSTEM_AVI, &specificInfo);			if (err != RM_OK) {				RMDBGLOG((ENABLE, "error getting specific information!\n"));				ERROR_CLEANUP(-1);			}			stream_info->video_type = specificInfo.data.avi.videoType;			if ((stream_info->video_type == RM_VIDEO_H264) ||			    (stream_info->video_type == RM_VIDEO_MPEG4) ||			    (stream_info->video_type == RM_VIDEO_XVID) ||			    (stream_info->video_type == RM_VIDEO_VC1)) {				RMDBGLOG((ENABLE, "dont send mpeg4/h264/vc1 pts\n"));				play_opt->dontSendMPEG4pts = TRUE;			}			if(VideoFormatToCodec(stream_info->video_type, video_opt, detect_opt)){				RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_AVI (%ld)\n", type));				stream_info->system_type = RM_SYSTEM_AVI;			}			else{				RMDBGLOG((ENABLE, "Found SYSTEM_AVI, but the video codec is unsupported\n"));			}			break;		}		break;	case DETECTOR_SYSTEM_ASF: /* -9 */		fprintf(stderr, "asf\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_ASF (%ld)\n", type));		stream_info->system_type = RM_SYSTEM_ASF;		break;	case DETECTOR_PICTURE_JPEG:		fprintf(stderr, "jpg\n");		app_params->osd_scaler = 2;		RMDBGLOG((LOCALDBG, "Picture (%ld)\n", type));		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		stream_info->video_type = RM_VIDEO_JPEG;		VideoFormatToCodec(stream_info->video_type, video_opt, detect_opt);		{			RMuint32 width = 0;			RMuint32 height = 0;			enum PictureOrientation orientation = 0;			RMuint32 profile = EMhwlib_JPEG_Invalid_Profile;			err = detect_jpeg_header_info(file, &width, &height, &profile, &orientation);			if(RMFAILED(err)){ 				RMDBGLOG((ENABLE, "Picture detect_jpeg_header_info failed, use default jpeg parameters\n"));			}			// if not changed by the detect functions, give them some default value			if( profile == EMhwlib_JPEG_Invalid_Profile ) {				RMDBGLOG((ENABLE, "Invalid jpeg profile 0x%lx\n", profile ));			}			video_opt->vcodec_profile = profile;			if( profile == EMhwlib_JPEG_444_Profile ) {				video_opt->vcodec_profile = EMhwlib_JPEG_Invalid_Profile;				RMDBGLOG((ENABLE, "Not supporting jpeg 444 profile, set to invalid 0x%lx\n", video_opt->vcodec_profile ));			}			if( orientation == 0 )				video_opt->vcodec_orientation = 1; //no rotation			else				video_opt->vcodec_orientation = (RMuint32)orientation;			if( height == 0 )				video_opt->vcodec_max_height = 2448;			else				video_opt->vcodec_max_height = height;  // use the dimension stored in jpeg header			if( width == 0 )				video_opt->vcodec_max_width = 3264;			else				video_opt->vcodec_max_width = width;			video_opt->vcodec_extra_pictures = -2;  // not to allocate the extra picture buffer for jpeg			RMDBGLOG((LOCALDBG, "Picture W %d H %d Profile %d Orientation %d\n", video_opt->vcodec_max_width, video_opt->vcodec_max_height, video_opt->vcodec_profile, video_opt->vcodec_orientation ));		}		break;	case DETECTOR_PICTURE_BMP:		fprintf(stderr, "bmp\n");		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		app_params->osd_scaler = 0;		RMDBGLOG((LOCALDBG, "Picture (%ld)\n", type));		stream_info->video_type = RM_VIDEO_BMP;		break;	case DETECTOR_PICTURE_TIFF:		fprintf(stderr, "tiff\n");		stream_info->video_type = RM_VIDEO_TIFF;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		app_params->osd_scaler = 0;		RMDBGLOG((LOCALDBG, "Picture (%ld)\n", type));		break;	case DETECTOR_PICTURE_GIF:		fprintf(stderr, "gif\n");		stream_info->video_type = RM_VIDEO_GIF;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		app_params->osd_scaler = 0;		RMDBGLOG((LOCALDBG, "Picture (%ld)\n", type));		break;	case DETECTOR_PICTURE_PNG:		fprintf(stderr, "png\n");		stream_info->video_type = RM_VIDEO_PNG;		stream_info->system_type = RM_SYSTEM_ELEMENTARY_VIDEO;		app_params->osd_scaler = 0;		RMDBGLOG((LOCALDBG, "Picture (%ld)\n", type));		break;	case DETECTOR_SYSTEM_MP4:		fprintf(stderr, "mp4\n");		RMDBGLOG((LOCALDBG, "DETECTOR_SYSTEM_MP4 (%ld)\n", type));		stream_info->system_type = RM_SYSTEM_MPEG4;		break;	case DETECTOR_SYSTEM_RIFFCDXA:		fprintf(stderr, "riff/cdxa, format not supported\n");		break; 	case DETECTOR_TYPE_UNKNOWN:	default:		fprintf(stderr, "unknown type!\n");		RMDBGLOG((LOCALDBG, "unknown type!\n"));		break;	}		if((stream_info->system_type == RM_SYSTEM_MPEG1) ||	   (stream_info->system_type == RM_SYSTEM_MPEG2_PROGRAM) ||	   (stream_info->system_type == RM_SYSTEM_MPEG2_TRANSPORT_192) ||	   (stream_info->system_type == RM_SYSTEM_MPEG2_TRANSPORT) ||	   (stream_info->system_type == RM_SYSTEM_MPEG2_PROGRAM) ||	   (stream_info->system_type == RM_SYSTEM_MPEG2_DVD)){		RMint32 index;		RMuint32 i, numStreams, count, streamType;		RMuint16 pid;		RMuint8 buf[512], subId;		RMbool got_audio = FALSE, got_video = FALSE;		ExternalRMvdemux demux;		struct detection_callback_info detection_info = { 0, };		/* takes only the first audio and the first video */		demux_opt->video_pid = 0;		demux_opt->audio_pid = 0;		demux_opt->audio_subid = 0;		demux_opt->spu_subid = 0;		demux_opt->data_type = 0;		demux_opt->xfer_count = 0; /* let the application set this */		demux_opt->fifo_size = 0;  /* let the application set this */				if (demux_opt->system_type != RM_SYSTEM_UNKNOWN) {			err = RMCreateVdemux(&demux);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot create demux %d\n", err));				ERROR_CLEANUP(-1);			}			RMvdemuxSetType(demux, demux_opt->system_type);		}		RMvdemuxReset(demux);		RMvdemuxSetVideoStream(demux, 0, 0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -