📄 rmasfdemux.cpp
字号:
RMDBGLOG((ENABLE, ">>> File is NOT Seekable! disabling IFrame and seek modes!\n")); pmodule->m_isFileSeekable = FALSE; } RMDBGLOG((CALLBACKHOOKDBG, "filepropCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_filepropcb) pmodule->m_filepropcb(pmodule->m_context, File_Size, Creation_Date, Data_Packets_Count, Play_Duration, Send_Duration, Preroll, Minimum_Data_Packet_Size, Maximum_Data_Packet_Size, Maximum_Bitrate, Broadcast, Seekable); } void RMasfdemux::videopropLOCALcb(void *context, RMuint8 Stream_Number, // 1..127 RMuint32 Compression_ID, // See MSDN Library RMuint32 Image_Width, // pixels RMuint32 Image_Height, // pixels RMuint8 *Codec_Specific_Data, RMuint32 Partial_Codec_Specific_Data_Size, RMuint32 Codec_Specific_Data_Size) // bytes{ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "videopropcb %s\n", (pmodule->m_activeCallbacks & VIDEO_PROP_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & VIDEO_PROP_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "videopropCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_videostreampropcb) { pmodule->m_videoStreamFound = TRUE; pmodule->m_videostreampropcb(pmodule->m_context, Stream_Number, Compression_ID, Image_Width, Image_Height, Codec_Specific_Data, Partial_Codec_Specific_Data_Size, Codec_Specific_Data_Size); } }void RMasfdemux::drmLOCALcb(void *context, RMuint8 *Secret_Data, RMuint32 Partial_Secret_Data_Length, RMuint32 Secret_Data_Length, RMuint8 *Key_ID, // ASCII char RMuint32 Partial_Key_ID_Length, RMuint32 Key_ID_Length, RMuint8 *License_URL, // ASCII char RMuint32 Partial_License_URL_Length, RMuint32 License_URL_Length){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "drmcb %s\n", (pmodule->m_activeCallbacks & DRM_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & DRM_CB)) return;#if 0 if (pmodule->m_drmError != 0) return;#endif // use application's callback if it was registered, else, use local functions if (pmodule->m_drmcb != drmLOCALcb) { RMDBGLOG((CALLBACKHOOKDBG, "drmCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_drmcb) pmodule->m_drmcb(pmodule->m_context, Secret_Data, Partial_Secret_Data_Length, Secret_Data_Length, Key_ID, Partial_Key_ID_Length, Key_ID_Length, License_URL, Partial_License_URL_Length, License_URL_Length); return; } if (Key_ID) RMDBGLOG((ENABLE, "KeyID: '%s' partial_len=%lu len=%lu\n", Key_ID, Partial_Key_ID_Length, Key_ID_Length)); if (License_URL) RMDBGLOG((ENABLE, "License URL: '%s' partial_len=%lu len=%lu\n", License_URL, Partial_License_URL_Length, License_URL_Length)); // we don't know how to handle this, skip it return;}void RMasfdemux::languagelistLOCALcb(void *context, RMuint16 Language_ID_Records_Count, RMuint16 Language_ID_Records_Index, RMuint8 *Language_ID, RMuint8 Partial_Language_ID_Length, RMuint8 Language_ID_Length){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "languagelistcb %s\n", (pmodule->m_activeCallbacks & LANG_LIST_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & LANG_LIST_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "languageCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_languagecb) pmodule->m_languagecb(pmodule->m_context, Language_ID_Records_Count, Language_ID_Records_Index, Language_ID, Partial_Language_ID_Length, Language_ID_Length);} void RMasfdemux::extpropLOCALcb( void *context, RMuint16 Stream_Number, RMuint16 Stream_Language_ID_Index, RMuint16 Stream_Name_Count, RMuint16 Stream_Name_Count_Index, RMuint16 Language_ID_Index, // for the string of the language name RMuint8 *Stream_Name, RMuint16 Partial_Stream_Name_Length, RMuint16 Stream_Name_Length, RMuint16 Payload_Extension_System_Count, RMuint16 Payload_Extension_System_ID){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "extpropcb %s\n", (pmodule->m_activeCallbacks & EXT_PROP_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & EXT_PROP_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "extpropCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_extstreampropcb) pmodule->m_extstreampropcb(pmodule->m_context, Stream_Number, Stream_Language_ID_Index, Stream_Name_Count, Stream_Name_Count_Index, Language_ID_Index, Stream_Name, Partial_Stream_Name_Length, Stream_Name_Length, Payload_Extension_System_Count, Payload_Extension_System_ID);}void RMasfdemux::aspectRatioLOCALcb(void *context, RMuint16 Stream_Num, RMuint32 aspectRatioX, RMuint32 aspectRatioY){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "aspectRatiocb %s\n", (pmodule->m_activeCallbacks & ASPECT_RATIO_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & ASPECT_RATIO_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "aspectratioCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_aspectratiocb) pmodule->m_aspectratiocb(pmodule->m_context, Stream_Num, aspectRatioX, aspectRatioY);}void RMasfdemux::appSpecObjLOCALcb (void *context, RMuint8 GUID[16], RMuint8 *Name, RMuint8 *Data, RMuint64 Partial_Size, // bytes RMuint64 Size) // bytes{ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "appSpecObjcb %s\n", (pmodule->m_activeCallbacks & APP_SPEC_OBJ_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & APP_SPEC_OBJ_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "appSpecObjCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_appspecobjcb) pmodule->m_appspecobjcb(pmodule->m_context, GUID, Name, Data, Partial_Size, Size);}void RMasfdemux::streamBitratePropLOCALcb(void *context, RMuint8 Stream_Number, // 1..127 RMuint32 Average_Bitrate) // bits/s{ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "streamBitratePropcb %s\n", (pmodule->m_activeCallbacks & STREAM_BITRATE_PROP_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & STREAM_BITRATE_PROP_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "streamBitratePropCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_streambitratepropcb) pmodule->m_streambitratepropcb(pmodule->m_context, Stream_Number, Average_Bitrate); }void RMasfdemux::bitrateMutualExclusionLOCALcb(void *context, RMuint32 mutex_index, RMuint16 Stream_Numbers_Count, RMuint8 bitrate_exclusion, // boolean RMuint8 Stream_Number) // 1..127{ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "bitrateMutualExclusioncb %s\n", (pmodule->m_activeCallbacks & BITRATE_MUTEX_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & BITRATE_MUTEX_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "bitrateMutualExclusionCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_bitratemutexcb) pmodule->m_bitratemutexcb(pmodule->m_context, mutex_index, Stream_Numbers_Count, bitrate_exclusion, Stream_Number);}void RMasfdemux::extContentEncryptionLOCALcb(void *context, RMuint8 *Data, RMuint32 Partial_Data_Size, RMuint32 Data_Size){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "extContentEncryptioncb %s\n", (pmodule->m_activeCallbacks & EXT_DRM_CB) ? "enabled":"disabled")); // reset the flag pmodule->m_DRMPreventsPlayback = FALSE;#if (EM86XX_MODE == EM86XX_MODEID_STANDALONE) WMDRM_OPL opl; if (!(pmodule->m_activeCallbacks & EXT_DRM_CB)) return; if (pmodule->m_drmError != 0) return; // use application's callback if it was registered, else, use local functions if (pmodule->m_extdrmcb != extContentEncryptionLOCALcb) { if (pmodule->m_extdrmcb) pmodule->m_extdrmcb(pmodule->m_context, Data, Partial_Data_Size, Data_Size); return; } // If DRM header has already been processed, simply return if (pmodule->m_encryptedContent == TRUE) return; // This is encrypted content pmodule->m_encryptedContent = TRUE; RMDBGLOG((ENABLE, "************ Encrypted CONTENT, init DRM...\n")); // Initialize Windows Media Digital Rights Management if (RMFAILED(pmodule->m_drmError = WMDRM_init())) { RMDBGLOG((ENABLE, "DRM failed to initialize with error code 0x%lx\n", pmodule->m_drmError)); return; } // Process the DRM header if ((Data_Size > 4) && (Data[0] != 0x3c) && (Data[2] == 0x3c) && (Data[Data_Size - 4] == 0x3e) && (Data[Data_Size - 2] != 0x3e)) { if ((pmodule->m_drmError = WMDRM_process_header(Data + 2, Data_Size - 4, &opl)) != 0) { RMDBGLOG((ENABLE, "Unable to process the DRM header with error code 0x%lx\n", pmodule->m_drmError)); return; } // Report Output Protection Levels if ((opl.AnalogVideo > 100) || (opl.CompressedDigitalVideo > 100) || (opl.UncompressedDigitalVideo > 100) || (opl.CompressedDigitalAudio > 100) || (opl.UncompressedDigitalAudio > 100) || (opl.AutomaticGainControlColorStripe > 0)) { RMuint32 opl_bitfield = 0; opl_bitfield |= OPL_ENCODE_ANALOG_VIDEO(opl.AnalogVideo); opl_bitfield |= OPL_ENCODE_COMPRESSED_DIGITAL_VIDEO(opl.CompressedDigitalVideo); opl_bitfield |= OPL_ENCODE_UNCOMPRESSED_DIGITAL_VIDEO(opl.UncompressedDigitalVideo); opl_bitfield |= OPL_ENCODE_COMPRESSED_DIGITAL_AUDIO(opl.CompressedDigitalAudio); opl_bitfield |= OPL_ENCODE_UNCOMPRESSED_DIGITAL_AUDIO(opl.UncompressedDigitalAudio); opl_bitfield |= OPL_ENCODE_AUTOMATIC_GAIN_CONTROL_COLOR_STRIPE(opl.AutomaticGainControlColorStripe); } } else { pmodule->m_drmError = SDRM_E_DRM_HEADER_NOT_ALIGNED; RMDBGLOG((ENABLE, "DRM header not aligned\n")); }#else if (!(pmodule->m_activeCallbacks & EXT_DRM_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((ENABLE, "************ DRMcallback called when in withhost mode!\n")); RMDBGLOG((ENABLE, " make sure the file is not 'DRM' protected!!!\n"));#endif}void RMasfdemux::payloadExtensionLOCALcb(void *context, RMuint16 Stream_Number, RMuint32 Media_Object_Number, RMuint8 Media_Object_Number_valid, RMuint16 Payload_Extension_System_ID, RMuint8 *Payload_Extension_System_Data, RMuint16 Partial_Payload_Extension_System_Data_Size, RMuint16 Payload_Extension_System_Data_Size, RMuint16 bytes_left){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "payloadExtensioncb %s\n", (pmodule->m_activeCallbacks & PAYLOAD_EXT_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & PAYLOAD_EXT_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "payloadExtensionCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_payloadextcb) pmodule->m_payloadextcb(pmodule->m_context, Stream_Number, Media_Object_Number, Media_Object_Number_valid, Payload_Extension_System_ID, Payload_Extension_System_Data, Partial_Payload_Extension_System_Data_Size, Payload_Extension_System_Data_Size, bytes_left);}void RMasfdemux::digitalSignatureLOCALcb(void *context, RMuint8 *Signature_Data, RMuint32 Partial_Signature_Data_Length, RMuint32 Signature_Data_Length){ RMasfdemux *pmodule = (RMasfdemux *)context; RMDBGLOG((CALLBACKDBG, "digitalSignaturecb %s\n", (pmodule->m_activeCallbacks & DIGITAL_SIGNATURE_CB) ? "enabled":"disabled")); if (!(pmodule->m_activeCallbacks & DIGITAL_SIGNATURE_CB)) return; if (pmodule->m_drmError != 0) return; RMDBGLOG((CALLBACKHOOKDBG, "digitalSignatureCB called with context 0x%08X, using application's context %08X\n", context, pmodule->m_context)); if (pmodule->m_signaturecb) pmodule->m_signaturecb(pmodule->m_context, Signature_Data, Partial_Signature_Data_Length, Signature_Data_Length); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -