?? play_asf.c
字號:
if (pSendContext->Video_Codec_Specific_Data_Received == Codec_Specific_Data_Size) { pSendContext->video_stream_index = Stream_Number; pSendContext->Compression_ID = Compression_ID; RMDBGLOG((ENABLE, " Image Width = %lu, Image Height = %lu, Codec = ", Image_Width, Image_Height));#ifdef _DEBUG for(i = 0; i < 4; i++) fprintf(stderr, "%c", (char)(Compression_ID >> (i * 8)) & 255); fprintf(stderr, " (0x"); for(i = 0; i < 4; i++) fprintf(stderr, "%02x", (char)(Compression_ID >> (i * 8)) & 255); fprintf(stderr, ")\n");#endif if(Compression_ID == 0x33564D57) { // WMV3 int bit_select; /* when used in mono, use codec auto detection */#ifdef WITH_MONO if ((Image_Width <= 720) && (Image_Height <= 576)) { pSendContext->video_opt->Codec = VideoDecoder_Codec_WMV_SD; pSendContext->video_opt->MPEGProfile = Profile_WMV_SD; RMDBGLOG((ENABLE, "MONO: Selecting wmv9 SD\n")); } else if ((Image_Width <= 1440) && (Image_Height <= 816)) { pSendContext->video_opt->Codec = VideoDecoder_Codec_WMV_816P; pSendContext->video_opt->MPEGProfile = Profile_WMV_816P; RMDBGLOG((ENABLE, "MONO: Selecting wmv9 816P\n")); } else if ((Image_Width <= 1920) && (Image_Height <= 1088)) { pSendContext->video_opt->Codec = VideoDecoder_Codec_WMV_HD; pSendContext->video_opt->MPEGProfile = Profile_WMV_HD; RMDBGLOG((ENABLE, "MONO: Selecting wmv9 HD\n")); } else { RMDBGLOG((ENABLE, "MONO: Unsupported wmv9 video size %lu %lu\n", Image_Width, Image_Height)); }#endif // WITH_MONO bit_select = (Codec_Specific_Data[0] >> 6) & 3; switch (bit_select) { case 0: RMDBGLOG((ENABLE, " Simple Profile\n")); break; // Supported case 1: RMDBGLOG((ENABLE, " Main Profile\n")); break; // Supported case 2: { // Not supported RMDBGLOG((ENABLE, " Complex Profile\n")); fprintf(stderr, " Complex Profile is not supported by this hardware! \n"); pSendContext->unsupported_video = TRUE; return; } case 3: RMDBGLOG((ENABLE, " Error in PROFILE\n")); break; } bit_select = (Codec_Specific_Data[0] >> 5) & 1; if (bit_select) { RMDBGLOG((ENABLE, " Interlaced mode\n")); fprintf(stderr, ">>> WARNING: this stream is marked as interlaced and it's not supported by the hardware, playback might fail\n"); } else RMDBGLOG((ENABLE, " Progressive mode\n")); bit_select = (Codec_Specific_Data[0] >> 4) & 1; if(bit_select) { RMDBGLOG((ENABLE, " Sprite mode on\n")); // Not supported fprintf(stderr, " Sprite mode is not supported by this hardware! \n"); pSendContext->unsupported_video = TRUE; return; } else RMDBGLOG((ENABLE, " Sprite mode off\n")); bit_select = (Codec_Specific_Data[0] >> 1) & 7; RMDBGLOG((ENABLE, " Framerate is %0d fps\n", bit_select * 4 + 2)); bit_select = (((Codec_Specific_Data[0] >> 0) & 1) << 4) + ((Codec_Specific_Data[1] >> 4) & 15); if(bit_select == 31) // All supported RMDBGLOG((ENABLE, " Bitrate is > 4064 kbps\n")); else RMDBGLOG((ENABLE, " Bitrate is %0d kbps\n", bit_select * 64 + 32)); bit_select = (Codec_Specific_Data[1] >> 3) & 1; if(bit_select) {// All supported RMDBGLOG((ENABLE, " Loop filter on\n")); // Supported bit_select = (Codec_Specific_Data[0] >> 6) & 3; if(bit_select == 0) RMDBGLOG((ENABLE, "Loop filter incompatible with simple profile\n")); } else RMDBGLOG((ENABLE, " Loop filter off\n")); bit_select = (Codec_Specific_Data[1] >> 2) & 1; if(bit_select) { // Simple and main, should be 0 RMDBGLOG((ENABLE, " XINTRA8 on\n")); // Not supported fprintf(stderr, " XINTRA8 ON is only valid with complex profile and is not supported by this hardware! \n"); pSendContext->unsupported_video = TRUE; return; bit_select = (Codec_Specific_Data[0] >> 6) & 3; if(bit_select != 2) RMDBGLOG((ENABLE, "XINTRA8 only present in complex profile\n")); } else RMDBGLOG((ENABLE, " XINTRA8 off\n")); bit_select = (Codec_Specific_Data[1] >> 1) & 1; if(bit_select) { // All supported RMDBGLOG((ENABLE, " Multiresolution on\n")); bit_select = (Codec_Specific_Data[0] >> 6) & 3; if(bit_select == 0) RMDBGLOG((ENABLE, "Multiresolution incompatible with simple profile\n")); } else RMDBGLOG((ENABLE, " Multiresolution off\n")); bit_select = (Codec_Specific_Data[1] >> 0) & 1; if(bit_select) // Simple and main should be 1 RMDBGLOG((ENABLE, " Fast Transform on\n")); else { RMDBGLOG((ENABLE, " Fast Transform off\n")); // Not supported fprintf(stderr, " Fast transform OFF is only valid with complex profile and is not supported by this hardware! \n"); pSendContext->unsupported_video = TRUE; return; if(bit_select != 2) RMDBGLOG((ENABLE, " IDCT is present\n")); } bit_select = (Codec_Specific_Data[2] >> 7) & 1; if(bit_select) // All supported RMDBGLOG((ENABLE, " Fast UVMC on\n")); else RMDBGLOG((ENABLE, " Fast UVMC off\n")); bit_select = (Codec_Specific_Data[2] >> 6) & 1; if(bit_select) { RMDBGLOG((ENABLE, " Broadcast ON\n")); } else RMDBGLOG((ENABLE, " Broadcast off\n")); bit_select = (Codec_Specific_Data[2] >> 4) & 3; switch(bit_select) { // All supported case 0: RMDBGLOG((ENABLE, " Frame quantization step size\n")); break; case 1: { RMDBGLOG((ENABLE, " Macroblock quantization step size\n")); bit_select = (Codec_Specific_Data[0] >> 6) & 3; if(bit_select == 0) RMDBGLOG((ENABLE, "DQUANT incompatible with simple profile\n")); break; } case 2: { RMDBGLOG((ENABLE, " Boundary alternate quantization\n")); bit_select = (Codec_Specific_Data[0] >> 6) & 3; if(bit_select == 0) RMDBGLOG((ENABLE, "DQUANT incompatible with simple profile\n")); break; } case 3: RMDBGLOG((ENABLE, "Error in DQUANT\n")); break; } bit_select = (Codec_Specific_Data[2] >> 3) & 1; if(bit_select) RMDBGLOG((ENABLE, " Variable size transform on\n")); // Supported else RMDBGLOG((ENABLE, " Variable size transform off\n")); bit_select = (Codec_Specific_Data[2] >> 2) & 1; if(bit_select) RMDBGLOG((ENABLE, " Transform table switching on\n")); // Supported else RMDBGLOG((ENABLE, " Transform table switching off\n")); bit_select = (Codec_Specific_Data[2] >> 1) & 1; if(bit_select) RMDBGLOG((ENABLE, " Overlap filter on\n")); // Supported else RMDBGLOG((ENABLE, " Overlap filter off\n")); bit_select = (Codec_Specific_Data[2] >> 0) & 1; if(bit_select) { RMDBGLOG((ENABLE, " Startcodes present\n")); // Not supported by microcode if 1 - Could be written RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); RMDBGLOG((ENABLE, " Start code present not be supported yet! \n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); } else RMDBGLOG((ENABLE, " No startcodes\n")); bit_select = (Codec_Specific_Data[3] >> 7) & 1; if(bit_select) RMDBGLOG((ENABLE, " Preprocessing on\n")); // Supported else RMDBGLOG((ENABLE, " Preprocessing off\n")); bit_select = (Codec_Specific_Data[3] >> 4) & 7; // Supported if(bit_select) RMDBGLOG((ENABLE, " %d consecutive B-frames\n", bit_select)); else RMDBGLOG((ENABLE, " No B-frames\n")); bit_select = (Codec_Specific_Data[3] >> 2) & 3; switch(bit_select) { // All supported case 0: RMDBGLOG((ENABLE, " Quantizer implicitly specified at frame level\n")); break; case 1: RMDBGLOG((ENABLE, " Quantizer explicitly specified at frame level\n")); break; case 2: RMDBGLOG((ENABLE, " 5QP deadzone quantizer user for all frames\n")); break; case 3: RMDBGLOG((ENABLE, " 3QP deadzone quantizer user for all frames\n")); break; } bit_select = (Codec_Specific_Data[3] >> 1) & 1; if(bit_select) { // Not in spec... Usefull? (Frederic) RMDBGLOG((ENABLE, " Frame interpolation on\n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); RMDBGLOG((ENABLE, " Frame interpolation may not be supported! \n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); RMDBGLOG((ENABLE, " ***************** WARNING ************************\n")); } else RMDBGLOG((ENABLE, " Frame interpolation off\n")); bit_select = (Codec_Specific_Data[3] >> 0) & 1; if(bit_select) RMDBGLOG((ENABLE, " Release encoder used\n")); else { RMDBGLOG((ENABLE, " Beta encoder used\n")); // Not supported fprintf(stderr, " This file has been created by a WMV9 BETA encoder! \n"); fprintf(stderr, " This file is not supported due to changes that\n"); fprintf(stderr, " may have occured between this BETA version and the\n"); fprintf(stderr, " final version off Microsoft WMV9 encoder.\n"); pSendContext->unsupported_video = TRUE; return; } } else if(Compression_ID == 0x3334504D) { // MP43 pSendContext->video_stream_index = Stream_Number; pSendContext->divx3_prop.Image_Width = (RMuint16) Image_Width; pSendContext->divx3_prop.Image_Height = (RMuint16) Image_Height; /* when used in mono, use codec auto detection */#ifdef WITH_MONO if ((Image_Width <= 720) && (Image_Height <= 576)) { pSendContext->video_opt->Codec = VideoDecoder_Codec_DIVX3_SD; pSendContext->video_opt->MPEGProfile = Profile_DIVX3_SD; RMDBGLOG((ENABLE, "MONO: Selecting divx3 SD\n")); } else if ((Image_Width <= 1920) && (Image_Height <= 1088)) { pSendContext->video_opt->Codec = VideoDecoder_Codec_DIVX3_HD; pSendContext->video_opt->MPEGProfile = Profile_DIVX3_HD; RMDBGLOG((ENABLE, "MONO: Selecting divx3 HD\n")); } else { pSendContext->unsupported_video = TRUE; RMDBGLOG((ENABLE, "MONO: Unsupported divx3 video size %lu %lu\n", Image_Width, Image_Height)); }#endif // WITH_MONO RMDBGLOG((ENABLE, " Found old WMV format (DivX3.11): %d x %d\n", (int) pSendContext->divx3_prop.Image_Width, (int) pSendContext->divx3_prop.Image_Height)); } else if ((Compression_ID == 0x41564D57) //WMVA - Windows Media Video 9 Advanced Profile || (Compression_ID == 0x31435657) // WVC1 ) { RMuint8 *pByte; int index; RMDBGLOG((ENABLE, ">> VC1 Advanced Profile\n")); if (Codec_Specific_Data[0] & (1<<5)) RMDBGLOG((ENABLE, ">> progressive sequence\n")); if (Codec_Specific_Data[0] & (1<<4)) RMDBGLOG((ENABLE, ">> single sequence header\n")); if (Codec_Specific_Data[0] & (1<<3)) RMDBGLOG((ENABLE, ">> single entry point header\n")); if (Codec_Specific_Data[0] & (1<<2)) RMDBGLOG((ENABLE, ">> single slice pictures\n")); if (Codec_Specific_Data[0] & (1<<1)) RMDBGLOG((ENABLE, ">> no B frames\n")); pSendContext->seqHeader = (RMuint8 *)RMMalloc((Partial_Codec_Specific_Data_Size - 1) * sizeof(RMuint8)); pSendContext->seqHeaderSize = (Partial_Codec_Specific_Data_Size - 1);#ifdef _DEBUG fprintf(stderr, "VC1 seqHeader size %lu, seqHeader:\n", pSendContext->seqHeaderSize);#endif for(index = 1; index < (int)Partial_Codec_Specific_Data_Size; index++) { pByte = (Codec_Specific_Data + index);#ifdef _DEBUG fprintf(stderr, "0x%02X ", *pByte);#endif *(pSendContext->seqHeader + index - 1) = *pByte; }#ifdef _DEBUG fprintf(stderr, "\n");#endif parseVC1SeqHeader(pSendContext, pSendContext->seqHeader, pSendContext->seqHeaderSize); pSendContext->video_vop_tir = 90000; DCCSTCSetTimeResolution(pSendContext->dcc_info->pStcSource, DCC_Video, pSendContext->video_vop_tir); pSendContext->isVC1 = TRUE; pSendContext->getStartCodeBuffer = TRUE; pSendContext->addSeqHeader = TRUE; pSendContext->addEntryHeader = TRUE; pSendContext->addFrameHeader = TRUE; /* when used in mono, use codec auto detection */#ifdef WITH_MONO pSendContext->video_opt->Codec = VideoDecoder_Codec_VC1_HD; pSendContext->video_opt->MPEGProfile = Profile_VC1_HD; RMDBGLOG((ENABLE, "MONO: Selecting VC1 HD\n"));#endif // WITH_MONO } else pSendContext->unsupported_video = TRUE; if (pSendContext->unsupported_video) { pSendContext->SendVideoData = FALSE; RMDBGLOG((ENABLE, ">> unsupported video codec, disabling video\n")); return; } } if ((Codec_Specific_Data_Size >= sizeof(RMuint32)) && (Compression_ID != 0x41564D57) && (Compression_ID != 0x31435657)) { // only for non VC1 codec // hack! communicate this properly... (inband?) RMDBGLOG((ENABLE, " Sequence header 0x%lx\n", RMbeBufToUint32(Codec_Specific_Data))); pSendContext->wmv9_prop.Sequence = RMbeBufToUint32(Codec_Specific_Data); pSendContext->wmv9_prop.Image_Width = Image_Width; pSendContext->wmv9_prop.Image_Height = Image_Height; pSendContext->wmv9_prop.MB_Width = (Image_Width + 15) / 16; pSendContext->wmv9_prop.MB_Height = (Image_Height + 15) / 16; } status = setup_video_decoder(pSendContext); pSendContext->videoSetupStatus = status; if (RMFAILED(status)){ fprintf(stderr, "Error initializing video (%s)\n", RMstatusToString(status)); } else { RMDBGLOG((ENABLE, ">>> video stream found, enabling video playback\n")); pSendContext->VideoStreamFound = TRUE; if (pSendContext->linear_playback) /* Seek is not supported, do play now */ Play(pSendContext, RM_DEVICES_VIDEO | RM_DEVICES_STC, DCCVideoPlayFwd); }}static RMstatus initVideoDecoder(struct asf_context * context){ if(context->video_decoder_initialized == FALSE) { RMstatus err = RM_ERROR; RMDBGLOG((ENABLE, "initVideoDecoder\n")); switch(context->Compression_ID) { case 0x3334504D: // MP43 err = RUASetProperty(context->pRUA, context->dcc_info->video_decoder, RMVideoDecoderPropertyID_DIVX3VSProp, &context->divx3_prop, sizeof(context->divx3_prop), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE,"Error setting DIVX3 video info : %d !\n", err)); return err; } break; case 0x33564D57: //WMV3 RMDBGLOG((ENABLE, "video prop : seq 0x%08lx, %ld x %ld\n", context->wmv9_prop.Sequence, context->wmv9_prop.Image_Width, context->wmv9_prop.Image_Height)); err = RUASetProperty(context->pRUA,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -