├── !GUIDE
├── 0.png
├── 1.png
├── GUIDE.md
├── RTMP
│ └── RTMP.md
└── Segment
│ ├── 0.png
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ └── Segment.md
├── .gitattributes
├── .gitignore
├── CoreCommon
├── CoreCommon.Desktop
│ ├── CoreCommon.Desktop.vcxproj
│ └── CoreCommon.Desktop.vcxproj.filters
├── CoreCommon.Shared
│ ├── AV
│ │ ├── AVDescription.h
│ │ ├── AVDescription_CH_Layout.h
│ │ ├── AutoMediaBuffer.h
│ │ ├── AutoMediaPacket.h
│ │ ├── MediaAVChapter.h
│ │ ├── MediaAVError.h
│ │ ├── MediaAVFormat.h
│ │ ├── MediaAVIO.h
│ │ ├── MediaAVMetadata.h
│ │ ├── MediaAVResource.h
│ │ ├── MediaAVStream.h
│ │ ├── MediaCodecType.h
│ │ ├── MediaMemory.cpp
│ │ ├── MediaMemory.h
│ │ ├── MediaPacket.cpp
│ │ └── MediaPacket.h
│ ├── CoreCommon.Shared.vcxitems
│ ├── CoreCommon.Shared.vcxitems.filters
│ ├── Description
│ │ ├── AAC
│ │ │ ├── AACAudioDescription.cpp
│ │ │ ├── AACAudioDescription.h
│ │ │ ├── AAC_ADTS_Parser.cpp
│ │ │ ├── AAC_ADTS_Parser.h
│ │ │ ├── AAC_LATM_Parser.cpp
│ │ │ └── AAC_LATM_Parser.h
│ │ ├── AC3
│ │ │ ├── A52_Parser.cpp
│ │ │ ├── A52_Parser.h
│ │ │ ├── AC3AudioDescription.cpp
│ │ │ └── AC3AudioDescription.h
│ │ ├── ALAC
│ │ │ ├── ALACAudioDescription.cpp
│ │ │ ├── ALACAudioDescription.h
│ │ │ ├── ALACMagicCodeParser.cpp
│ │ │ └── ALACMagicCodeParser.h
│ │ ├── CommonAudioDescription.cpp
│ │ ├── CommonAudioDescription.h
│ │ ├── CommonVideoDescription.cpp
│ │ ├── CommonVideoDescription.h
│ │ ├── FLAC
│ │ │ ├── FLACAudioDescription.cpp
│ │ │ ├── FLACAudioDescription.h
│ │ │ ├── FLACStreamInfoParser.cpp
│ │ │ └── FLACStreamInfoParser.h
│ │ ├── H264
│ │ │ ├── AVC1VideoDescription.cpp
│ │ │ ├── AVC1VideoDescription.h
│ │ │ ├── X264VideoDescription.cpp
│ │ │ └── X264VideoDescription.h
│ │ ├── LPCM
│ │ │ ├── BDAudioDescription.cpp
│ │ │ ├── BDAudioDescription.h
│ │ │ ├── BD_LPCM_Parser.cpp
│ │ │ └── BD_LPCM_Parser.h
│ │ ├── MP3
│ │ │ ├── MPEGAudioDescription.cpp
│ │ │ ├── MPEGAudioDescription.h
│ │ │ ├── MPEG_Audio_Parser.cpp
│ │ │ └── MPEG_Audio_Parser.h
│ │ ├── MPEG2
│ │ │ ├── MPEG2VideoDescription.cpp
│ │ │ └── MPEG2VideoDescription.h
│ │ ├── MPEG4
│ │ │ ├── MPEG4VideoDescription.cpp
│ │ │ └── MPEG4VideoDescription.h
│ │ ├── OGG
│ │ │ ├── VorbisAudioDescription.cpp
│ │ │ └── VorbisAudioDescription.h
│ │ └── VC1
│ │ │ ├── VC1VideoDescription.cpp
│ │ │ └── VC1VideoDescription.h
│ ├── Memory
│ │ ├── ComDynamicMemoryBuffer.cpp
│ │ ├── ComDynamicMemoryBuffer.h
│ │ ├── CrtDynamicMemoryBuffer.cpp
│ │ ├── CrtDynamicMemoryBuffer.h
│ │ ├── DynamicMemoryBuffer.h
│ │ └── shared_memory_ptr.h
│ └── Utils
│ │ ├── APEv2TagEx.cpp
│ │ ├── APEv2TagEx.h
│ │ ├── AVC1mp4ToAnnexB.cpp
│ │ ├── AVIOWin32.h
│ │ ├── ESPacketCutter.cpp
│ │ ├── ESPacketCutter.h
│ │ ├── H264AnnexBParser.cpp
│ │ ├── H264AnnexBParser.h
│ │ ├── H264Spec.h
│ │ ├── H264_Misc.cpp
│ │ ├── H264_SPS_Parser.cpp
│ │ ├── H264_SPS_Parser.h
│ │ ├── HEVCAnnexBParser.cpp
│ │ ├── HEVCAnnexBParser.h
│ │ ├── HEVCSpec.h
│ │ ├── HVC1mkvToAnnexB.cpp
│ │ ├── HVC1mkvToAnnexB.h
│ │ ├── IOReader
│ │ ├── IOPoolReader.cpp
│ │ └── IOPoolReader.h
│ │ ├── IOWriter
│ │ ├── IOPoolWriter.cpp
│ │ └── IOPoolWriter.h
│ │ ├── MPC
│ │ ├── Bitstream.cpp
│ │ ├── Bitstream.h
│ │ ├── GolombBuffer.cpp
│ │ ├── GolombBuffer.h
│ │ ├── H264Nalu.cpp
│ │ └── H264Nalu.h
│ │ ├── MPEG2HeadParser.cpp
│ │ ├── MPEG2HeadParser.h
│ │ ├── MPEG4HeadParser.cpp
│ │ ├── MPEG4HeadParser.h
│ │ ├── MiscUtils.cpp
│ │ ├── MiscUtils.h
│ │ ├── SimpleContainers
│ │ ├── Buffer.cpp
│ │ ├── Buffer.h
│ │ ├── List.h
│ │ └── Queue.h
│ │ ├── VC1HeadParser.cpp
│ │ ├── VC1HeadParser.h
│ │ ├── ffmpeg
│ │ ├── LavByteParser.cpp
│ │ ├── LavByteParser.h
│ │ ├── avcodec_get_bits.h
│ │ ├── avcodec_golomb.h
│ │ └── avcodec_put_bits.h
│ │ ├── gtrutil.c
│ │ └── stagefright
│ │ ├── ABase.h
│ │ ├── ABitReader.cpp
│ │ ├── ABitReader.h
│ │ ├── AString.cpp
│ │ ├── AString.h
│ │ ├── H264Golomb.h
│ │ ├── H264Parser.cpp
│ │ └── H264Parser.h
└── CoreCommon.UWP
│ ├── CoreCommon.UWP.vcxproj
│ └── CoreCommon.UWP.vcxproj.filters
├── CoreDemuxers
├── CoreDemuxers.Desktop
│ ├── CoreDemuxers.Desktop.vcxproj
│ └── CoreDemuxers.Desktop.vcxproj.filters
├── CoreDemuxers.Shared
│ ├── CoreDemuxers.Shared.vcxitems
│ ├── CoreDemuxers.Shared.vcxitems.filters
│ ├── FLV
│ │ ├── FLVDemuxer.cpp
│ │ ├── FLVMediaFormat.cpp
│ │ ├── FLVMediaFormat.h
│ │ ├── FLVMediaFormat_AVIO.cpp
│ │ ├── FLVMediaFormat_MkKeyFrames.cpp
│ │ ├── FLVMediaFormat_MkStreams.cpp
│ │ ├── FLVMediaFormat_Reader.cpp
│ │ ├── FLVMediaStream.cpp
│ │ ├── FLVMediaStream.h
│ │ └── Parser
│ │ │ ├── FLVBoxSpec.h
│ │ │ ├── FLVMetaSpec.h
│ │ │ ├── FLVParser.cpp
│ │ │ ├── FLVParser.h
│ │ │ ├── FLVParserErrSpec.h
│ │ │ ├── FLVParserIO.h
│ │ │ ├── FLVParser_Core.cpp
│ │ │ ├── FLVParser_Misc.cpp
│ │ │ └── FLVSpec.h
│ ├── MKV
│ │ ├── MKVDemuxer.cpp
│ │ ├── MKVMediaFormat.cpp
│ │ ├── MKVMediaFormat.h
│ │ ├── MKVMediaFormat_AVIO.cpp
│ │ ├── MKVMediaFormat_MkStreams.cpp
│ │ ├── MKVMediaFormat_Reader.cpp
│ │ ├── MKVMediaFormat_Tags.cpp
│ │ ├── MKVMediaStream.cpp
│ │ ├── MKVMediaStream.h
│ │ ├── MKVMediaStream_Audio.cpp
│ │ ├── MKVMediaStream_Subtitle.cpp
│ │ ├── MKVMediaStream_Video.cpp
│ │ ├── Parser
│ │ │ ├── Duration
│ │ │ │ ├── AlacCalcEngine.cpp
│ │ │ │ ├── AlacCalcEngine.h
│ │ │ │ ├── DurationCalcInterface.h
│ │ │ │ ├── FlacCalcEngine.cpp
│ │ │ │ ├── FlacCalcEngine.h
│ │ │ │ ├── OpusCalcEngine.cpp
│ │ │ │ ├── OpusCalcEngine.h
│ │ │ │ ├── OpusHelp.cpp
│ │ │ │ ├── OpusHelp.h
│ │ │ │ ├── PcmCalcEngine.cpp
│ │ │ │ ├── PcmCalcEngine.h
│ │ │ │ ├── VorbisCalcEngine.cpp
│ │ │ │ ├── VorbisCalcEngine.h
│ │ │ │ └── vorbis
│ │ │ │ │ ├── codec.h
│ │ │ │ │ ├── ogg.h
│ │ │ │ │ └── os_types.h
│ │ │ ├── Internal
│ │ │ │ ├── MatroskaCodecIds.cpp
│ │ │ │ ├── MatroskaCodecIds.h
│ │ │ │ ├── MatroskaDataSource.h
│ │ │ │ ├── MatroskaEbml.cpp
│ │ │ │ ├── MatroskaEbml.h
│ │ │ │ ├── MatroskaEbmlCore.cpp
│ │ │ │ ├── MatroskaEbmlCore.h
│ │ │ │ ├── MatroskaEbmlDoc.h
│ │ │ │ ├── MatroskaInternal.cpp
│ │ │ │ ├── MatroskaInternal.h
│ │ │ │ ├── MatroskaInternalAttachmentContext.h
│ │ │ │ ├── MatroskaInternalAttachments.cpp
│ │ │ │ ├── MatroskaInternalAttachments.h
│ │ │ │ ├── MatroskaInternalChapterContext.h
│ │ │ │ ├── MatroskaInternalChapters.cpp
│ │ │ │ ├── MatroskaInternalChapters.h
│ │ │ │ ├── MatroskaInternalCluster.cpp
│ │ │ │ ├── MatroskaInternalCluster.h
│ │ │ │ ├── MatroskaInternalCueContext.h
│ │ │ │ ├── MatroskaInternalCues.cpp
│ │ │ │ ├── MatroskaInternalCues.h
│ │ │ │ ├── MatroskaInternalError.h
│ │ │ │ ├── MatroskaInternalSeekHead.cpp
│ │ │ │ ├── MatroskaInternalSeekHead.h
│ │ │ │ ├── MatroskaInternalSeekHeadContext.h
│ │ │ │ ├── MatroskaInternalSegmentInfo.cpp
│ │ │ │ ├── MatroskaInternalSegmentInfo.h
│ │ │ │ ├── MatroskaInternalTagContext.h
│ │ │ │ ├── MatroskaInternalTags.cpp
│ │ │ │ ├── MatroskaInternalTags.h
│ │ │ │ ├── MatroskaInternalTrackContext.h
│ │ │ │ ├── MatroskaInternalTracks.cpp
│ │ │ │ ├── MatroskaInternalTracks.h
│ │ │ │ ├── MatroskaList.h
│ │ │ │ ├── MatroskaMisc.h
│ │ │ │ └── MatroskaSpec.h
│ │ │ ├── MKVParser.cpp
│ │ │ ├── MKVParser.h
│ │ │ ├── MKVParserCore.cpp
│ │ │ ├── MKVParserDataSource.cpp
│ │ │ ├── MKVParserErrSpec.h
│ │ │ ├── MKVParserIO.h
│ │ │ ├── MKVParserZLib.cpp
│ │ │ ├── TTA1Help.cpp
│ │ │ ├── TTA1Help.h
│ │ │ ├── WV4Help.cpp
│ │ │ ├── WV4Help.h
│ │ │ └── zlib
│ │ │ │ ├── zconf.h
│ │ │ │ └── zlib.h
│ │ ├── RealCook.h
│ │ ├── VFWHelp.cpp
│ │ └── VFWHelp.h
│ └── MP4
│ │ ├── Core
│ │ ├── Aka4Splitter.cpp
│ │ ├── Aka4Splitter.h
│ │ ├── Aka4SplitterMisc.cpp
│ │ └── Internal
│ │ │ ├── GlobalPrehead.h
│ │ │ ├── IsomCodec.cpp
│ │ │ ├── IsomCodec.h
│ │ │ ├── IsomError.h
│ │ │ ├── IsomGlobal.h
│ │ │ ├── IsomObject.h
│ │ │ ├── IsomParser.cpp
│ │ │ ├── IsomParser.h
│ │ │ ├── IsomParserCore.cpp
│ │ │ ├── IsomParserMetadata.cpp
│ │ │ ├── IsomParserStream.cpp
│ │ │ ├── IsomStreamSource.h
│ │ │ ├── IsomTypes.h
│ │ │ └── StructTable.h
│ │ ├── MP4Demuxer.cpp
│ │ ├── MP4MediaFormat.cpp
│ │ ├── MP4MediaFormat.h
│ │ ├── MP4MediaStream.cpp
│ │ ├── MP4MediaStream.h
│ │ ├── MP4Metadata.cpp
│ │ └── NaluHelp.cpp
├── CoreDemuxers.UWP
│ ├── CoreDemuxers.UWP.vcxproj
│ └── CoreDemuxers.UWP.vcxproj.filters
└── CoreDemuxers.def
├── CoreMFSource
├── CoreMFSource.Desktop
│ ├── CoreMFSource.Desktop.vcxproj
│ └── CoreMFSource.Desktop.vcxproj.filters
├── CoreMFSource.Shared
│ ├── Common
│ │ ├── AutoComMem.h
│ │ ├── AutoPropVar.h
│ │ ├── AutoStrConv.h
│ │ ├── AutoWinHandle.h
│ │ ├── CritSec.h
│ │ ├── MFAsyncCalback.h
│ │ ├── MFAutoBufLock.h
│ │ ├── MFComList.cpp
│ │ ├── MFComList.h
│ │ ├── MFComQueue.cpp
│ │ ├── MFComQueue.h
│ │ ├── MFCommon.h
│ │ ├── MFGenericList.h
│ │ ├── MFGenericQueue.h
│ │ ├── MFMiscHelp.cpp
│ │ ├── MFMiscHelp.h
│ │ ├── MFMiscHelp2.cpp
│ │ ├── MFMiscHelp2.h
│ │ ├── MFWorkQueue.h
│ │ ├── MFWorkQueueOld.h
│ │ ├── Win32Event.h
│ │ └── Win32MacroTools.h
│ ├── CoreMFSource.Shared.vcxitems
│ ├── CoreMFSource.Shared.vcxitems.filters
│ ├── DbgLogOutput.cpp
│ ├── DbgLogOutput.h
│ ├── Demuxer
│ │ ├── DemuxerFactory.cpp
│ │ ├── DemuxerFactory.h
│ │ └── PathHelp.cpp
│ ├── GlobalSettings.cpp
│ ├── GlobalSettings.h
│ ├── HDCoreByteStreamHandler.cpp
│ ├── HDCoreByteStreamHandler.h
│ ├── HDMediaSource.cpp
│ ├── HDMediaSource.h
│ ├── HDMediaSource_AudioMediaType.cpp
│ ├── HDMediaSource_Desktop.cpp
│ ├── HDMediaSource_EventGenerator.cpp
│ ├── HDMediaSource_GetService.cpp
│ ├── HDMediaSource_InitMediaType.cpp
│ ├── HDMediaSource_Metadata.cpp
│ ├── HDMediaSource_Misc.cpp
│ ├── HDMediaSource_MkStreams.cpp
│ ├── HDMediaSource_OpenAsync.cpp
│ ├── HDMediaSource_Operation.cpp
│ ├── HDMediaSource_Parser.cpp
│ ├── HDMediaSource_Props.cpp
│ ├── HDMediaSource_TaskQueue.cpp
│ ├── HDMediaSource_VideoMediaType.cpp
│ ├── HDMediaStream.cpp
│ ├── HDMediaStream.h
│ ├── HDMediaStream_EventGenerator.cpp
│ ├── LinkList.h
│ ├── MFMediaIO.h
│ ├── MFMediaIOEx.cpp
│ ├── MFMediaIOEx.h
│ ├── MFSeekInfo.hxx
│ ├── MFsGlobalSettings.h
│ ├── MyMediaTypeDef.h
│ ├── main.cpp
│ ├── pch.cpp
│ └── pch.h
├── CoreMFSource.UWP
│ ├── CoreMFSource.UWP.vcxproj
│ └── CoreMFSource.UWP.vcxproj.filters
└── CoreMFSource.def
├── Demo
├── SYEngineDesktop
│ ├── MediaExtensionActivate.cpp
│ ├── MediaExtensionActivate.h
│ ├── MediaExtensionInstaller.cpp
│ ├── MediaExtensionInstaller.h
│ ├── SYEngineDesktop.vcxproj
│ ├── SYEngineDesktop.vcxproj.filters
│ ├── main.cpp
│ └── pch.h
└── SYEngineUWP
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── MultipartStreamMatroska
│ │ ├── 0.mp4
│ │ └── 1.mp4
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
│ └── SYEngineUWP.csproj
├── LICENSE
├── MultipartStreamMatroska
├── MultipartStreamMatroska.Desktop
│ ├── MultipartStreamMatroska.Desktop.vcxproj
│ └── MultipartStreamMatroska.Desktop.vcxproj.filters
├── MultipartStreamMatroska.Shared
│ ├── Core
│ │ ├── DemuxLavf.h
│ │ ├── DemuxProxy.cpp
│ │ ├── DemuxProxy.h
│ │ ├── DsIOCallback.h
│ │ ├── MatroskaJoinStream.cpp
│ │ ├── MatroskaJoinStream.h
│ │ ├── MatroskaMerge.cpp
│ │ ├── MatroskaMerge.h
│ │ ├── MemoryBuffer.cpp
│ │ ├── MemoryBuffer.h
│ │ ├── MemoryStream.cpp
│ │ ├── MemoryStream.h
│ │ ├── MergeManager.cpp
│ │ ├── MergeManager.h
│ │ ├── RingBlockBuffer.cpp
│ │ ├── RingBlockBuffer.h
│ │ ├── StringArray.cpp
│ │ ├── StringArray.h
│ │ ├── TextReader.cpp
│ │ ├── TextReader.h
│ │ ├── WindowsHttpDataSource.cpp
│ │ ├── WindowsHttpDataSource.h
│ │ ├── WindowsHttpDownloader.cpp
│ │ ├── WindowsHttpDownloader.h
│ │ ├── WindowsHttpTaskManager.cpp
│ │ ├── WindowsHttpTaskManager.h
│ │ ├── WindowsLocalFile.cpp
│ │ ├── WindowsLocalFile.h
│ │ ├── WindowsTaskManager.cpp
│ │ ├── WindowsTaskManager.h
│ │ ├── downloader
│ │ │ ├── DownloadCore.h
│ │ │ ├── DownloadTask.h
│ │ │ ├── TaskManagerBase.cpp
│ │ │ └── TaskManagerBase.h
│ │ ├── mkv
│ │ │ ├── AkaMatroska.cpp
│ │ │ ├── AkaMatroska.h
│ │ │ ├── AkaMatroskaConst.h
│ │ │ ├── AkaMatroskaEbml.cpp
│ │ │ ├── AkaMatroskaEbml.h
│ │ │ ├── AkaMatroskaGlobal.h
│ │ │ ├── AkaMatroskaIOCallback.h
│ │ │ ├── AkaMatroskaObject.h
│ │ │ ├── AkaMatroskaPrehead.h
│ │ │ └── AkaMatroskaStructTable.h
│ │ ├── parser
│ │ │ ├── AACParser.cpp
│ │ │ ├── AACParser.h
│ │ │ ├── AVCParser.cpp
│ │ │ ├── AVCParser.h
│ │ │ ├── BitReader.cpp
│ │ │ ├── BitReader.h
│ │ │ ├── FLACParser.cpp
│ │ │ └── FLACParser.h
│ │ └── winhttp_runtime.h
│ ├── MultipartStream.cpp
│ ├── MultipartStream.h
│ ├── MultipartStreamMatroska.Shared.vcxitems
│ ├── MultipartStreamMatroska.Shared.vcxitems.filters
│ ├── ThreadImpl.cpp
│ ├── ThreadImpl.h
│ ├── UrlHandler.cpp
│ ├── UrlHandler.h
│ ├── main.cpp
│ ├── pch.cpp
│ └── pch.h
├── MultipartStreamMatroska.UWP
│ ├── MultipartStreamMatroska.UWP.vcxproj
│ └── MultipartStreamMatroska.UWP.vcxproj.filters
└── MultipartStreamMatroska.def
├── README.md
├── RtmpStream
├── RtmpStream.Desktop
│ ├── RtmpStream.Desktop.vcxproj
│ └── RtmpStream.Desktop.vcxproj.filters
├── RtmpStream.Shared
│ ├── RtmpStream.Shared.vcxitems
│ ├── RtmpStream.Shared.vcxitems.filters
│ ├── RtmpStream.cpp
│ ├── RtmpStream.h
│ ├── RtmpThread.cpp
│ ├── RtmpThread.h
│ ├── RtmpUrlHandler.cpp
│ ├── RtmpUrlHandler.h
│ ├── librtmp
│ │ ├── amf.c
│ │ ├── amf.h
│ │ ├── bytes.h
│ │ ├── handshake.h
│ │ ├── log.c
│ │ ├── log.h
│ │ ├── parseurl.c
│ │ ├── rtmp.c
│ │ ├── rtmp.h
│ │ └── rtmp_sys.h
│ └── main.cpp
├── RtmpStream.UWP
│ ├── RtmpStream.UWP.vcxproj
│ └── RtmpStream.UWP.vcxproj.filters
└── RtmpStream.def
├── SYEngine
└── SYEngine.UWP
│ ├── AutoLib.h
│ ├── Core.cpp
│ ├── Core.h
│ ├── Core.idl
│ ├── MFSeekInfo.hxx
│ ├── MediaExtensionActivate.cpp
│ ├── MediaExtensionActivate.h
│ ├── MediaExtensionCallback.cpp
│ ├── MediaExtensionInstaller.cpp
│ ├── MediaExtensionInstaller.h
│ ├── MediaInfo.cpp
│ ├── MediaInfo.h
│ ├── MediaInformation.cpp
│ ├── MediaInformation.h
│ ├── MediaInformation.idl
│ ├── Playlist.cpp
│ ├── Playlist.h
│ ├── Playlist.idl
│ ├── PropertySheet.props
│ ├── SYEngine.UWP.vcxproj
│ ├── SYEngine_UWP.def
│ ├── packages.config
│ ├── pch.cpp
│ ├── pch.h
│ └── readme.txt
├── SYEngine_Runtime_VS2013.sln
├── TransformFilter
├── TransformFilter.Desktop
│ ├── TransformFilter.Desktop.vcxproj
│ └── TransformFilter.Desktop.vcxproj.filters
├── TransformFilter.Shared
│ ├── AVCParser.cpp
│ ├── AVCParser.h
│ ├── BitReader.cpp
│ ├── BitReader.h
│ ├── FFmpegAudioDecoder.cpp
│ ├── FFmpegAudioDecoder.h
│ ├── FFmpegDecodeFilter.cpp
│ ├── FFmpegDecodeFilter.h
│ ├── FFmpegDecodeServices.cpp
│ ├── FFmpegDecodeServices.h
│ ├── FFmpegVideoDecoder.cpp
│ ├── FFmpegVideoDecoder.h
│ ├── TransformFilter.Shared.vcxitems
│ ├── TransformFilter.Shared.vcxitems.filters
│ ├── TransformFilter.h
│ ├── TransformServices.h
│ ├── main.cpp
│ ├── memcpy_sse.h
│ └── more_codec_uuid.h
├── TransformFilter.UWP
│ ├── TransformFilter.UWP.vcxproj
│ └── TransformFilter.UWP.vcxproj.filters
└── TransformFilter.def
├── UpgradeLog.htm
├── WinhttpWrapper
├── WinHttpWrapper.UWP
│ ├── WinHttpWrapper.UWP.vcxproj
│ └── WinHttpWrapper.UWP.vcxproj.filters
├── WinhttpWrapper.Shared
│ ├── WinhttpWrapper.Shared.vcxitems
│ ├── WinhttpWrapper.Shared.vcxitems.filters
│ ├── auto_lib.h
│ └── main.cpp
└── exports.def
└── ffcodecs
├── build_config_lgpl.txt
├── ffcodecs.Desktop
├── ffcodecs.Desktop.vcxproj
└── ffcodecs.Desktop.vcxproj.filters
├── ffcodecs.Shared
├── ffcodecs.Shared.vcxitems
├── ffcodecs.Shared.vcxitems.filters
└── main.cpp
├── ffcodecs.UWP
├── ffcodecs.UWP.vcxproj
└── ffcodecs.UWP.vcxproj.filters
├── ffcodecs.def
└── ffmpeg
├── include
├── libavcodec
│ ├── ac3_parser.h
│ ├── adts_parser.h
│ ├── avcodec.h
│ ├── avdct.h
│ ├── avfft.h
│ ├── bsf.h
│ ├── codec.h
│ ├── codec_desc.h
│ ├── codec_id.h
│ ├── codec_par.h
│ ├── d3d11va.h
│ ├── dirac.h
│ ├── dv_profile.h
│ ├── dxva2.h
│ ├── flac.h
│ ├── jni.h
│ ├── mediacodec.h
│ ├── packet.h
│ ├── qsv.h
│ ├── vaapi.h
│ ├── vdpau.h
│ ├── version.h
│ ├── videotoolbox.h
│ ├── vorbis_parser.h
│ └── xvmc.h
├── libavformat
│ ├── avformat.h
│ ├── avio.h
│ └── version.h
├── libavutil
│ ├── adler32.h
│ ├── aes.h
│ ├── aes_ctr.h
│ ├── attributes.h
│ ├── audio_fifo.h
│ ├── avassert.h
│ ├── avconfig.h
│ ├── avstring.h
│ ├── avutil.h
│ ├── base64.h
│ ├── blowfish.h
│ ├── bprint.h
│ ├── bswap.h
│ ├── buffer.h
│ ├── camellia.h
│ ├── cast5.h
│ ├── channel_layout.h
│ ├── common.h
│ ├── cpu.h
│ ├── crc.h
│ ├── des.h
│ ├── dict.h
│ ├── display.h
│ ├── dovi_meta.h
│ ├── downmix_info.h
│ ├── encryption_info.h
│ ├── error.h
│ ├── eval.h
│ ├── ffversion.h
│ ├── fifo.h
│ ├── file.h
│ ├── frame.h
│ ├── hash.h
│ ├── hdr_dynamic_metadata.h
│ ├── hmac.h
│ ├── hwcontext.h
│ ├── hwcontext_cuda.h
│ ├── hwcontext_d3d11va.h
│ ├── hwcontext_drm.h
│ ├── hwcontext_dxva2.h
│ ├── hwcontext_mediacodec.h
│ ├── hwcontext_opencl.h
│ ├── hwcontext_qsv.h
│ ├── hwcontext_vaapi.h
│ ├── hwcontext_vdpau.h
│ ├── hwcontext_videotoolbox.h
│ ├── hwcontext_vulkan.h
│ ├── imgutils.h
│ ├── intfloat.h
│ ├── intreadwrite.h
│ ├── lfg.h
│ ├── log.h
│ ├── lzo.h
│ ├── macros.h
│ ├── mastering_display_metadata.h
│ ├── mathematics.h
│ ├── md5.h
│ ├── mem.h
│ ├── motion_vector.h
│ ├── murmur3.h
│ ├── opt.h
│ ├── parseutils.h
│ ├── pixdesc.h
│ ├── pixelutils.h
│ ├── pixfmt.h
│ ├── random_seed.h
│ ├── rational.h
│ ├── rc4.h
│ ├── replaygain.h
│ ├── ripemd.h
│ ├── samplefmt.h
│ ├── sha.h
│ ├── sha512.h
│ ├── spherical.h
│ ├── stereo3d.h
│ ├── tea.h
│ ├── threadmessage.h
│ ├── time.h
│ ├── timecode.h
│ ├── timestamp.h
│ ├── tree.h
│ ├── twofish.h
│ ├── tx.h
│ ├── version.h
│ ├── video_enc_params.h
│ └── xtea.h
├── libswresample
│ ├── swresample.h
│ └── version.h
└── libswscale
│ ├── swscale.h
│ └── version.h
└── lib
├── runtime
├── arm
│ └── ffmpeg.lib
├── x64
│ └── ffmpeg.lib
└── x86
│ └── ffmpeg.lib
└── uwp
├── arm
└── ffmpeg.lib
├── x64
└── ffmpeg.lib
└── x86
└── ffmpeg.lib
/!GUIDE/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/!GUIDE/0.png
--------------------------------------------------------------------------------
/!GUIDE/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/!GUIDE/1.png
--------------------------------------------------------------------------------
/!GUIDE/GUIDE.md:
--------------------------------------------------------------------------------
1 | # Guide: How to Use It (WinRT 8.1)
2 | ### My Environment
3 | - Windows 8.1
4 | - Visual Studio 2013 with Update 3
5 |
6 | ### Features
7 | - **FLV\MKV** Playback (File or NetworkStream).
8 | - MP4\FLV Segment Mixed Playback.
9 | - RTMP over HTTP Live Stream.
10 | - Hardware accelerated.
11 |
12 | ***
13 | ### 1. Install VSIX Packages and...
14 | - Download and Install:
15 | - Windows 8.1: `SYEngine_WinRT81.vsix`
16 | - Windows Phone 8.1: `SYEngine_WinPhone81.vsix`
17 | - Create a new UAP Project
18 | - **Windows 8.1 or Windows Phone 8.1 only**
19 | - Visual C#
20 |
21 | ### 2. Add References
22 | 
23 |
24 | - Windows 8.1: `ShanYe MediaPlayer Engine (Windows 8.1)`
25 | - Windows Phone 8.1: `ShanYe MediaPlayer Engine (Windows Phone 8.1)`
26 | - **Change build target to: x86\x64\ARM.**
27 |
28 | ### 3. Open `App.xaml.cs` and Add Code...
29 | 
30 |
31 | ```
32 | In App::OnLaunched:
33 | SYEngine.Core.Initialize();
34 | ```
35 |
36 | ### 4. Build and Run
37 | - use the **MediaElement** Control to Play a Video (File or Network).
38 | - use the **Windows.Media.Transcoding.MediaTranscoder** API.
39 |
--------------------------------------------------------------------------------
/!GUIDE/RTMP/RTMP.md:
--------------------------------------------------------------------------------
1 | # Play RTMP Stream
2 |
3 | ## Client
4 |
5 | ### Winsocks
6 | You must init winsocks before playing RTMP stream (desktop).
7 | ```
8 | WSADATA wsa;
9 | WSAStartup(MAKEWORD(2,2), &wsa);
10 | ```
11 | This is not required for WinRT.
12 |
13 | ## Server
14 |
15 | ### Timestamp
16 | Your media server must fix timestamp for every client start with 0.
17 |
18 | So you can't use nginx-rtmp-module , try simple-rtmp-server or others.
--------------------------------------------------------------------------------
/!GUIDE/Segment/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/!GUIDE/Segment/0.png
--------------------------------------------------------------------------------
/!GUIDE/Segment/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/!GUIDE/Segment/1.png
--------------------------------------------------------------------------------
/!GUIDE/Segment/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/!GUIDE/Segment/2.png
--------------------------------------------------------------------------------
/!GUIDE/Segment/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/!GUIDE/Segment/3.png
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.lib filter=lfs diff=lfs merge=lfs -text
2 | *.dll filter=lfs diff=lfs merge=lfs -text
3 | *.mp4 filter=lfs diff=lfs merge=lfs -text
4 | *.exe filter=lfs diff=lfs merge=lfs -text
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.suo
2 | *.sdf
3 | *.opensdf
4 | *.opendb
5 | *.user
6 | *.ipch
7 | *.obj
8 | *.pdb
9 | *.log
10 | *.config
11 | !packages.config
12 | *.VC.db
13 | *.pfx
14 |
15 | [Dd]ebug/
16 | [Rr]elease/
17 | ARM/
18 | x64/
19 | x86/
20 |
21 | build/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | Generated Files/
26 | AppPackages/
27 | packages/
28 |
29 | .vs/
30 | .vscode/
31 |
32 | /!Packages/
33 | !/ffcodecs/ffmpeg/lib/runtime/arm/
34 | !/ffcodecs/ffmpeg/lib/runtime/x64/
35 | !/ffcodecs/ffmpeg/lib/runtime/x86/
36 | !/ffcodecs/ffmpeg/lib/uwp/arm/
37 | !/ffcodecs/ffmpeg/lib/uwp/x64/
38 | !/ffcodecs/ffmpeg/lib/uwp/x86/
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Desktop/CoreCommon.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/AVDescription.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/AV/AVDescription.h
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/AVDescription_CH_Layout.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/AV/AVDescription_CH_Layout.h
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/AutoMediaBuffer.h:
--------------------------------------------------------------------------------
1 | #ifndef __AUTO_MEDIA_BUFFER_H
2 | #define __AUTO_MEDIA_BUFFER_H
3 |
4 | #include "MediaMemory.h"
5 | #include
6 |
7 | class CAutoMediaBuffer final
8 | {
9 | AVMediaBuffer _buffer;
10 |
11 | public:
12 | explicit CAutoMediaBuffer(unsigned size) throw()
13 | {
14 | memset(&_buffer,0,sizeof(_buffer));
15 | InitMediaBuffer(&_buffer,size);
16 | }
17 |
18 | explicit CAutoMediaBuffer(AVMediaBuffer& other) throw()
19 | {
20 | _buffer = other;
21 | }
22 |
23 | explicit CAutoMediaBuffer(const AVMediaBuffer* other) throw()
24 | {
25 | if (other == nullptr)
26 | return;
27 |
28 | memset(&_buffer,0,sizeof(_buffer));
29 | InitMediaBuffer(&_buffer,other->size);
30 |
31 | memcpy(_buffer.buf,other->buf,other->size);
32 | }
33 |
34 | ~CAutoMediaBuffer() throw()
35 | {
36 | if (_buffer.buf)
37 | FreeMediaBuffer(&_buffer);
38 | }
39 |
40 | public:
41 | AVMediaBuffer* Get() throw()
42 | {
43 | return &_buffer;
44 | }
45 |
46 | const AVMediaBuffer* Get() const throw()
47 | {
48 | return &_buffer;
49 | }
50 | };
51 |
52 | #endif //__AUTO_MEDIA_MEMORY_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/AutoMediaPacket.h:
--------------------------------------------------------------------------------
1 | #ifndef __AUTO_MEDIA_PACKET_H
2 | #define __AUTO_MEDIA_PACKET_H
3 |
4 | #include "MediaPacket.h"
5 |
6 | class CAutoMediaPacket final
7 | {
8 | AVMediaPacket _packet;
9 |
10 | public:
11 | explicit CAutoMediaPacket(unsigned size) throw()
12 | {
13 | AllocMediaPacket(&_packet,size);
14 | }
15 |
16 | explicit CAutoMediaPacket(void* pd,unsigned size) throw()
17 | {
18 | AllocMediaPacketAndCopy(&_packet,pd,size);
19 | }
20 |
21 | explicit CAutoMediaPacket(AVMediaPacket& other) throw()
22 | {
23 | _packet = other;
24 | }
25 |
26 | explicit CAutoMediaPacket(const AVMediaPacket* other) throw()
27 | {
28 | if (other == nullptr)
29 | return;
30 |
31 | CopyMediaPacket((AVMediaPacket*)other,&_packet);
32 | }
33 |
34 | ~CAutoMediaPacket() throw()
35 | {
36 | FreeMediaPacket(&_packet);
37 | }
38 |
39 | public:
40 | AVMediaPacket* Get() throw()
41 | {
42 | return &_packet;
43 | }
44 |
45 | const AVMediaPacket* Get() const throw()
46 | {
47 | return &_packet;
48 | }
49 | };
50 |
51 | #endif //__AUTO_MEDIA_PACKET_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaAVChapter.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_AV_CHAPTER_H
2 | #define __MEDIA_AV_CHAPTER_H
3 |
4 | #define MAX_AV_CHAPTER_STRING_LEN 256
5 |
6 | enum AVChapterType
7 | {
8 | ChapterType_Marker,
9 | ChapterType_Timeline
10 | };
11 |
12 | enum AVChapterEncodingType
13 | {
14 | ChapterStringEnc_ANSI,
15 | ChapterStringEnc_UTF8,
16 | ChapterStringEnc_UNICODE
17 | };
18 |
19 | struct AVMediaChapter
20 | {
21 | AVChapterType type;
22 | AVChapterEncodingType str_enc_type;
23 | double index;
24 | double start_time; //seconds.
25 | double end_time; //seconds.
26 | double duration;
27 | char title[MAX_AV_CHAPTER_STRING_LEN];
28 | char desc[MAX_AV_CHAPTER_STRING_LEN];
29 | char lang[32];
30 | unsigned flags;
31 | };
32 |
33 | class IAVMediaChapters
34 | {
35 | public:
36 | virtual unsigned GetChapterCount() { return 0; }
37 | virtual AVMediaChapter* GetChapter(unsigned index) { return nullptr; }
38 | };
39 |
40 | #endif //__MEDIA_AV_CHAPTER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaAVFormat.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/AV/MediaAVFormat.h
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaAVIO.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_AV_IO_H
2 | #define __MEDIA_AV_IO_H
3 |
4 | #include
5 |
6 | #define RESET_AV_MEDIA_IO(x) ((x)->Seek(0,0))
7 |
8 | class IAVMediaIO
9 | {
10 | public:
11 | virtual unsigned Read(void* pb,unsigned size) = 0;
12 | virtual unsigned Write(void* pb,unsigned size) = 0;
13 | virtual bool Seek(long long offset,int whence) = 0;
14 | virtual long long Tell() = 0;
15 | virtual long long GetSize() = 0;
16 |
17 | virtual void SetLiveStream() {}
18 | virtual bool IsLiveStream() { return false; }
19 | virtual bool IsAliveStream() { return false; }
20 |
21 | virtual bool IsCancel() { return false; }
22 |
23 | virtual bool IsError() { return false; }
24 | virtual int GetErrorCode() { return -1; }
25 |
26 | virtual bool GetPlatformSpec(void** pp,int* spec_code) { return false; }
27 | protected:
28 | virtual ~IAVMediaIO() {}
29 | };
30 |
31 | #endif //__MEDIA_AV_IO_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaAVMetadata.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_AV_METADATA_H
2 | #define __MEDIA_AV_METADATA_H
3 |
4 | #define AV_METADATA_TYPE_TITLE "title"
5 | #define AV_METADATA_TYPE_ALBUM "album"
6 | #define AV_METADATA_TYPE_ARTIST "artist"
7 | #define AV_METADATA_TYPE_GENRE "genre"
8 | #define AV_METADATA_TYPE_COMPOSER "composer"
9 | #define AV_METADATA_TYPE_DATE "date"
10 | #define AV_METADATA_TYPE_NUMBER "number"
11 | #define AV_METADATA_TYPE_COMMENT "comment"
12 | #define AV_METADATA_TYPE_COPYRIGHT "copyright"
13 |
14 | enum AVMetadataStringType
15 | {
16 | MetadataStrType_ANSI,
17 | MetadataStrType_UTF8,
18 | MetadataStrType_Unicode
19 | };
20 |
21 | enum AVMetadataCoverImageType
22 | {
23 | MetadataImageType_Unknown,
24 | MetadataImageType_BMP,
25 | MetadataImageType_JPG,
26 | MetadataImageType_PNG,
27 | MetadataImageType_GIF,
28 | MetadataImageType_TIFF
29 | };
30 |
31 | class IAVMediaMetadata
32 | {
33 | public:
34 | virtual AVMetadataStringType GetStrType() { return AVMetadataStringType::MetadataStrType_UTF8; }
35 | virtual unsigned GetValueCount() { return 0; }
36 | virtual unsigned GetValue(const char* name,void* copyTo) { return 0; }
37 | virtual const char* GetValueName(unsigned index) { return nullptr; }
38 | virtual AVMetadataCoverImageType GetCoverImageType() { return AVMetadataCoverImageType::MetadataImageType_Unknown; }
39 | virtual unsigned GetCoverImage(unsigned char* copyTo) { return false; }
40 | };
41 |
42 | #endif //__MEDIA_AV_METADATA_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaAVResource.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_AV_RESOURCE_H
2 | #define __MEDIA_AV_RESOURCE_H
3 |
4 | #define MAX_AV_RES_FILENAME_LEN 256
5 |
6 | struct AVMediaResource
7 | {
8 | char file_name[MAX_AV_RES_FILENAME_LEN]; //UTF8
9 | char mime_type[64];
10 | long long data_size;
11 | long long seek_pos;
12 | };
13 |
14 | class IAVMediaResources
15 | {
16 | public:
17 | virtual unsigned GetResourceCount() { return 0; }
18 | virtual AVMediaResource* GetResource(unsigned index) { return nullptr; }
19 | };
20 |
21 | #endif //__MEDIA_AV_RESOURCE_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaAVStream.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_AV_STREAM_H
2 | #define __MEDIA_AV_STREAM_H
3 |
4 | #include "AVDescription.h"
5 | #include "MediaCodecType.h"
6 |
7 | struct MediaSubtitleStreamInfo
8 | {
9 | MediaSubtitleTextType type;
10 | unsigned char* head_info;
11 | unsigned head_info_size;
12 | bool same_matroska;
13 | };
14 |
15 | class IAVMediaStream
16 | {
17 | public:
18 | virtual MediaMainType GetMainType() = 0;
19 | virtual MediaCodecType GetCodecType() = 0;
20 |
21 | virtual MediaSubtitleStreamInfo* GetSubtitleInfo() { return nullptr; }
22 |
23 | virtual int GetStreamIndex() = 0;
24 |
25 | virtual const char* GetStreamName() { return nullptr; }
26 | virtual const char* GetLanguageName() { return "und"; }
27 |
28 | virtual bool CopyAttachedData(void* copy_to) { return false; }
29 | virtual unsigned GetAttachedDataSize() { return 0; }
30 |
31 | virtual double GetDuration() { return 0; }
32 | virtual unsigned GetBitrate() { return 0; }
33 | virtual long long GetSamples() { return 0; }
34 |
35 | //for Isom\Mpeg4 format...
36 | virtual int GetRotation() { return 0; }
37 | virtual int GetRawTimescale() { return 0; }
38 | virtual float GetContainerFps() { return 0.0f; }
39 |
40 | virtual IAudioDescription* GetAudioInfo() { return nullptr; }
41 | virtual IVideoDescription* GetVideoInfo() { return nullptr; }
42 |
43 | virtual ~IAVMediaStream() {}
44 | };
45 |
46 | #endif //__MEDIA_AV_STREAM_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaMemory.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_MEMORY_H
2 | #define __MEDIA_MEMORY_H
3 |
4 | #include "MediaPacket.h"
5 |
6 | void* AllocMediaMemory(unsigned size);
7 | void* ReallocMediaMemory(void* p,unsigned size);
8 | void FreeMediaMemory(void* p);
9 |
10 | bool InitMediaBuffer(AVMediaBuffer* buffer,unsigned size);
11 | bool AdjustMediaBufferSize(AVMediaBuffer* buffer,unsigned new_size);
12 | bool FreeMediaBuffer(AVMediaBuffer* buffer);
13 | void CopyMediaMemory(AVMediaBuffer* buffer,void* copy_to,unsigned copy_to_size);
14 |
15 | #endif //__MEDIA_MEMORY_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/AV/MediaPacket.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/AV/MediaPacket.h
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AAC/AACAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __AAC_AUDIO_DESCRIPTION_H
2 | #define __AAC_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 |
6 | #include "AAC_ADTS_Parser.h"
7 | #include "AAC_LATM_Parser.h"
8 | #include "AVDescription.h"
9 |
10 | #define AAC_ADTS_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('A','D','T','S')
11 | #define AAC_RAW_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('A','A','C',' ')
12 |
13 | struct AAC_PROFILE_SPEC
14 | {
15 | int profile;
16 | int level;
17 | int rate_index;
18 | int he_with_lc_core;
19 | };
20 |
21 | class ADTSAudioDescription : public IAudioDescription
22 | {
23 | public:
24 | ADTSAudioDescription(unsigned* ph) throw();
25 | ADTSAudioDescription(unsigned* ph,bool asc,unsigned asc_size = 2) throw();
26 |
27 | public:
28 | int GetType();
29 | bool GetProfile(void* profile);
30 | bool GetExtradata(void*);
31 | unsigned GetExtradataSize();
32 |
33 | const unsigned char* GetPrivateData() { return _asc; }
34 | unsigned GetPrivateSize() { return GetExtradataSize(); }
35 |
36 | bool GetAudioDescription(AudioBasicDescription* desc);
37 | bool ExternalUpdateAudioDescription(AudioBasicDescription* desc)
38 | { _basic_desc = *desc; return true; }
39 |
40 | protected:
41 | void FlushAudioDescription(unsigned char* ph);
42 | void FlushAudioDescription2(unsigned char* ph,unsigned size);
43 |
44 | private:
45 | AudioBasicDescription _basic_desc;
46 | AAC_PROFILE_SPEC _profile;
47 |
48 | unsigned char _asc[32];
49 | unsigned _asc_size;
50 | };
51 |
52 | #endif //__AAC_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AAC/AAC_ADTS_Parser.cpp:
--------------------------------------------------------------------------------
1 | #include "AAC_ADTS_Parser.h"
2 |
3 | bool ADTSHeaderParse(unsigned char* ph,int* profile,int* nch,int* srate)
4 | {
5 | static const int aac_sample_rate_table[] = {
6 | 96000,88200,64000,48000,44100,32000,
7 | 24000,22050,16000,12000,11025,8000,7350,
8 | 0,0,0,0};
9 |
10 | if (*ph != 0xFF)
11 | return false;
12 |
13 | int index = (int)((ph[2] & 0x3C) >> 2);
14 |
15 | *profile = (int)((ph[2] & 0xC0) >> 6);
16 | if (index < 16)
17 | *srate = aac_sample_rate_table[index];
18 | else
19 | *srate = 0;
20 |
21 | int ch = (int)(((ph[2] & 0x01) << 2) | ((ph[3] & 0xC0) >> 6));
22 | if (ch == 7)
23 | ch = 8;
24 | else if (ch > 8)
25 | ch = 0;
26 |
27 | *nch = ch;
28 |
29 | return true;
30 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AAC/AAC_ADTS_Parser.h:
--------------------------------------------------------------------------------
1 | #ifndef __AAC_ADTS_PARSER_H
2 | #define __AAC_ADTS_PARSER_H
3 |
4 | bool ADTSHeaderParse(unsigned char* ph,int* profile,int* nch,int* srate);
5 |
6 | #endif //__AAC_ADTS_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AAC/AAC_LATM_Parser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Description/AAC/AAC_LATM_Parser.cpp
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AAC/AAC_LATM_Parser.h:
--------------------------------------------------------------------------------
1 | #ifndef __AAC_LATM_PARSER_H
2 | #define __AAC_LATM_PARSER_H
3 |
4 | bool LATMHeaderParse(unsigned char* ph,unsigned size,int* profile,int* nch,int* srate,int* he_lc_core);
5 |
6 | #endif //__AAC_LATM_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AC3/A52_Parser.h:
--------------------------------------------------------------------------------
1 | #ifndef __A52_PARSER_H
2 | #define __A52_PARSER_H
3 |
4 | bool AC3ParseFrameInfo(unsigned char* pb,int* srate,int* brate,int* flags);
5 | int GetAC3ChannelsFromFlags(int flags);
6 |
7 | #endif //__A52_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AC3/AC3AudioDescription.cpp:
--------------------------------------------------------------------------------
1 | #include "AC3AudioDescription.h"
2 |
3 | AC3AudioDescription::AC3AudioDescription(unsigned char* ph) throw()
4 | {
5 | memset(&_basic_desc,0,sizeof(_basic_desc));
6 |
7 | if (ph != nullptr)
8 | FlushAudioDescription(ph);
9 | }
10 |
11 | bool AC3AudioDescription::GetAudioDescription(AudioBasicDescription* desc)
12 | {
13 | if (desc == nullptr || _basic_desc.nch == 0)
14 | return false;
15 |
16 | *desc = _basic_desc;
17 | return true;
18 | }
19 |
20 | void AC3AudioDescription::FlushAudioDescription(unsigned char* ph)
21 | {
22 | int flags = 0,br = 0;
23 | if (AC3ParseFrameInfo(ph,(int*)&_basic_desc.srate,&br,&flags))
24 | {
25 | if (flags != 0 &&
26 | br != 0)
27 | _basic_desc.nch = GetAC3ChannelsFromFlags(flags);
28 | }
29 |
30 | _basic_desc.bitrate = br;
31 | _basic_desc.wav_avg_bytes = br / 8;
32 | _basic_desc.compressed = true;
33 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/AC3/AC3AudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __AC3_AUDIO_DESCRIPTION_H
2 | #define __AC3_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 |
6 | #include "A52_Parser.h"
7 | #include "AVDescription.h"
8 |
9 | #define A52_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('A','5','2',' ')
10 |
11 | class AC3AudioDescription : public IAudioDescription
12 | {
13 | public:
14 | AC3AudioDescription(unsigned char* ph) throw();
15 |
16 | public:
17 | int GetType() { return A52_AUDIO_DESC_TYPE; }
18 | bool GetProfile(void* profile) { return false; }
19 | bool GetExtradata(void*) { return false; }
20 | unsigned GetExtradataSize() { return 0; }
21 |
22 | bool GetAudioDescription(AudioBasicDescription* desc);
23 |
24 | protected:
25 | void FlushAudioDescription(unsigned char* ph);
26 |
27 | private:
28 | AudioBasicDescription _basic_desc;
29 | };
30 |
31 | #endif //__AC3_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/ALAC/ALACAudioDescription.cpp:
--------------------------------------------------------------------------------
1 | #include "ALACAudioDescription.h"
2 |
3 | ALACAudioDescription::ALACAudioDescription(unsigned char* ph,unsigned size) throw()
4 | {
5 | memset(&_basic_desc,0,sizeof(_basic_desc));
6 | FlushAudioDescription(ph,size);
7 | }
8 |
9 | bool ALACAudioDescription::GetExtradata(void* p)
10 | {
11 | if (p == nullptr ||
12 | _extradata.get() == nullptr)
13 | return 0;
14 |
15 | memcpy(p,_extradata.get(),_extradata_len);
16 | return true;
17 | }
18 |
19 | unsigned ALACAudioDescription::GetExtradataSize()
20 | {
21 | return _extradata_len;
22 | }
23 |
24 | bool ALACAudioDescription::GetAudioDescription(AudioBasicDescription* desc)
25 | {
26 | if (desc == nullptr || _basic_desc.nch == 0)
27 | return false;
28 |
29 | *desc = _basic_desc;
30 | return true;
31 | }
32 |
33 | void ALACAudioDescription::FlushAudioDescription(unsigned char* ph,unsigned size)
34 | {
35 | if (ph == nullptr ||
36 | size < 24)
37 | return;
38 |
39 | ALACSpecificConfig info = {};
40 | ParseALACMaigcCode(ph,size,&info);
41 | if (info.frameLength == 0)
42 | return;
43 |
44 | _basic_desc.compressed = true;
45 | _basic_desc.nch = info.numChannels;
46 | _basic_desc.srate = info.sampleRate;
47 | _basic_desc.bits = info.bitDepth;
48 | _basic_desc.bitrate = info.avgBitRate;
49 |
50 | _extradata_len = 24;
51 | _extradata = std::unique_ptr(new unsigned char[_extradata_len]);
52 | memcpy(_extradata.get(),ph,_extradata_len);
53 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/ALAC/ALACAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __ALAC_AUDIO_DESCRIPTION_H
2 | #define __ALAC_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 | #include
6 |
7 | #include "ALACMagicCodeParser.h"
8 | #include "AVDescription.h"
9 |
10 | #define ALAC_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('A','L','A','C')
11 |
12 | class ALACAudioDescription : public IAudioDescription
13 | {
14 | public:
15 | ALACAudioDescription(unsigned char* ph,unsigned size) throw();
16 |
17 | public:
18 | int GetType() { return ALAC_AUDIO_DESC_TYPE; }
19 | bool GetProfile(void* profile) { return false; }
20 | bool GetExtradata(void*);
21 | unsigned GetExtradataSize();
22 |
23 | bool GetAudioDescription(AudioBasicDescription* desc);
24 |
25 | protected:
26 | void FlushAudioDescription(unsigned char* ph,unsigned size);
27 |
28 | private:
29 | AudioBasicDescription _basic_desc;
30 |
31 | std::unique_ptr _extradata;
32 | unsigned _extradata_len;
33 | };
34 |
35 | #endif //__ALAC_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/ALAC/ALACMagicCodeParser.cpp:
--------------------------------------------------------------------------------
1 | #include "ALACMagicCodeParser.h"
2 |
3 | #define ALAC_SWAP16(x) ((((x) & 0xFF00U) >> 8) | (((x) & 0x00FFU) << 8))
4 | #define ALAC_SWAP32(x) ((((x) & 0xFF000000UL) >> 24) | (((x) & 0x00FF0000UL) >> 8) | (((x) & 0x0000FF00UL) << 8) | (((x) & 0x000000FFUL) << 24))
5 |
6 | void ParseALACMaigcCode(unsigned char* pb,unsigned len,ALACSpecificConfig* info)
7 | {
8 | if (len < 24)
9 | return;
10 |
11 | decltype(pb) p = pb;
12 | info->frameLength = ALAC_SWAP32(*(unsigned*)p);
13 | p += 4;
14 | info->compatibleVersion = p[0];
15 | info->bitDepth = p[1];
16 | info->pb = p[2];
17 | info->mb = p[3];
18 | info->kb = p[4];
19 | info->numChannels = p[5];
20 | p += 6;
21 | info->maxRun = ALAC_SWAP16(*(unsigned short*)p);
22 | p += 2;
23 | info->maxFrameBytes = ALAC_SWAP32(*(unsigned*)p);
24 | p += 4;
25 | info->avgBitRate = ALAC_SWAP32(*(unsigned*)p);
26 | p += 4;
27 | info->sampleRate = ALAC_SWAP32(*(unsigned*)p);
28 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/ALAC/ALACMagicCodeParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __ALAC_MAGIC_CODE_PARSER_H
2 | #define __ALAC_MAGIC_CODE_PARSER_H
3 |
4 | struct ALACSpecificConfig
5 | {
6 | unsigned frameLength; //32b
7 | unsigned compatibleVersion; //8b
8 | unsigned bitDepth; //8b
9 | unsigned pb; //8b
10 | unsigned mb; //8b
11 | unsigned kb; //8b
12 | unsigned numChannels; //8b
13 | unsigned maxRun; //16b
14 | unsigned maxFrameBytes; //32b
15 | unsigned avgBitRate; //32b
16 | unsigned sampleRate; //32b
17 | };
18 |
19 | void ParseALACMaigcCode(unsigned char* pb,unsigned len,ALACSpecificConfig* info);
20 |
21 | #endif //__ALAC_MAGIC_CODE_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/CommonAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __COMMON_AUDIO_DESCRIPTION_H
2 | #define __COMMON_AUDIO_DESCRIPTION_H
3 |
4 | #include "AVDescription.h"
5 |
6 | struct CommonAudioCore
7 | {
8 | int type;
9 | AudioBasicDescription desc;
10 | unsigned char* profile;
11 | unsigned profile_size;
12 | unsigned char* extradata;
13 | unsigned extradata_size;
14 | };
15 |
16 | class CommonAudioDescription : public IAudioDescription
17 | {
18 | public:
19 | CommonAudioDescription(CommonAudioCore& core) throw();
20 | virtual ~CommonAudioDescription() throw();
21 |
22 | public:
23 | int GetType();
24 | bool GetProfile(void* profile);
25 | bool GetExtradata(void* p);
26 | unsigned GetExtradataSize();
27 |
28 | bool GetAudioDescription(AudioBasicDescription* desc);
29 |
30 | protected:
31 | void CopyAudioCore(CommonAudioCore* pCore);
32 |
33 | private:
34 | CommonAudioCore _core;
35 | };
36 |
37 | #endif //__COMMON_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/CommonVideoDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __COMMON_VIDEO_DESCRIPTION_H
2 | #define __COMMON_VIDEO_DESCRIPTION_H
3 |
4 | #include "AVDescription.h"
5 |
6 | struct CommonVideoCore
7 | {
8 | int type;
9 | VideoBasicDescription desc;
10 | unsigned char* profile;
11 | unsigned profile_size;
12 | unsigned char* extradata;
13 | unsigned extradata_size;
14 | };
15 |
16 | class CommonVideoDescription : public IVideoDescription
17 | {
18 | public:
19 | CommonVideoDescription(CommonVideoCore& core) throw();
20 | virtual ~CommonVideoDescription() throw();
21 |
22 | public:
23 | int GetType();
24 | bool GetProfile(void* profile);
25 | bool GetExtradata(void* p);
26 | unsigned GetExtradataSize();
27 |
28 | bool GetVideoDescription(VideoBasicDescription* desc);
29 |
30 | protected:
31 | void CopyVideoCore(CommonVideoCore* pCore);
32 |
33 | private:
34 | CommonVideoCore _core;
35 | };
36 |
37 | #endif //__COMMON_VIDEO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/FLAC/FLACAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __FLAC_AUDIO_DESCRIPTION_H
2 | #define __FLAC_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 | #include
6 |
7 | #include "FLACStreamInfoParser.h"
8 | #include "AVDescription.h"
9 |
10 | #define FLAC_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('F','L','A','C')
11 |
12 | struct FLAC_PROFILE_SPEC
13 | {
14 | unsigned min_block_size;
15 | unsigned max_block_size;
16 | unsigned min_frame_size;
17 | unsigned max_frame_size;
18 | };
19 |
20 | class FLACAudioDescription : public IAudioDescription
21 | {
22 | public:
23 | FLACAudioDescription(unsigned char* ph,unsigned size) throw();
24 |
25 | public:
26 | int GetType() { return FLAC_AUDIO_DESC_TYPE; }
27 | bool GetProfile(void* profile);
28 | bool GetExtradata(void*);
29 | unsigned GetExtradataSize();
30 |
31 | bool GetAudioDescription(AudioBasicDescription* desc);
32 |
33 | protected:
34 | void FlushAudioDescription(unsigned char* ph,unsigned size);
35 |
36 | private:
37 | AudioBasicDescription _basic_desc;
38 | FLAC_PROFILE_SPEC _profile;
39 |
40 | std::unique_ptr _extradata;
41 | unsigned _extradata_len;
42 | };
43 |
44 | #endif //__FLAC_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/FLAC/FLACStreamInfoParser.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "FLACStreamInfoParser.h"
3 |
4 | int FindFlacStreamInfoOffset(unsigned char* p,unsigned len)
5 | {
6 | if (p[0] != 0x66 ||
7 | p[1] != 0x4C ||
8 | p[2] != 0x61 ||
9 | p[3] != 0x43)
10 | return -1; //flaC
11 |
12 | unsigned char* pf = p + 4;
13 | for (unsigned i = 0;i < (len - 5);i++)
14 | if (pf[i] == 0x00 || pf[i] == 0x80)
15 | return i + 4;
16 |
17 | return -1;
18 | }
19 |
20 | unsigned ParseFlacStreamInfo(unsigned char* pb,FlacStreamInfo* info)
21 | {
22 | if (pb == nullptr ||
23 | info == nullptr)
24 | return 0;
25 |
26 | unsigned size = pb[3];
27 | if (size < 14 ||
28 | size > 128)
29 | return 0;
30 |
31 | stagefright::ABitReader br(pb + 4,size);
32 | info->MinBlockSize = br.getBits(16);
33 | info->MaxBlockSize = br.getBits(16);
34 | info->MinFrameSize = br.getBits(24);
35 | info->MaxFrameSize = br.getBits(24);
36 | info->SampleRate = br.getBits(20);
37 | info->Channels = br.getBits(3) + 1;
38 | info->Bits = br.getBits(5) + 1;
39 |
40 | return 4 + size;
41 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/FLAC/FLACStreamInfoParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __FLAC_STREAMINFO_PARSER_H
2 | #define __FLAC_STREAMINFO_PARSER_H
3 |
4 | struct FlacStreamInfo
5 | {
6 | unsigned MinBlockSize;
7 | unsigned MaxBlockSize;
8 | unsigned MinFrameSize;
9 | unsigned MaxFrameSize;
10 | unsigned SampleRate;
11 | unsigned Channels;
12 | unsigned Bits;
13 | };
14 |
15 | int FindFlacStreamInfoOffset(unsigned char* p,unsigned len);
16 | unsigned ParseFlacStreamInfo(unsigned char* pb,FlacStreamInfo* info);
17 |
18 | #endif //__FLAC_STREAMINFO_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/H264/AVC1VideoDescription.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "AVC1VideoDescription.h"
3 |
4 | unsigned AVCDecoderConfigurationRecord2AnnexB(unsigned char* src,unsigned char** dst,unsigned* profile,unsigned* level,unsigned* nal_size,unsigned max_annexb_size);
5 |
6 | AVC1VideoDescription::AVC1VideoDescription(unsigned char* avcc,unsigned avcc_size,unsigned width,unsigned height) throw()
7 | {
8 | memset(&_profile,0,sizeof(_profile));
9 | _avcc = nullptr;
10 | if (avcc)
11 | {
12 | _avcc = (decltype(_avcc))malloc(avcc_size / 4 * 4 + 8);
13 | if (_avcc)
14 | {
15 | memcpy(_avcc,avcc,avcc_size);
16 | _avcc_size = avcc_size;
17 | }
18 | _profile.profile = avcc[1];
19 | _profile.level = avcc[3];
20 | }
21 | _basic_desc.width = width;
22 | _basic_desc.height = height;
23 |
24 | unsigned nal_size = 0;
25 | unsigned char* ab = nullptr;
26 | unsigned size = AVCDecoderConfigurationRecord2AnnexB(avcc,&ab,nullptr,nullptr,&nal_size,2048);
27 | if (ab != nullptr)
28 | {
29 | auto h264 = std::make_shared(ab,size);
30 | free(ab);
31 |
32 | H264_PROFILE_SPEC profile = {};
33 | h264->GetProfile(&profile);
34 | if (profile.profile > 0 && profile.level > 0) {
35 | _profile = profile;
36 | h264->GetVideoDescription(&_basic_desc);
37 | }
38 | }
39 | }
40 |
41 | AVC1VideoDescription::~AVC1VideoDescription()
42 | {
43 | if (_avcc)
44 | free(_avcc);
45 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/H264/AVC1VideoDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __AVC1_VIDEO_DESCRIPTION_H
2 | #define __AVC1_VIDEO_DESCRIPTION_H
3 |
4 | #include "X264VideoDescription.h"
5 |
6 | #define AVC1_VIDEO_DESC_TYPE MAKE_AV_DESC_TYPE('A','V','C','1')
7 |
8 | class AVC1VideoDescription : public IVideoDescription
9 | {
10 | public:
11 | AVC1VideoDescription(unsigned char* avcc,unsigned avcc_size,unsigned width,unsigned height) throw();
12 | ~AVC1VideoDescription() throw();
13 |
14 | public:
15 | int GetType() { return AVC1_VIDEO_DESC_TYPE; }
16 | bool GetProfile(void* profile)
17 | { if (profile) memcpy(profile,&_profile,sizeof(_profile)); return profile != nullptr; }
18 | bool GetExtradata(void* p)
19 | { if (p) memcpy(p,_avcc,_avcc_size); return p != nullptr; }
20 | unsigned GetExtradataSize()
21 | { return _avcc_size; }
22 |
23 | const unsigned char* GetPrivateData() { return _avcc; }
24 | unsigned GetPrivateSize() { return GetExtradataSize(); }
25 |
26 | bool GetVideoDescription(VideoBasicDescription* desc)
27 | { if (desc) *desc = _basic_desc; return desc != nullptr; }
28 | bool ExternalUpdateVideoDescription(VideoBasicDescription* desc)
29 | { _basic_desc = *desc; return true; }
30 |
31 | private:
32 | VideoBasicDescription _basic_desc;
33 | H264_PROFILE_SPEC _profile;
34 |
35 | unsigned char* _avcc;
36 | unsigned _avcc_size;
37 | };
38 |
39 | #endif //__AVC1_VIDEO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/H264/X264VideoDescription.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Description/H264/X264VideoDescription.cpp
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/LPCM/BDAudioDescription.cpp:
--------------------------------------------------------------------------------
1 | #include "BDAudioDescription.h"
2 |
3 | BDAudioDescription::BDAudioDescription(unsigned* ph) throw()
4 | {
5 | memset(&_basic_desc,0,sizeof(_basic_desc));
6 |
7 | if (ph != nullptr)
8 | FlushAudioDescription((unsigned char*)ph);
9 | }
10 |
11 | bool BDAudioDescription::GetAudioDescription(AudioBasicDescription* desc)
12 | {
13 | if (desc == nullptr || _basic_desc.nch == 0)
14 | return false;
15 |
16 | *desc = _basic_desc;
17 | return true;
18 | }
19 |
20 | void BDAudioDescription::FlushAudioDescription(unsigned char* ph)
21 | {
22 | BDAudioHeaderParse(ph,(int*)&_basic_desc.nch,(int*)&_basic_desc.srate,(int*)&_basic_desc.bits,&_basic_desc.ch_layout);
23 | _basic_desc.compressed = false;
24 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/LPCM/BDAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __BD_AUDIO_DESCRIPTION_H
2 | #define __BD_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 |
6 | #include "BD_LPCM_Parser.h"
7 | #include "AVDescription.h"
8 |
9 | #define BD_LPCM_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('B','D','A','D')
10 |
11 | class BDAudioDescription : public IAudioDescription
12 | {
13 | public:
14 | BDAudioDescription(unsigned* ph) throw();
15 |
16 | public:
17 | int GetType() { return BD_LPCM_AUDIO_DESC_TYPE; }
18 | bool GetProfile(void*) { return false; }
19 | bool GetExtradata(void*) { return false; }
20 | unsigned GetExtradataSize() { return 0; }
21 |
22 | bool GetAudioDescription(AudioBasicDescription* desc);
23 |
24 | protected:
25 | void FlushAudioDescription(unsigned char* ph);
26 |
27 | private:
28 | AudioBasicDescription _basic_desc;
29 | };
30 |
31 | #endif //__BD_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/LPCM/BD_LPCM_Parser.h:
--------------------------------------------------------------------------------
1 | #ifndef __BD_LPCM_PARSER_H
2 | #define __BD_LPCM_PARSER_H
3 |
4 | #include "AVDescription_CH_Layout.h"
5 |
6 | #ifndef BE_TO_LE32
7 | #define BE_TO_LE32(x) ((((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24))
8 | #endif
9 |
10 | bool BDAudioHeaderParse(void* ph,int* nch,int* srate,int* bits,unsigned int* ch_layout);
11 |
12 | #endif //__BD_LPCM_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/MP3/MPEGAudioDescription.cpp:
--------------------------------------------------------------------------------
1 | #include "MPEGAudioDescription.h"
2 |
3 | MPEGAudioDescription::MPEGAudioDescription(unsigned* ph) throw()
4 | {
5 | memset(&_basic_desc,0,sizeof(_basic_desc));
6 |
7 | if (ph != nullptr)
8 | FlushAudioDescription((unsigned char*)ph);
9 | }
10 |
11 | int MPEGAudioDescription::GetType()
12 | {
13 | switch (_profile.layer)
14 | {
15 | case MPEG_AUDIO_L1:
16 | return MPEG_MP1_AUDIO_DESC_TYPE;
17 | case MPEG_AUDIO_L2:
18 | return MPEG_MP2_AUDIO_DESC_TYPE;
19 | case MPEG_AUDIO_L3:
20 | return MPEG_MP3_AUDIO_DESC_TYPE;
21 | default:
22 | return -1;
23 | }
24 | }
25 |
26 | bool MPEGAudioDescription::GetProfile(void* profile)
27 | {
28 | if (profile == nullptr)
29 | return false;
30 |
31 | memcpy(profile,&_profile,sizeof(_profile));
32 | return true;
33 | }
34 |
35 | bool MPEGAudioDescription::GetAudioDescription(AudioBasicDescription* desc)
36 | {
37 | if (desc == nullptr || _basic_desc.nch == 0)
38 | return false;
39 |
40 | *desc = _basic_desc;
41 | return true;
42 | }
43 |
44 | void MPEGAudioDescription::FlushAudioDescription(unsigned char* ph)
45 | {
46 | MPEGAudioParseHead(ph,(int*)&_basic_desc.nch,(int*)&_basic_desc.srate,&_profile.bitrate,&_profile.layer);
47 | _basic_desc.bitrate = _profile.bitrate * 1000;
48 | _basic_desc.compressed = true;
49 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/MP3/MPEGAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __MPEG_AUDIO_DESCRIPTION_H
2 | #define __MPEG_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 |
6 | #include "MPEG_Audio_Parser.h"
7 | #include "AVDescription.h"
8 |
9 | #define MPEG_MP1_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('M','P','1','A')
10 | #define MPEG_MP2_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('M','P','2','A')
11 | #define MPEG_MP3_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('M','P','3','A')
12 |
13 | struct MPEG_AUDIO_PROFILE_SPEC
14 | {
15 | int bitrate;
16 | int layer;
17 | };
18 |
19 | class MPEGAudioDescription : public IAudioDescription
20 | {
21 | public:
22 | MPEGAudioDescription(unsigned* ph) throw();
23 |
24 | public:
25 | int GetType();
26 | bool GetProfile(void* profile);
27 | bool GetExtradata(void*) { return false; }
28 | unsigned GetExtradataSize() { return 0; }
29 |
30 | bool GetAudioDescription(AudioBasicDescription* desc);
31 | bool ExternalUpdateAudioDescription(AudioBasicDescription* desc)
32 | { _basic_desc = *desc; return true; }
33 |
34 | protected:
35 | void FlushAudioDescription(unsigned char* ph);
36 |
37 | private:
38 | AudioBasicDescription _basic_desc;
39 | MPEG_AUDIO_PROFILE_SPEC _profile;
40 | };
41 |
42 | #endif //__MPEG_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/MP3/MPEG_Audio_Parser.h:
--------------------------------------------------------------------------------
1 | #ifndef __MPEG_ADTS_PARSER_H
2 | #define __MPEG_ADTS_PARSER_H
3 |
4 | #define MPEG_AUDIO_VERSION_25 0
5 | #define MPEG_AUDIO_VERSION_20 2
6 | #define MPEG_AUDIO_VERSION_10 3
7 |
8 | #define MPEG_AUDIO_L3 1
9 | #define MPEG_AUDIO_L2 2
10 | #define MPEG_AUDIO_L1 3
11 |
12 | #define MPEG_AUDIO_CH_STEREO 0
13 | #define MPEG_AUDIO_CH_JOINT_STEREO 1
14 | #define MPEG_AUDIO_CH_DUAL_STEREO 2
15 | #define MPEG_AUDIO_CH_MONO 3
16 |
17 | bool MPEGAudioParseHead(unsigned char* pb,int* nch,int* srate,int* bitrate,int* mpeg_audio_level);
18 |
19 | #endif //__MPEG_ADTS_PARSER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/MPEG2/MPEG2VideoDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __MPEG2_VIDEO_DESCRIPTION_H
2 | #define __MPEG2_VIDEO_DESCRIPTION_H
3 |
4 | #include
5 | #include
6 |
7 | #include "MPEG2HeadParser.h"
8 | #include "AVDescription.h"
9 |
10 | #define MPEG_VIDEO_DESC_TYPE MAKE_AV_DESC_TYPE('M','P','E','G')
11 |
12 | struct MPEG2_PROFILE_SPEC
13 | {
14 | bool exists;
15 | MPEG2Profile profile;
16 | MPEG2Level level;
17 | MPEG2Colors colors;
18 | };
19 |
20 | class MPEG2VideoDescription : public IVideoDescription
21 | {
22 | public:
23 | MPEG2VideoDescription(unsigned char* pb,unsigned len) throw();
24 |
25 | public:
26 | int GetType() { return MPEG_VIDEO_DESC_TYPE; }
27 | bool GetProfile(void* profile);
28 | bool GetExtradata(void*);
29 | unsigned GetExtradataSize();
30 |
31 | bool GetVideoDescription(VideoBasicDescription* desc);
32 |
33 | private:
34 | void FlushDesc(unsigned char* pb,unsigned size);
35 |
36 | private:
37 | std::unique_ptr _extradata;
38 | unsigned _extradata_size;
39 |
40 | MPEG2_PROFILE_SPEC _profile;
41 | VideoBasicDescription _basic_desc;
42 | };
43 |
44 | #endif //__MPEG2_VIDEO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/MPEG4/MPEG4VideoDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __MPEG4_VIDEO_DESCRIPTION_H
2 | #define __MPEG4_VIDEO_DESCRIPTION_H
3 |
4 | #include
5 | #include
6 |
7 | #include "MPEG4HeadParser.h"
8 | #include "AVDescription.h"
9 |
10 | #define MPEG4P2_VIDEO_DESC_TYPE MAKE_AV_DESC_TYPE('M','4','P','2')
11 |
12 | struct MPEG4_PROFILE_SPEC
13 | {
14 | MPEG4V_UserData_Encoder encoder;
15 | MPEG4V_Profile_Level profile;
16 | bool chroma420;
17 | bool h263;
18 | int bits;
19 | };
20 |
21 | class MPEG4VideoDescription : public IVideoDescription
22 | {
23 | public:
24 | MPEG4VideoDescription(unsigned char* pb,unsigned len) throw();
25 |
26 | public:
27 | int GetType() { return MPEG4P2_VIDEO_DESC_TYPE; }
28 | bool GetProfile(void* profile);
29 | bool GetExtradata(void*);
30 | unsigned GetExtradataSize();
31 |
32 | bool GetVideoDescription(VideoBasicDescription* desc);
33 |
34 | private:
35 | void FlushDesc(unsigned char* pb,unsigned size);
36 |
37 | private:
38 | std::unique_ptr _extradata;
39 | unsigned _extradata_size;
40 |
41 | MPEG4_PROFILE_SPEC _profile;
42 | VideoBasicDescription _basic_desc;
43 | };
44 |
45 | #endif //__MPEG4_VIDEO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/OGG/VorbisAudioDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __VORBIS_AUDIO_DESCRIPTION_H
2 | #define __VORBIS_AUDIO_DESCRIPTION_H
3 |
4 | #include
5 | #include
6 |
7 | #include "AVDescription.h"
8 |
9 | #define OGG_AUDIO_DESC_TYPE MAKE_AV_DESC_TYPE('O','G','G','S')
10 |
11 | struct VORBIS_PROFILE_SPEC
12 | {
13 | unsigned max_bitrate;
14 | unsigned min_bitrate;
15 | unsigned bitrate;
16 | unsigned block_size0;
17 | unsigned block_size1;
18 | };
19 |
20 | class VorbisAudioDescription : public IAudioDescription
21 | {
22 | public:
23 | VorbisAudioDescription(unsigned char* ph,unsigned size) throw();
24 |
25 | public:
26 | int GetType() { return OGG_AUDIO_DESC_TYPE; }
27 | bool GetProfile(void* profile);
28 | bool GetExtradata(void*);
29 | unsigned GetExtradataSize();
30 |
31 | bool GetAudioDescription(AudioBasicDescription* desc);
32 |
33 | protected:
34 | void FlushAudioDescription(unsigned char* ph,unsigned size);
35 |
36 | private:
37 | AudioBasicDescription _basic_desc;
38 | VORBIS_PROFILE_SPEC _profile;
39 |
40 | std::unique_ptr _extradata;
41 | unsigned _extradata_len;
42 | };
43 |
44 | #endif //__VORBIS_AUDIO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Description/VC1/VC1VideoDescription.h:
--------------------------------------------------------------------------------
1 | #ifndef __VC1_VIDEO_DESCRIPTION_H
2 | #define __VC1_VIDEO_DESCRIPTION_H
3 |
4 | #include
5 | #include
6 |
7 | #include "VC1HeadParser.h"
8 | #include "AVDescription.h"
9 |
10 | #define VC1_VIDEO_DESC_TYPE MAKE_AV_DESC_TYPE('V','C','-','1')
11 |
12 | class VC1VideoDescription : public IVideoDescription
13 | {
14 | public:
15 | VC1VideoDescription(unsigned char* pb,unsigned len) throw();
16 |
17 | public:
18 | int GetType() { return VC1_VIDEO_DESC_TYPE; }
19 | bool GetProfile(void* profile) { return false; }
20 | bool GetExtradata(void*);
21 | unsigned GetExtradataSize();
22 |
23 | bool GetVideoDescription(VideoBasicDescription* desc);
24 |
25 | private:
26 | void FlushDesc(unsigned char* pb,unsigned size);
27 |
28 | private:
29 | std::unique_ptr _extradata;
30 | unsigned _extradata_size;
31 |
32 | VideoBasicDescription _basic_desc;
33 | };
34 |
35 | #endif //__VC1_VIDEO_DESCRIPTION_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Memory/DynamicMemoryBuffer.h:
--------------------------------------------------------------------------------
1 | #ifndef __DYNAMINC_MEMORY_BUFFER_H
2 | #define __DYNAMINC_MEMORY_BUFFER_H
3 |
4 | class IDynamicMemoryBuffer
5 | {
6 | public:
7 | virtual bool Alloc(unsigned init_size) = 0;
8 | virtual void Free() = 0;
9 |
10 | virtual void* GetStartPointer() = 0;
11 | virtual void* GetEndPointer() = 0;
12 |
13 | virtual unsigned GetTotalSize() = 0;
14 | virtual unsigned GetDataSize() = 0;
15 |
16 | virtual void SetMaxSize(unsigned size) = 0;
17 |
18 | virtual bool Append(void* data,unsigned size) = 0;
19 | virtual void Clear() = 0;
20 | };
21 |
22 | #endif //__DYNAMINC_MEMORY_BUFFER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/ESPacketCutter.cpp:
--------------------------------------------------------------------------------
1 | #include "ESPacketCutter.h"
2 |
3 | bool ESPacketCutter::Parse(unsigned char* buf,unsigned bufSize) throw()
4 | {
5 | if (buf == nullptr || bufSize < _syncWordSize)
6 | return false;
7 | _frames.ClearItems();
8 |
9 | int offset = FindNextSyncWord(buf,bufSize);
10 | if (offset == -1)
11 | return false;
12 |
13 | unsigned total_offset = offset;
14 | while (1)
15 | {
16 | Frame frame;
17 | frame.offset = total_offset;
18 |
19 | offset = FindNextSyncWord(buf + total_offset + _syncWordSize,bufSize - total_offset - _syncWordSize);
20 | if (offset != -1)
21 | frame.size = offset + _syncWordSize;
22 | else
23 | frame.size = bufSize - total_offset;
24 |
25 | if (offset != -1)
26 | total_offset += offset + _syncWordSize;
27 |
28 | if (!_frames.AddItem(&frame))
29 | return false;
30 | if (offset == -1)
31 | break;
32 | }
33 |
34 | return true;
35 | }
36 |
37 | bool ESPacketCutter::GetFrame(unsigned index,unsigned* offset,unsigned* size) throw()
38 | {
39 | if (offset == nullptr || size == nullptr)
40 | return false;
41 | if (index >= _frames.GetCount())
42 | return false;
43 |
44 | auto p =_frames[index];
45 | *offset = p->offset;
46 | *size = p->size;
47 | return true;
48 | }
49 |
50 | int ESPacketCutter::FindNextSyncWord(unsigned char* buffer,unsigned size)
51 | {
52 | for (unsigned i = 0;i < (size - _syncWordSize);i++)
53 | {
54 | if (memcmp(buffer + i,_syncWord,_syncWordSize) == 0)
55 | return (int)i;
56 | }
57 | return -1;
58 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/ESPacketCutter.h:
--------------------------------------------------------------------------------
1 | #ifndef __ES_PACKET_CUTTER_H
2 | #define __ES_PACKET_CUTTER_H
3 |
4 | #include "SimpleContainers/List.h"
5 |
6 | class ESPacketCutter final
7 | {
8 | public:
9 | explicit ESPacketCutter(unsigned char sync_word) throw()
10 | {
11 | _syncWordSize = 1;
12 | _syncWord[0] = sync_word;
13 | }
14 | explicit ESPacketCutter(unsigned short sync_word) throw()
15 | {
16 | _syncWordSize = 2;
17 | *(unsigned short*)&_syncWord[0] = sync_word;
18 | }
19 | explicit ESPacketCutter(unsigned int synw_word) throw()
20 | {
21 | _syncWordSize = 4;
22 | *(unsigned int*)&_syncWord[0] = synw_word;
23 | }
24 | explicit ESPacketCutter(unsigned char* sync_word,unsigned word_size) throw()
25 | {
26 | _syncWordSize = word_size;
27 | memcpy(_syncWord,sync_word,word_size);
28 | }
29 |
30 | public:
31 | bool Parse(unsigned char* buf,unsigned bufSize) throw();
32 |
33 | unsigned GetFrameCount() const throw() { return _frames.GetCount(); }
34 | bool GetFrame(unsigned index,unsigned* offset,unsigned* size) throw();
35 |
36 | private:
37 | int FindNextSyncWord(unsigned char* buffer,unsigned size);
38 |
39 | private:
40 | unsigned char _syncWord[64];
41 | unsigned _syncWordSize;
42 |
43 | struct Frame
44 | {
45 | unsigned offset;
46 | unsigned size;
47 | };
48 | AVUtils::List _frames;
49 | };
50 |
51 | #endif //__ES_PACKET_CUTTER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/H264_Misc.cpp:
--------------------------------------------------------------------------------
1 | #include "H264AnnexBParser.h"
2 |
3 | int H264_FindNALOffset(unsigned char* pb,unsigned len,H264_NALU_TYPE nal_type)
4 | {
5 | H264AnnexBParser parser;
6 | if (!parser.InitFromStartCode(pb,len))
7 | return -1;
8 |
9 | if (parser.GetCurrentNaluType() == nal_type)
10 | return (int)parser.GetCurrentOffset();
11 |
12 | while (1)
13 | {
14 | if (!parser.ReadNext())
15 | return -1;
16 |
17 | if (parser.GetCurrentNaluType() == nal_type)
18 | return (int)parser.GetCurrentOffset();
19 |
20 | if (parser.IsParseEOF())
21 | break;
22 | }
23 |
24 | return -1;
25 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/H264_SPS_Parser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Utils/H264_SPS_Parser.cpp
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/HEVCAnnexBParser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Utils/HEVCAnnexBParser.cpp
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/HVC1mkvToAnnexB.h:
--------------------------------------------------------------------------------
1 | #ifndef __HVC1_MKV_TO_ANNEXB_H
2 | #define __HVC1_MKV_TO_ANNEXB_H
3 |
4 | #define HVC1_DCR_HEAD_LENGTH_BYTES 22
5 |
6 | struct HEVCDecoderConfigurationRecordHead
7 | {
8 | unsigned configuration_version; //8b
9 | unsigned general_profile_space; //2b
10 | unsigned general_tier_flag; //1b
11 | unsigned general_profile_idc; //5b
12 | unsigned general_profile_compatibility_flag; //32b
13 | unsigned general_progressive_source_flag; //1b
14 | unsigned general_interlace_source_flag; //1b
15 | unsigned general_non_packed_constraint_flag; //1b
16 | unsigned general_frame_only_constraint_flag; //1b
17 | //Reserved for 44b
18 | unsigned general_level_idc; //8b
19 | //Reserved for 4b
20 | unsigned min_spatial_segmentation_idc; //12b
21 | //Reserved for 6b
22 | unsigned Parallelism_type; //2b
23 | //Reserved for 6b
24 | unsigned chroma_format_idc; //2b
25 | //Reserved for 5b
26 | unsigned bit_depth_luma_minus8; //3b
27 | //Reserved for 5b
28 | unsigned bit_depth_chroma_minus8; //3b
29 | //Reserved for 18b
30 | unsigned max_sub_layers; //3b
31 | unsigned temporal_id_nesting_flag; //1b
32 | unsigned size_nalu_minus_one; //2b
33 | };
34 |
35 | unsigned ParseHEVCDecoderConfigurationRecordHead(unsigned char* pb,unsigned len,HEVCDecoderConfigurationRecordHead* head);
36 | unsigned StripHEVCNaluArrays(unsigned char* pb,unsigned char* nal_annexB,unsigned max_nal_size = 2048);
37 |
38 | #endif //__HVC1_MKV_TO_ANNEXB_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/IOReader/IOPoolReader.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Utils/IOReader/IOPoolReader.cpp
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/IOWriter/IOPoolWriter.h:
--------------------------------------------------------------------------------
1 | #ifndef __IO_POOL_WRITER_H
2 | #define __IO_POOL_WRITER_H
3 |
4 | #include
5 | #include
6 | #include "MediaAVIO.h"
7 |
8 | class IOPoolWriter : public IAVMediaIO
9 | {
10 | public:
11 | IOPoolWriter(IAVMediaIO* pDelegateIO,unsigned BufferSize) throw() : _buffer(nullptr), _offset(0)
12 | { _io = pDelegateIO; _buf_size = BufferSize; }
13 | virtual ~IOPoolWriter() throw()
14 | { if (_buffer) free(_buffer); }
15 |
16 | public:
17 | unsigned Read(void* pb,unsigned size) { return 0; }
18 | unsigned Write(void* pb,unsigned size);
19 | bool Seek(long long offset,int whence);
20 | long long Tell() { return _io->Tell() + _offset; }
21 | long long GetSize() { return _io->GetSize() + _offset; }
22 | bool GetPlatformSpec(void** pp,int* spec_code) { return _io->GetPlatformSpec(pp,spec_code); }
23 |
24 | private:
25 | bool BufferStartup();
26 | void WriteSmall(unsigned char* dst,unsigned char* src,unsigned size);
27 |
28 | private:
29 | IAVMediaIO* _io;
30 | unsigned _buf_size;
31 |
32 | unsigned char* _buffer;
33 | unsigned _offset;
34 | };
35 |
36 | #endif //__IO_POOL_WRITER_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/MiscUtils.h:
--------------------------------------------------------------------------------
1 | unsigned short MakeAACAudioSpecificConfig(unsigned audioObjectType,unsigned samplingFrequency,unsigned channelConfiguration);
2 | int ParseMKVOggXiphHeader(unsigned char* buf,unsigned size,unsigned* h1size,unsigned* h2size,unsigned* h3size);
3 | int MemorySearch(const unsigned char* buf,unsigned bufSize,const unsigned char* search,unsigned searchSize);
4 | char* msvc_strlwr(char* s);
5 | char* msvc_strupr(char* s);
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/SimpleContainers/Buffer.cpp:
--------------------------------------------------------------------------------
1 | #include "Buffer.h"
2 |
3 | #define ALLOC_ALIGNED(x) ((((x) >> 2) << 2) + 8)
4 |
5 | using namespace AVUtils;
6 |
7 | bool Buffer::Alloc(unsigned init_size,bool zero_mem) throw()
8 | {
9 | _core.TrueSize = init_size;
10 | if (init_size > _core.InternalSize)
11 | {
12 | Free();
13 |
14 | _core.Pointer = malloc(ALLOC_ALIGNED(init_size));
15 | _core.InternalSize = _core.TrueSize = init_size;
16 | }
17 |
18 | if (_core.Pointer && zero_mem)
19 | memset(_core.Pointer,0,_core.TrueSize);
20 |
21 | return _core.Pointer != nullptr;
22 | }
23 |
24 | bool Buffer::Realloc(unsigned new_size) throw()
25 | {
26 | if (new_size < _core.InternalSize)
27 | return Alloc(new_size,true);
28 | if (_core.Pointer == nullptr)
29 | return Alloc(new_size,true);
30 |
31 | _core.Pointer = realloc(_core.Pointer,ALLOC_ALIGNED(new_size));
32 | _core.InternalSize = _core.TrueSize = new_size;
33 |
34 | return _core.Pointer != nullptr;
35 | }
36 |
37 | void Buffer::Free() throw()
38 | {
39 | if (_core.Pointer)
40 | free(_core.Pointer);
41 |
42 | memset(&_core,0,sizeof(_core));
43 | }
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/SimpleContainers/Buffer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Utils/SimpleContainers/Buffer.h
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/SimpleContainers/List.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Utils/SimpleContainers/List.h
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/SimpleContainers/Queue.h:
--------------------------------------------------------------------------------
1 | #ifndef __AV_UTIL_QUEUE_H
2 | #define __AV_UTIL_QUEUE_H
3 |
4 | #include "List.h"
5 |
6 | namespace AVUtils {
7 |
8 | template
9 | class Queue : public List
10 | {
11 | public:
12 | Queue() : _index(0) {}
13 |
14 | inline bool Enqueue(T* item) throw() { return AddItem(item); }
15 | bool Dequeue(T** item) throw()
16 | {
17 | if (item == nullptr)
18 | return false;
19 | if (_index >= _count)
20 | return false;
21 |
22 | *item = GetItem(_index);
23 | _index++;
24 | return true;
25 | }
26 |
27 | T* Peek() throw()
28 | {
29 | if (_index >= _count)
30 | return nullptr;
31 | if (_count == 0)
32 | return nullptr;
33 |
34 | return GetItem(0);
35 | }
36 | T* Last() throw()
37 | {
38 | if (_index >= _count)
39 | return nullptr;
40 | if (_count == 0)
41 | return nullptr;
42 |
43 | return GetItem(_count - 1);
44 | }
45 |
46 | void Clear() throw()
47 | {
48 | _index = 0;
49 | ClearItems();
50 | }
51 |
52 | inline unsigned GetCount() const throw() { return _count - _index; }
53 | inline bool IsEmpty() const throw() { return (_count - _index) > 0; }
54 |
55 | private:
56 | unsigned _index;
57 | };
58 |
59 | } //AVUtils
60 |
61 | #endif //__AV_UTIL_QUEUE_H
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/stagefright/ABase.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef A_BASE_H_
18 |
19 | #define A_BASE_H_
20 |
21 | #include
22 |
23 | #define DISALLOW_EVIL_CONSTRUCTORS(name) \
24 | name(const name &); \
25 | name &operator=(const name &)
26 |
27 | #endif // A_BASE_H_
28 |
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/stagefright/H264Golomb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Exp-golomb code Parser
3 | * Author: K.F Yang
4 | */
5 |
6 | #ifndef H264GOLOMB_H_
7 | #define H264GOLOMB_H_
8 |
9 | #include "ABitReader.h"
10 |
11 | namespace stagefright {
12 | namespace H264Golomb {
13 |
14 | static inline unsigned H264U(stagefright::ABitReader& br,unsigned bits)
15 | {
16 | return br.getBits(bits);
17 | }
18 |
19 | static unsigned H264UE(stagefright::ABitReader& br)
20 | {
21 | unsigned numZero = 0;
22 | while (br.getBits(1) == 0)
23 | ++numZero;
24 |
25 | unsigned x = br.getBits(numZero);
26 | return x + (1U << numZero) - 1;
27 | }
28 |
29 | static int H264SE(stagefright::ABitReader& br)
30 | {
31 | unsigned u = H264UE(br);
32 | if ((u & 0x01) == 0)
33 | {
34 | u >>= 1;
35 | int ret = 0 - u;
36 | return ret;
37 | }
38 |
39 | return (u + 1) >> 1;
40 | }
41 |
42 | }}
43 |
44 | #endif
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/stagefright/H264Parser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreCommon/CoreCommon.Shared/Utils/stagefright/H264Parser.cpp
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.Shared/Utils/stagefright/H264Parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * H264 SPS Parser
3 | * Author: K.F Yang
4 | */
5 |
6 | #ifndef H264PARSER_H_
7 | #define H264PARSER_H_
8 |
9 | #include "ABitReader.h"
10 | #include "H264Golomb.h"
11 |
12 | namespace stagefright {
13 | namespace H264Parser {
14 |
15 | struct AVCExtraInfo
16 | {
17 | unsigned profile;
18 | unsigned profile_level;
19 | unsigned ref_frames;
20 | unsigned bit_depth; //+8
21 | unsigned width, height;
22 | unsigned ar_width, ar_height;
23 | unsigned fps_den, fps_num;
24 | enum ChromaSubsampling
25 | {
26 | ChromaFUnknown = 0,
27 | ChromaF420, //default
28 | ChromaF422,
29 | ChromaF444
30 | };
31 | ChromaSubsampling chroma_format;
32 | int progressive_flag;
33 | int fixed_fps_flag;
34 | int mbaff_flag; //if progressive_flag is no set.
35 | int full_range_flag;
36 | enum PictureCodingMode //from PPS.
37 | {
38 | CodingModeUnknown = 0,
39 | CodingModeCAVLC,
40 | CodingModeCABAC
41 | };
42 | PictureCodingMode coding_mode;
43 | unsigned slice_group_count;
44 | };
45 |
46 | void ParseH264SPS(unsigned char* pb,unsigned len,AVCExtraInfo* info);
47 | void ParseH264PPS(unsigned char* pb,unsigned len,AVCExtraInfo* info);
48 |
49 | }}
50 |
51 | #endif
--------------------------------------------------------------------------------
/CoreCommon/CoreCommon.UWP/CoreCommon.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Desktop/CoreDemuxers.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVDemuxer.cpp:
--------------------------------------------------------------------------------
1 | #include "FLVMediaFormat.h"
2 |
3 | IAVMediaFormat* CreateFLVMediaDemuxer()
4 | {
5 | IAVMediaFormat* parser = new (std::nothrow)FLVMediaFormat();
6 | return parser;
7 | }
8 |
9 | std::shared_ptr CreateFLVMediaDemuxerSP()
10 | {
11 | auto parser = std::make_shared();
12 | return parser;
13 | }
14 |
15 | bool CheckFileStreamFLV(IAVMediaIO* pIo)
16 | {
17 | if (!pIo->IsAliveStream())
18 | if (pIo->GetSize() < 128)
19 | return false;
20 |
21 | unsigned char head[4] = {};
22 |
23 | pIo->Seek(0,SEEK_SET);
24 | if (pIo->Read(&head,4) != 4)
25 | return false;
26 |
27 | if (head[0] == 'F' &&
28 | head[1] == 'L' &&
29 | head[2] == 'V' &&
30 | head[3] == 1)
31 | return true;
32 |
33 | return false;
34 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVMediaFormat.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVMediaFormat.h
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVMediaFormat_AVIO.cpp:
--------------------------------------------------------------------------------
1 | #include "FLVMediaFormat.h"
2 |
3 | int FLVMediaFormat::Read(void* pb,int len)
4 | {
5 | if (_av_io == nullptr)
6 | return 0;
7 |
8 | return _av_io->Read(pb,len);
9 | }
10 |
11 | bool FLVMediaFormat::Seek(long long pos)
12 | {
13 | if (_av_io == nullptr)
14 | return false;
15 |
16 | return _av_io->Seek(pos,SEEK_SET);
17 | }
18 |
19 | bool FLVMediaFormat::SeekByCurrent(long long pos)
20 | {
21 | if (_av_io == nullptr)
22 | return false;
23 |
24 | return _av_io->Seek(pos,SEEK_CUR);
25 | }
26 |
27 | long long FLVMediaFormat::GetSize()
28 | {
29 | if (_av_io == nullptr)
30 | return 0;
31 |
32 | return _av_io->GetSize();
33 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVMediaFormat_MkKeyFrames.cpp:
--------------------------------------------------------------------------------
1 | #include "FLVMediaFormat.h"
2 |
3 | bool FLVMediaFormat::FindAndMakeKeyFrames()
4 | {
5 | if (_parser->Reset() != PARSER_FLV_OK)
6 | return false;
7 |
8 | shared_memory_ptr
9 | index(sizeof(FLVParser::FLV_INTERNAL_KEY_FRAME_INDEX) * 1024);
10 |
11 | unsigned count = 0;
12 | unsigned size = 1024;
13 | while (1)
14 | {
15 | FLVParser::FLV_STREAM_PACKET packet = {};
16 | if (_parser->ReadNextPacketFast(&packet) != PARSER_FLV_OK)
17 | break;
18 |
19 | if (packet.type != FLVParser::PacketTypeVideo ||
20 | packet.key_frame == 0 ||
21 | packet.data_size == 0)
22 | continue;
23 |
24 | (index.ptr() + count)->time = (double)packet.timestamp / (double)1000.0;
25 | (index.ptr() + count)->pos = _av_io->Tell() - packet.data_size - sizeof(FLVParser::FLV_TAG);
26 |
27 | count++;
28 |
29 | if (count == size)
30 | {
31 | size *= 2;
32 | size *= sizeof(FLVParser::FLV_INTERNAL_KEY_FRAME_INDEX);
33 |
34 | if (!index.realloc(size))
35 | {
36 | count = 0;
37 | break;
38 | }
39 | }
40 | }
41 |
42 | if (count > 0)
43 | {
44 | _keyframe_count = count;
45 | _keyframe_index = (FLVParser::FLV_INTERNAL_KEY_FRAME_INDEX*)
46 | malloc((count + 1) * sizeof(FLVParser::FLV_INTERNAL_KEY_FRAME_INDEX));
47 |
48 | memcpy(_keyframe_index,index.ptr(),count * sizeof(FLVParser::FLV_INTERNAL_KEY_FRAME_INDEX));
49 | }
50 |
51 | _parser->Reset();
52 | return true;
53 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVMediaStream.cpp:
--------------------------------------------------------------------------------
1 | #include "FLVMediaStream.h"
2 |
3 | FLVMediaStream::FLVMediaStream(std::shared_ptr& audio_desc,MediaCodecType codec_type) throw()
4 | {
5 | _stream_index = 0;
6 |
7 | _main_type = MediaMainType::MEDIA_MAIN_TYPE_AUDIO;
8 | _codec_type = codec_type;
9 |
10 | _audio_desc = audio_desc;
11 | }
12 |
13 | FLVMediaStream::FLVMediaStream(std::shared_ptr& video_desc,MediaCodecType codec_type,float fps) throw()
14 | {
15 | _stream_index = 1;
16 |
17 | _main_type = MediaMainType::MEDIA_MAIN_TYPE_VIDEO;
18 | _codec_type = codec_type;
19 |
20 | _video_desc = video_desc;
21 | _fps = fps;
22 | }
23 |
24 | MediaMainType FLVMediaStream::GetMainType()
25 | {
26 | return _main_type;
27 | }
28 |
29 | MediaCodecType FLVMediaStream::GetCodecType()
30 | {
31 | return _codec_type;
32 | }
33 |
34 | int FLVMediaStream::GetStreamIndex()
35 | {
36 | return _stream_index;
37 | }
38 |
39 | const char* FLVMediaStream::GetStreamName()
40 | {
41 | return _main_type == MEDIA_MAIN_TYPE_AUDIO ?
42 | "FLV Audio Stream":"FLV Video Stream";
43 | }
44 |
45 | IAudioDescription* FLVMediaStream::GetAudioInfo()
46 | {
47 | if (_main_type != MediaMainType::MEDIA_MAIN_TYPE_AUDIO)
48 | return nullptr;
49 |
50 | return _audio_desc.get();
51 | }
52 |
53 | IVideoDescription* FLVMediaStream::GetVideoInfo()
54 | {
55 | if (_main_type != MediaMainType::MEDIA_MAIN_TYPE_VIDEO)
56 | return nullptr;
57 |
58 | return _video_desc.get();
59 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/FLVMediaStream.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __FLV_MEDIA_STREAM_H
6 | #define __FLV_MEDIA_STREAM_H
7 |
8 | #include "FLVMediaFormat.h"
9 |
10 | class FLVMediaStream : public IAVMediaStream
11 | {
12 | public:
13 | FLVMediaStream
14 | (std::shared_ptr& audio_desc,MediaCodecType codec_type) throw();
15 | FLVMediaStream
16 | (std::shared_ptr& video_desc,MediaCodecType codec_type,float fps) throw();
17 |
18 | public:
19 | MediaMainType GetMainType();
20 | MediaCodecType GetCodecType();
21 |
22 | int GetStreamIndex();
23 | const char* GetStreamName();
24 |
25 | float GetContainerFps() { return _fps; }
26 |
27 | IAudioDescription* GetAudioInfo();
28 | IVideoDescription* GetVideoInfo();
29 |
30 | private:
31 | MediaMainType _main_type;
32 | MediaCodecType _codec_type;
33 |
34 | int _stream_index;
35 | float _fps;
36 |
37 | std::shared_ptr _audio_desc;
38 | std::shared_ptr _video_desc;
39 | };
40 |
41 | #endif //__FLV_MEDIA_STREAM_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/Parser/FLVBoxSpec.h:
--------------------------------------------------------------------------------
1 | /*
2 | - FLV Stream Parser (Muxer Box Spec Head) -
3 |
4 | - Author: K.F Yang
5 | - Date: 2014-12-25
6 | */
7 |
8 | #ifndef __FLV_BOX_SPEC_H
9 | #define __FLV_BOX_SPEC_H
10 |
11 | #define FLV_MUXER_OBJECT "onMetaData"
12 |
13 | #define FLV_MUXER_NAME "metadatacreator"
14 |
15 | #define FLV_MUXER_WIDTH "width"
16 | #define FLV_MUXER_HEIGHT "height"
17 | #define FLV_MUXER_DURATION "duration"
18 |
19 | #define FLV_MUXER_KEY_FRAMES "keyframes" //Object.
20 | #define FLV_MUXER_KEY_FRAMES_TIMESTAMP "times"
21 | #define FLV_MUXER_KEY_FRAMES_BYTEOFFSET "filepositions"
22 |
23 | #endif //__FLV_BOX_SPEC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/Parser/FLVMetaSpec.h:
--------------------------------------------------------------------------------
1 | #ifndef __FLV_META_SPEC_H
2 | #define __FLV_META_SPEC_H
3 |
4 | #define FLV_META_OBJECT_SEPC "onMetaData"
5 |
6 | #define FLV_META_AUDIO_CODEC_ID_NUMBER "audiocodecid"
7 | #define FLV_META_AUDIO_DATA_RATE_NUMBER "audiodatarate"
8 | #define FLV_META_AUDIO_SAMPLE_RATE_NUMBER "audiosamplerate"
9 | #define FLV_META_AUDIO_SAMPLE_SIZE_NUMBER "audiosamplesize"
10 | #define FLV_META_AUDIO_CH_TYPE_BOOL "stereo"
11 |
12 | #define FLV_META_VIDEO_CODEC_ID_NUMBER "videocodecid"
13 | #define FLV_META_VIDEO_DATA_RATE_NUMBER "videodatarate"
14 | #define FLV_META_VIDEO_FRAME_RATE_NUMBER "framerate"
15 | #define FLV_META_VIDEO_FRAME_WIDTH_NUMBER "width"
16 | #define FLV_META_VIDEO_FRAME_HEIGHT_NUMBER "height"
17 |
18 | #define FLV_META_FILE_DURATION_NUMBER "duration"
19 | #define FLV_META_FILE_SIZE_NUMBER "filesize"
20 | #define FLV_META_FILE_CREATION_DATA_STRING "creationdate"
21 |
22 | #define FLV_META_KEY_FRAMES "keyframes" //OBJECT
23 | #define FLV_META_KEY_FRAMES_TIMESTAMP "times"
24 | #define FLV_META_KEY_FRAMES_BYTEOFFSET "filepositions"
25 |
26 | #endif //__FLV_META_SPEC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/Parser/FLVParser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/FLV/Parser/FLVParser.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/Parser/FLVParserErrSpec.h:
--------------------------------------------------------------------------------
1 | #ifndef __FLV_PARSER_ERR_SPEC_H
2 | #define __FLV_PARSER_ERR_SPEC_H
3 |
4 | #define PARSER_FLV_OK 0
5 |
6 | #define PARSER_FLV_ERR_UNEXPECTED 0xFFFFFFFF
7 | #define PARSER_FLV_ERR_UNKNOWN 0xFFFFFFFE
8 | #define PARSER_FLV_ERR_HEAD_INVALID (PARSER_FLV_ERR_UNKNOWN - 1)
9 |
10 | #define PARSER_FLV_ERR_METADATA_MISS (PARSER_FLV_ERR_HEAD_INVALID - 1)
11 | #define PARSER_FLV_ERR_METADATA_INVALID (PARSER_FLV_ERR_METADATA_MISS - 1)
12 |
13 | #define PARSER_FLV_ERR_NON_VIDEO_STREAM (PARSER_FLV_ERR_METADATA_INVALID - 1)
14 | #define PARSER_FLV_ERR_NON_AUDIO_STREAM (PARSER_FLV_ERR_NON_VIDEO_STREAM - 1)
15 |
16 | #define PARSER_FLV_ERR_VIDEO_STREAM_UNSUPPORTED (PARSER_FLV_ERR_NON_AUDIO_STREAM - 1)
17 | #define PARSER_FLV_ERR_AUDIO_STREAM_UNSUPPORTED (PARSER_FLV_ERR_VIDEO_STREAM_UNSUPPORTED - 1)
18 | #define PARSER_FLV_ERR_VIDEO_H263_STREAM_UNSUPPORTED (PARSER_FLV_ERR_VIDEO_STREAM_UNSUPPORTED - 2)
19 |
20 | #define PARSER_FLV_ERR_NON_KEY_FRAME_INDEX (PARSER_FLV_ERR_UNKNOWN - 100)
21 | #define PARSER_FLV_ERR_NON_MORE_PACKET (PARSER_FLV_ERR_UNKNOWN - 200)
22 |
23 | #define PARSER_FLV_ERR_NOT_OPENED (PARSER_FLV_ERR_UNKNOWN - 101)
24 | #define PARSER_FLV_ERR_PARSE_FAILED (PARSER_FLV_ERR_UNKNOWN - 102)
25 | #define PARSER_FLV_ERR_BAD_ALLOC (PARSER_FLV_ERR_UNKNOWN - 103)
26 |
27 | #define PARSER_FLV_ERR_IO_READ_FAILED (PARSER_FLV_ERR_UNKNOWN - 201)
28 | #define PARSER_FLV_ERR_IO_SEEK_FAILED (PARSER_FLV_ERR_UNKNOWN - 202)
29 | #define PARSER_FLV_ERR_IO_DATA_INVALID (PARSER_FLV_ERR_UNKNOWN - 203)
30 |
31 | #endif //__FLV_PARSER_ERR_SPEC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/FLV/Parser/FLVParserIO.h:
--------------------------------------------------------------------------------
1 | #ifndef __FLV_PARSER_IO_INTERFACE_H
2 | #define __FLV_PARSER_IO_INTERFACE_H
3 |
4 | namespace FLVParser{
5 |
6 | class IFLVParserIO
7 | {
8 | public:
9 | virtual int Read(void*,int) = 0;
10 | virtual bool Seek(long long) = 0;
11 | virtual bool SeekByCurrent(long long)
12 | {
13 | return false; //not impl.
14 | }
15 | virtual long long GetSize()
16 | {
17 | return -1; //not impl.
18 | }
19 | protected:
20 | virtual ~IFLVParserIO() {}
21 | };
22 |
23 | } //FLVParser namespace.
24 |
25 | #endif //__FLV_PARSER_IO_INTERFACE_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVDemuxer.cpp:
--------------------------------------------------------------------------------
1 | #include "MKVMediaFormat.h"
2 |
3 | IAVMediaFormat* CreateMKVMediaDemuxer()
4 | {
5 | IAVMediaFormat* parser = new (std::nothrow)MKVMediaFormat();
6 | return parser;
7 | }
8 |
9 | std::shared_ptr CreateMKVMediaDemuxerSP()
10 | {
11 | auto parser = std::make_shared();
12 | return parser;
13 | }
14 |
15 | bool CheckFileStreamMKV(IAVMediaIO* pIo)
16 | {
17 | if (!pIo->IsAliveStream())
18 | if (pIo->GetSize() < 128)
19 | return false;
20 |
21 | unsigned char head[4] = {};
22 |
23 | pIo->Seek(0,SEEK_SET);
24 | if (pIo->Read(&head,4) != 4)
25 | return false;
26 |
27 | if (head[0] == 0x1A &&
28 | head[1] == 0x45 &&
29 | head[2] == 0xDF &&
30 | head[3] == 0xA3)
31 | return true;
32 |
33 | return false;
34 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaFormat.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaFormat.h
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaFormat_AVIO.cpp:
--------------------------------------------------------------------------------
1 | #include "MKVMediaFormat.h"
2 |
3 | unsigned MKVMediaFormat::Read(void* buf,unsigned size)
4 | {
5 | if (_av_io == nullptr)
6 | return 0;
7 |
8 | return _av_io->Read(buf,size);
9 | }
10 |
11 | bool MKVMediaFormat::Seek(long long offset,int whence)
12 | {
13 | if (_av_io == nullptr)
14 | return false;
15 |
16 | return _av_io->Seek(offset,whence);
17 | }
18 |
19 | long long MKVMediaFormat::Tell()
20 | {
21 | if (_av_io == nullptr)
22 | return -1;
23 |
24 | return _av_io->Tell();
25 | }
26 |
27 | long long MKVMediaFormat::GetSize()
28 | {
29 | if (_av_io == nullptr)
30 | return 0;
31 |
32 | return _av_io->GetSize();
33 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaFormat_Reader.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaFormat_Reader.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaStream.cpp:
--------------------------------------------------------------------------------
1 | #include "MKVMediaStream.h"
2 |
3 | MKVMediaStream::MKVMediaStream(MKVParser::MKVTrackInfo* info)
4 | {
5 | memset(&_info,0,sizeof(_info));
6 | memcpy(&_info,info,sizeof(_info));
7 |
8 | _ssa_ass_format = false;
9 | _frame_duration = _info.InternalFrameDuration;
10 | _real_cook_audio = _real_rv40_video = false;
11 | _has_bFrame = false;
12 | _decode_timestamp = 0.0;
13 | }
14 | const char* MKVMediaStream::GetStreamName()
15 | {
16 | if (_info.Name == nullptr ||
17 | strlen(_info.Name) == 0)
18 | return _info.Codec.CodecID;
19 |
20 | return _info.Name;
21 | }
22 |
23 | const char* MKVMediaStream::GetLanguageName()
24 | {
25 | if (strlen(_info.LangID) == 0)
26 | return "und";
27 | return _info.LangID;
28 | }
29 |
30 | IAudioDescription* MKVMediaStream::GetAudioInfo()
31 | {
32 | if (_main_type != MediaMainType::MEDIA_MAIN_TYPE_AUDIO)
33 | return nullptr;
34 |
35 | return _audio_desc.get();
36 | }
37 |
38 | IVideoDescription* MKVMediaStream::GetVideoInfo()
39 | {
40 | if (_main_type != MediaMainType::MEDIA_MAIN_TYPE_VIDEO)
41 | return nullptr;
42 |
43 | return _video_desc.get();
44 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaStream_Audio.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaStream_Audio.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaStream_Video.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/MKVMediaStream_Video.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/AlacCalcEngine.cpp:
--------------------------------------------------------------------------------
1 | #include "AlacCalcEngine.h"
2 |
3 | bool AlacDurationCalcParser::Initialize(unsigned char* extradata,unsigned len)
4 | {
5 | if (extradata == nullptr || len < 24)
6 | return false;
7 |
8 | unsigned frameLength = DURATION_CALC_SWAP32(*(unsigned*)extradata);
9 | unsigned sampleRate = DURATION_CALC_SWAP32(*(unsigned*)(extradata + 20));
10 | if (frameLength < 128 || frameLength > 32768)
11 | return false;
12 | if (sampleRate == 0)
13 | return false;
14 |
15 | duration = (double)frameLength / (double)sampleRate;
16 | return true;
17 | }
18 |
19 | bool AlacDurationCalcParser::Calc(unsigned char* buf,unsigned size,double* time)
20 | {
21 | if (buf == nullptr || size == 0)
22 | return false;
23 |
24 | *time = duration;
25 | return true;
26 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/AlacCalcEngine.h:
--------------------------------------------------------------------------------
1 | #ifndef _ALAC_DURATION_CALC_H
2 | #define _ALAC_DURATION_CALC_H
3 |
4 | #include "DurationCalcInterface.h"
5 |
6 | class AlacDurationCalcParser : public IDurationCalc
7 | {
8 | double duration;
9 |
10 | public:
11 | bool Initialize(unsigned char* extradata,unsigned len);
12 | bool Calc(unsigned char* buf,unsigned size,double* time);
13 | void DeleteMe() { delete this; }
14 | };
15 |
16 | inline IDurationCalc* CreateAlacDurationCalcEngine() throw()
17 | {
18 | return new AlacDurationCalcParser();
19 | }
20 |
21 | #endif //_ALAC_DURATION_CALC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/DurationCalcInterface.h:
--------------------------------------------------------------------------------
1 | #ifndef _DURATION_CALC_INTERFACE_H
2 | #define _DURATION_CALC_INTERFACE_H
3 |
4 | #define DURATION_CALC_SWAP16(x) \
5 | ((((x) & 0xFF00U) >> 8) | (((x) & 0x00FFU) << 8))
6 | #define DURATION_CALC_SWAP32(x) \
7 | ((((x) & 0xFF000000UL) >> 24) | (((x) & 0x00FF0000UL) >> 8) | \
8 | (((x) & 0x0000FF00UL) << 8) | (((x) & 0x000000FFUL) << 24))
9 |
10 | struct IDurationCalc
11 | {
12 | virtual bool Initialize(unsigned char* extradata = nullptr,unsigned len = 0) = 0;
13 | virtual void SetDefaultTimestamp(double timestamp) {}
14 | virtual bool Calc(unsigned char* buf,unsigned size,double* time) = 0;
15 | virtual void DeleteMe() = 0;
16 | };
17 |
18 | #endif //_DURATION_CALC_INTERFACE_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/FlacCalcEngine.h:
--------------------------------------------------------------------------------
1 | #ifndef _FLAC_DURATION_CALC_H
2 | #define _FLAC_DURATION_CALC_H
3 |
4 | #include "DurationCalcInterface.h"
5 |
6 | class FlacDurationCalcParser : public IDurationCalc
7 | {
8 | unsigned short _maxBlockSize, _minBlockSize;
9 | unsigned _nch, _rate;
10 |
11 | public:
12 | bool Initialize(unsigned char* extradata,unsigned len);
13 | bool Calc(unsigned char* buf,unsigned size,double* time);
14 | void DeleteMe() { delete this; }
15 | };
16 |
17 | inline IDurationCalc* CreateFlacDurationCalcEngine() throw()
18 | {
19 | return new FlacDurationCalcParser();
20 | }
21 |
22 | #endif //_FLAC_DURATION_CALC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/OpusCalcEngine.cpp:
--------------------------------------------------------------------------------
1 | #include "OpusCalcEngine.h"
2 | #include "OpusHelp.h"
3 | #include
4 | #include
5 |
6 | bool OpusDurationCalcParser::Initialize(unsigned char* extradata,unsigned len)
7 | {
8 | if (extradata == nullptr || len < 16)
9 | return false;
10 |
11 | char buf[10] = {};
12 | memcpy(buf,extradata,8);
13 |
14 | if (strcmp(buf,"OpusHead") != 0)
15 | return false;
16 |
17 | _nch = extradata[9];
18 | _rate = *(unsigned*)&extradata[12];
19 | return true;
20 | }
21 |
22 | bool OpusDurationCalcParser::Calc(unsigned char* buf,unsigned size,double* time)
23 | {
24 | if (buf == nullptr || size == 0)
25 | return false;
26 |
27 | if (opus_packet_get_nb_channels(buf) != _nch)
28 | return false;
29 | int samples = opus_packet_get_nb_samples(buf,size,_rate);
30 | if (samples <= 0)
31 | return false;
32 |
33 | *time = (double)samples / (double)_rate;
34 | return true;
35 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/OpusCalcEngine.h:
--------------------------------------------------------------------------------
1 | #ifndef _OPUS_DURATION_CALC_H
2 | #define _OPUS_DURATION_CALC_H
3 |
4 | #include "DurationCalcInterface.h"
5 |
6 | class OpusDurationCalcParser : public IDurationCalc
7 | {
8 | unsigned _nch, _rate;
9 |
10 | public:
11 | bool Initialize(unsigned char* extradata,unsigned len);
12 | bool Calc(unsigned char* buf,unsigned size,double* time);
13 | void DeleteMe() { delete this; }
14 | };
15 |
16 | inline IDurationCalc* CreateOpusDurationCalcEngine() throw()
17 | {
18 | return new OpusDurationCalcParser();
19 | }
20 |
21 | #endif //_OPUS_DURATION_CALC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/OpusHelp.cpp:
--------------------------------------------------------------------------------
1 | int opus_packet_get_samples_per_frame(const unsigned char *data, int Fs)
2 | {
3 | int audiosize;
4 | if (data[0]&0x80)
5 | {
6 | audiosize = ((data[0]>>3)&0x3);
7 | audiosize = (Fs<>3)&0x3);
13 | if (audiosize == 3)
14 | audiosize = Fs*60/1000;
15 | else
16 | audiosize = (Fs< Fs*3)
53 | return -1;
54 | else
55 | return samples;
56 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/OpusHelp.h:
--------------------------------------------------------------------------------
1 | #ifndef _OPUS_HELP_H
2 | #define _OPUS_HELP_H
3 |
4 | int opus_packet_get_samples_per_frame(const unsigned char *data, int Fs);
5 | int opus_packet_get_nb_channels(const unsigned char *data);
6 | int opus_packet_get_nb_frames(const unsigned char packet[], int len);
7 | int opus_packet_get_nb_samples(const unsigned char packet[], int len, int Fs);
8 |
9 | #endif //_OPUS_HELP_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/PcmCalcEngine.cpp:
--------------------------------------------------------------------------------
1 | #include "PcmCalcEngine.h"
2 |
3 | bool PcmDurationCalcParser::Calc(unsigned char* buf,unsigned size,double* time)
4 | {
5 | if (size == 0)
6 | return false;
7 |
8 | unsigned samples = size / _blockAlign;
9 | *time = (double)samples / (double)_rate;
10 | return true;
11 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/PcmCalcEngine.h:
--------------------------------------------------------------------------------
1 | #ifndef _PCM_DURATION_CALC_H
2 | #define _PCM_DURATION_CALC_H
3 |
4 | #include "DurationCalcInterface.h"
5 |
6 | class PcmDurationCalcParser : public IDurationCalc
7 | {
8 | unsigned _blockAlign;
9 | unsigned _nch, _rate, _bits;
10 | bool _float;
11 |
12 | public:
13 | PcmDurationCalcParser(unsigned nch,unsigned rate,unsigned bits,bool ieee_float) throw() :
14 | _nch(nch),
15 | _rate(rate),
16 | _bits(bits),
17 | _float(ieee_float) {}
18 |
19 | public:
20 | bool Initialize(unsigned char* extradata,unsigned len) { _blockAlign = _nch * (_bits / 8); return true; }
21 | bool Calc(unsigned char* buf,unsigned size,double* time);
22 | void DeleteMe() { delete this; }
23 | };
24 |
25 | inline IDurationCalc* CreatePcmDurationCalcEngine(unsigned nch,unsigned rate,unsigned bits,bool ieee_float) throw()
26 | {
27 | if (nch == 0 || rate == 0 || bits == 0)
28 | return nullptr;
29 | return new PcmDurationCalcParser(nch,rate,bits,ieee_float);
30 | }
31 |
32 | #endif //_PCM_DURATION_CALC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Duration/VorbisCalcEngine.h:
--------------------------------------------------------------------------------
1 | #ifndef _VORBIS_DURATION_CALC_H
2 | #define _VORBIS_DURATION_CALC_H
3 |
4 | #include "DurationCalcInterface.h"
5 | #include "vorbis/codec.h"
6 |
7 | #ifndef _MKV_PARSER_NOUSE_VORBIS
8 | class VorbisDurationCalcParser : public IDurationCalc
9 | {
10 | vorbis_info _vi;
11 | vorbis_comment _vc;
12 |
13 | unsigned _blockSize0, _blockSize1;
14 | unsigned _prev_blocksize;
15 |
16 | public:
17 | bool Initialize(unsigned char* extradata,unsigned len);
18 | bool Calc(unsigned char* buf,unsigned size,double* time);
19 | void DeleteMe()
20 | {
21 | if (_vi.channels > 0)
22 | {
23 | vorbis_comment_clear(&_vc);
24 | vorbis_info_clear(&_vi);
25 | }
26 | delete this;
27 | }
28 | };
29 | #endif
30 |
31 | inline IDurationCalc* CreateVorbisDurationCalcEngine() throw()
32 | {
33 | #ifndef _MKV_PARSER_NOUSE_VORBIS
34 | return new VorbisDurationCalcParser();
35 | #else
36 | return nullptr;
37 | #endif
38 | }
39 |
40 | #endif //_VORBIS_DURATION_CALC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaDataSource.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_DATA_SOURCE_H
2 | #define _MATROSKA_DATA_SOURCE_H
3 |
4 | #define MKV_DATA_SOURCE_READ_ERROR -1
5 | #define MKV_DATA_SOURCE_SEEK_ERROR 0
6 |
7 | #include
8 |
9 | namespace MKV {
10 | namespace DataSource {
11 |
12 | struct IDataSource
13 | {
14 | virtual int Read(void* buffer,unsigned size = 1) = 0;
15 | virtual int Seek(long long offset,int whence = SEEK_SET) = 0;
16 |
17 | virtual long long Tell() = 0;
18 | virtual long long Size() = 0;
19 | protected:
20 | virtual ~IDataSource() {}
21 | };
22 |
23 | inline long long SizeToAbsolutePosition(long long size,IDataSource* dataSource)
24 | {
25 | return dataSource->Tell() + size;
26 | }
27 | inline bool IsCurrentPosition(long long pos,IDataSource* dataSource)
28 | {
29 | return dataSource->Tell() >= pos;
30 | }
31 | inline void ResetInSkipOffsetError(long long endPos,IDataSource* dataSource)
32 | {
33 | if (dataSource->Tell() > endPos)
34 | dataSource->Seek(endPos);
35 | }
36 |
37 | }} //MKV::DataSource.
38 |
39 | #endif //_MATROSKA_DATA_SOURCE_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaEbml.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaEbml.h
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaEbmlCore.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_EBML_CORE_H
2 | #define _MATROSKA_EBML_CORE_H
3 |
4 | #include "MatroskaDataSource.h"
5 |
6 | #define INVALID_EBML_ID 0
7 | #define INVALID_EBML_SIZE -1
8 |
9 | namespace MKV {
10 | namespace EBML {
11 | namespace Core {
12 |
13 | int ParseByteZeroBitsNum(unsigned char value);
14 | int StripZeroBitInNum(unsigned char value,int num);
15 |
16 | int GetVIntLength(unsigned char entry);
17 |
18 | unsigned GetEbmlId(DataSource::IDataSource* dataSource);
19 | long long GetEbmlSize(DataSource::IDataSource* dataSource);
20 |
21 | unsigned GetEbmlBytes(unsigned long long num);
22 | int SearchEbmlClusterStartCodeOffset(unsigned char* buf,unsigned size);
23 |
24 | }}} //MKV::EBML::Core.
25 |
26 | #endif //_MATROSKA_EBML_CORE_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternal.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternal.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternal.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternal.h
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalAttachmentContext.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_ATTACHMENT_CONTEXT_H
2 | #define _MATROSKA_INTERNAL_ATTACHMENT_CONTEXT_H
3 |
4 | #include "MatroskaEbml.h"
5 |
6 | namespace MKV {
7 | namespace Internal {
8 | namespace Object {
9 | namespace Context {
10 |
11 | struct AttachedFile
12 | {
13 | char* FileName; //UTF8
14 | char* FileDescription; //UTF8
15 | char FileMimeType[64];
16 | long long FileDataSize;
17 | long long OnAbsolutePosition;
18 |
19 | void ToDefault() throw()
20 | {
21 | FileName = FileDescription = nullptr;
22 | FileMimeType[0] = 0;
23 |
24 | FileDataSize = OnAbsolutePosition = 0;
25 | }
26 |
27 | void FreeResources() throw()
28 | {
29 | if (FileName != nullptr)
30 | {
31 | free(FileName);
32 | FileName = nullptr;
33 | }
34 |
35 | if (FileDescription != nullptr)
36 | {
37 | free(FileDescription);
38 | FileDescription = nullptr;
39 | }
40 | }
41 |
42 | bool CopyFrom(char* name,char* desc) throw()
43 | {
44 | if (name == nullptr)
45 | return false;
46 |
47 | FileName = strdup(name);
48 | if (desc && strlen(desc) > 0)
49 | FileDescription = strdup(desc);
50 |
51 | if (FileName == nullptr)
52 | return false;
53 |
54 | return true;
55 | }
56 | };
57 |
58 | }}}}
59 |
60 | #endif //_MATROSKA_INTERNAL_ATTACHMENT_CONTEXT_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalChapters.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_CHAPTERS_H
2 | #define _MATROSKA_INTERNAL_CHAPTERS_H
3 |
4 | #include "MatroskaList.h"
5 | #include "MatroskaEbml.h"
6 | #include "MatroskaInternalChapterContext.h"
7 |
8 | #define __DEFAULT_MKV_CHAPTERS 10
9 |
10 | namespace MKV {
11 | namespace Internal {
12 | namespace Object {
13 |
14 | class Chapters
15 | {
16 | public:
17 | explicit Chapters(EBML::EbmlHead& head) throw() : _head(head) {}
18 | ~Chapters()
19 | {
20 | for (unsigned i = 0;i < _list.GetCount();i++)
21 | _list.GetItem(i)->FreeResources();
22 | }
23 |
24 | public:
25 | bool ParseChapters(long long size) throw();
26 |
27 | unsigned GetChapterCount() throw() { return _list.GetCount(); }
28 | Context::ChapterAtom* GetChapter(unsigned index) throw()
29 | {
30 | if (index >= _list.GetCount())
31 | return nullptr;
32 |
33 | return _list.GetItem(index);
34 | }
35 |
36 | private:
37 | bool ParseEditionEntry(long long size) throw();
38 |
39 | bool ParseChapterAtom(Context::ChapterAtom& atom,long long size) throw();
40 | bool ParseChapterDisplay(Context::ChapterDisplay& display,long long size) throw();
41 |
42 | private:
43 | EBML::EbmlHead& _head;
44 | MatroskaList _list;
45 | };
46 |
47 | }}}
48 |
49 | #endif //_MATROSKA_INTERNAL_CHAPTERS_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalCluster.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalCluster.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalCluster.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalCluster.h
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalCueContext.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_CUE_CONTEXT_H
2 | #define _MATROSKA_INTERNAL_CUE_CONTEXT_H
3 |
4 | #include "MatroskaEbml.h"
5 |
6 | namespace MKV {
7 | namespace Internal {
8 | namespace Object {
9 | namespace Context {
10 |
11 | struct CueTrackPositions
12 | {
13 | unsigned CueTrack;
14 | long long CueClusterPosition;
15 | long long CueRelativePosition;
16 | long long CueDuration;
17 | long long CueBlockNumber;
18 |
19 | void ToDefault() throw()
20 | {
21 | CueTrack = 0;
22 |
23 | CueClusterPosition = CueRelativePosition = -1;
24 | CueDuration = 0;
25 | CueBlockNumber = 1;
26 | }
27 |
28 | void FreeResources() throw() {}
29 | };
30 |
31 | struct CuePoint
32 | {
33 | long long CueTime;
34 | CueTrackPositions Positions;
35 |
36 | void ToDefault() throw()
37 | {
38 | Positions.ToDefault();
39 | CueTime = -1;
40 | }
41 |
42 | void FreeResources() throw() {}
43 | };
44 |
45 | }}}} //MKV::Internal::Object::Context.
46 |
47 | #endif //_MATROSKA_INTERNAL_CUE_CONTEXT_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalCues.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_CUES_H
2 | #define _MATROSKA_INTERNAL_CUES_H
3 |
4 | #include "MatroskaList.h"
5 | #include "MatroskaEbml.h"
6 | #include "MatroskaInternalCueContext.h"
7 |
8 | #define __DEFAULT_MKV_CUES 20
9 |
10 | namespace MKV {
11 | namespace Internal {
12 | namespace Object {
13 |
14 | class Cues
15 | {
16 | public:
17 | explicit Cues(EBML::EbmlHead& head) throw() : _head(head) {}
18 |
19 | public:
20 | bool ParseCues(long long size) throw();
21 |
22 | unsigned GetCuePointCount() throw() { return _list.GetCount(); }
23 | Context::CuePoint* GetCuePoint(unsigned index) throw()
24 | {
25 | if (index >= _list.GetCount())
26 | return nullptr;
27 |
28 | return _list.GetItem(index);
29 | }
30 |
31 | private:
32 | bool ParseCuePoint(Context::CuePoint& point,long long size) throw();
33 | bool ParseCueTrackPositions(Context::CueTrackPositions& pos,long long size) throw();
34 |
35 | private:
36 | EBML::EbmlHead& _head;
37 | MatroskaList _list;
38 | };
39 |
40 | }}} //MKV::Internal::Object.
41 |
42 | #endif //_MATROSKA_INTERNAL_CUES_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalError.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_ERROR_H
2 | #define _MATROSKA_INTERNAL_ERROR_H
3 |
4 | typedef unsigned __MKV_ERR_TYPE__;
5 |
6 | #ifndef _MAKE_MKV_ERR
7 | #define _MAKE_MKV_ERR(ch4) \
8 | ((((__MKV_ERR_TYPE__)(ch4) & 0xFF) << 24) | \
9 | (((__MKV_ERR_TYPE__)(ch4) & 0xFF00) << 8) | \
10 | (((__MKV_ERR_TYPE__)(ch4) & 0xFF0000) >> 8) | \
11 | (((__MKV_ERR_TYPE__)(ch4) & 0xFF000000) >> 24))
12 | #endif
13 |
14 | #define MKV_ERR_OK 0
15 | #define MKV_ERR_FAIL 1
16 |
17 | #define MKV_ERR_INVALID_IO _MAKE_MKV_ERR('IOER')
18 | #define MKV_ERR_INVALID_SIZE _MAKE_MKV_ERR('SIZE')
19 | #define MKV_ERR_INVALID_HEAD _MAKE_MKV_ERR('HEAD')
20 | #define MKV_ERR_INVALID_DATA _MAKE_MKV_ERR('DATA')
21 | #define MKV_ERR_INVALID_BLOCK _MAKE_MKV_ERR('BLCK')
22 | #define MKV_ERR_INVALID_CLUSTER _MAKE_MKV_ERR('CLUS')
23 |
24 | #define MKV_ERR_PARSE_SEEKHEAD _MAKE_MKV_ERR('PSHE')
25 | #define MKV_ERR_PARSE_INFO _MAKE_MKV_ERR('PINF')
26 | #define MKV_ERR_PARSE_TRACKS _MAKE_MKV_ERR('PTCK')
27 | #define MKV_ERR_PARSE_CHAPTERS _MAKE_MKV_ERR('PCHP')
28 | #define MKV_ERR_PARSE_CUES _MAKE_MKV_ERR('PCUE')
29 | #define MKV_ERR_PARSE_CLUSTER _MAKE_MKV_ERR('PCLU')
30 | #define MKV_ERR_PARSE_FILES _MAKE_MKV_ERR('PACH')
31 | #define MKV_ERR_PARSE_TAGS _MAKE_MKV_ERR('PTAG')
32 |
33 | #define BREAK_AND_SET_RESULT(x,result) \
34 | {(x) = (result); break;}
35 |
36 | #endif //_MATROSKA_INTERNAL_ERROR_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalSeekHead.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_SEEKHEAD_H
2 | #define _MATROSKA_INTERNAL_SEEKHEAD_H
3 |
4 | #include "MatroskaList.h"
5 | #include "MatroskaEbml.h"
6 | #include "MatroskaInternalSeekHeadContext.h"
7 |
8 | #define __DEFAULT_MKV_SEEKHEADS 5
9 |
10 | namespace MKV {
11 | namespace Internal {
12 | namespace Object {
13 |
14 | class SeekHead
15 | {
16 | public:
17 | explicit SeekHead(EBML::EbmlHead& head) throw() : _head(head) {}
18 |
19 | public:
20 | bool ParseSeekHead(long long size) throw();
21 |
22 | unsigned GetSeekHeadCount() throw() { return _list.GetCount(); }
23 | Context::HeadSeekIndex* GetSeekHead(unsigned index) throw()
24 | {
25 | if (index >= _list.GetCount())
26 | return nullptr;
27 |
28 | return _list.GetItem(index);
29 | }
30 |
31 | private:
32 | bool ParseSeekEntry(unsigned* id,long long* pos) throw();
33 |
34 | private:
35 | EBML::EbmlHead& _head;
36 | MatroskaList _list;
37 | };
38 |
39 | }}} //MKV::Internal::Object.
40 |
41 | #endif //_MATROSKA_INTERNAL_SEEKHEAD_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalSeekHeadContext.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_SEEKHEAD_CONTEXT_H
2 | #define _MATROSKA_INTERNAL_SEEKHEAD_CONTEXT_H
3 |
4 | #include "MatroskaEbml.h"
5 |
6 | namespace MKV {
7 | namespace Internal {
8 | namespace Object {
9 | namespace Context {
10 |
11 | struct HeadSeekIndex
12 | {
13 | unsigned SeekID;
14 | long long SeekPosition;
15 |
16 | void ToDefault() throw()
17 | {
18 | SeekID = INVALID_EBML_ID;
19 | SeekPosition = 0;
20 | }
21 |
22 | void FreeResources() throw() {}
23 | };
24 |
25 | }}}} //MKV::Internal::Object::Context.
26 |
27 | #endif //_MATROSKA_INTERNAL_SEEKHEAD_CONTEXT_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalSegmentInfo.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_SEGMENTINFO_H
2 | #define _MATROSKA_INTERNAL_SEGMENTINFO_H
3 |
4 | #include "MatroskaEbml.h"
5 |
6 | namespace MKV {
7 | namespace Internal {
8 | namespace Object {
9 |
10 | class SegmentInfo
11 | {
12 | public:
13 | explicit SegmentInfo(EBML::EbmlHead& head) throw() : _head(head)
14 | {
15 | memset(&_info,0,sizeof(_info));
16 | }
17 |
18 | public:
19 | bool ParseSegmentInfo(long long size) throw();
20 |
21 | public:
22 | const char* GetTitle() const throw() { return _info.Title; }
23 | const char* GetMuxingApp() const throw() { return _info.MuxingApp; }
24 | const char* GetWritingApp() const throw() { return _info.WritingApp; }
25 |
26 | long long GetTimecodeScale() const throw() { return _info.TimecodeScale; }
27 | double GetDuration() const throw() { return _info.Duration; }
28 |
29 | bool IsTimecodeMilliseconds() const throw() { return _info.TimecodeScale == 1000000; }
30 |
31 | private:
32 | EBML::EbmlHead& _head;
33 |
34 | struct Info
35 | {
36 | char Title[1024];
37 | char MuxingApp[128];
38 | char WritingApp[256];
39 | long long TimecodeScale;
40 | double Duration;
41 | unsigned char Uuid[16];
42 | };
43 | Info _info;
44 | };
45 |
46 | }}} //MKV::Internal::Object.
47 |
48 | #endif //_MATROSKA_INTERNAL_SEGMENTINFO_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalTagContext.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_TAG_CONTEXT_H
2 | #define _MATROSKA_INTERNAL_TAG_CONTEXT_H
3 |
4 | #include "MatroskaEbml.h"
5 |
6 | namespace MKV {
7 | namespace Internal {
8 | namespace Object {
9 | namespace Context {
10 |
11 | struct SimpleTag
12 | {
13 | char* TagName; //UTF8
14 | char* TagString; //UTF8
15 | char TagLanguage[32];
16 |
17 | void ToDefault() throw()
18 | {
19 | TagName = TagString = nullptr;
20 | TagLanguage[0] = 0;
21 | }
22 |
23 | void FreeResources() throw()
24 | {
25 | if (TagName != nullptr)
26 | {
27 | free(TagName);
28 | TagName = nullptr;
29 | }
30 |
31 | if (TagString != nullptr)
32 | {
33 | free(TagString);
34 | TagString = nullptr;
35 | }
36 | }
37 |
38 | bool CopyFrom(char* name,char* str) throw()
39 | {
40 | if (name == nullptr ||
41 | str == nullptr)
42 | return false;
43 |
44 | TagName = strdup(name);
45 | TagString = strdup(str);
46 | if (TagName == nullptr ||
47 | TagString == nullptr)
48 | return false;
49 |
50 | return true;
51 | }
52 | };
53 |
54 | }}}}
55 |
56 | #endif //_MATROSKA_INTERNAL_TAG_CONTEXT_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalTags.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_INTERNAL_TAGS_H
2 | #define _MATROSKA_INTERNAL_TAGS_H
3 |
4 | #include "MatroskaList.h"
5 | #include "MatroskaEbml.h"
6 | #include "MatroskaInternalTagContext.h"
7 |
8 | #define __DEFAULT_MKV_TAGS 20
9 |
10 | #define MAX_MKV_TAG_NAME 256
11 | #define MAX_MKV_TAG_STRING 1024
12 |
13 | namespace MKV {
14 | namespace Internal {
15 | namespace Object {
16 |
17 | class Tags
18 | {
19 | public:
20 | explicit Tags(EBML::EbmlHead& head) throw() : _head(head) {}
21 | ~Tags()
22 | {
23 | for (unsigned i = 0;i < _list.GetCount();i++)
24 | _list.GetItem(i)->FreeResources();
25 | }
26 |
27 | public:
28 | bool ParseTags(long long size) throw();
29 |
30 | unsigned GetTagCount() throw() { return _list.GetCount(); }
31 | Context::SimpleTag* GetTag(unsigned index) throw()
32 | {
33 | if (index >= _list.GetCount())
34 | return nullptr;
35 |
36 | return _list.GetItem(index);
37 | }
38 | Context::SimpleTag* SearchTagByName(const char* name);
39 |
40 | private:
41 | bool ParseTag(long long size) throw();
42 |
43 | struct SimpleTag
44 | {
45 | char TagName[MAX_MKV_TAG_NAME]; //UTF8
46 | char TagString[MAX_MKV_TAG_STRING]; //UTF8
47 | char TagLanguage[32];
48 | };
49 | bool ParseSimpleTag(SimpleTag& tag,long long size) throw();
50 |
51 | private:
52 | EBML::EbmlHead& _head;
53 | MatroskaList _list;
54 | };
55 |
56 | }}} //MKV::Internal::Object.
57 |
58 | #endif //_MATROSKA_INTERNAL_TAGS_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalTracks.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaInternalTracks.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/Internal/MatroskaMisc.h:
--------------------------------------------------------------------------------
1 | #ifndef _MATROSKA_MISC_H
2 | #define _MATROSKA_MISC_H
3 |
4 | #ifndef _MSC_VER
5 | #include
6 | #define MKV_SWAP16(x) \
7 | ((((x) & 0xFF00U) >> 8) | (((x) & 0x00FFU) << 8))
8 | #define MKV_SWAP32(x) \
9 | ((((x) & 0xFF000000UL) >> 24) | (((x) & 0x00FF0000UL) >> 8) | \
10 | (((x) & 0x0000FF00UL) << 8) | (((x) & 0x000000FFUL) << 24))
11 | #define MKV_SWAP64(x) \
12 | ((((x) & 0xFF00000000000000ULL) >> 56) | (((x) & 0x00FF000000000000ULL) >> 40) | \
13 | (((x) & 0x0000FF0000000000ULL) >> 24) | (((x) & 0x000000FF00000000ULL) >> 8) | \
14 | (((x) & 0x00000000FF000000ULL) << 8) | (((x) & 0x0000000000FF0000ULL) << 24) | \
15 | (((x) & 0x000000000000FF00ULL) << 40) | (((x) & 0x00000000000000FFULL) << 56))
16 | #else
17 | #include
18 | #define MKV_SWAP16(x) _byteswap_ushort(x)
19 | #define MKV_SWAP32(x) _byteswap_ulong(x)
20 | #define MKV_SWAP64(x) _byteswap_uint64(x)
21 | #endif
22 |
23 | #define MKV_ALLOC_ALIGNED(x) ((((x) >> 2) << 2) + 8) //4bytes.
24 | #define MKV_ARRAY_COUNT(ary) (sizeof(ary) / sizeof(ary[0]))
25 |
26 | #if defined(_MSC_VER) && defined(_MKV_EXPORT_CLASS)
27 | #define MKV_EXPORT __declspec(dllexport)
28 | #else
29 | #define MKV_EXPORT
30 | #endif
31 |
32 | #if defined(_MSC_VER) && defined(_DEBUG)
33 | #define MKV_DBG_BREAK __debugbreak()
34 | #else
35 | #define MKV_DBG_BREAK
36 | #endif
37 |
38 | #endif //_MATROSKA_MISC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParser.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParser.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParser.h
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParserCore.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParserCore.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParserDataSource.cpp:
--------------------------------------------------------------------------------
1 | #include "MKVParser.h"
2 |
3 | using namespace MKVParser;
4 |
5 | int MKVFileParser::Read(void* buffer,unsigned size)
6 | {
7 | if (size >= INT_MAX)
8 | return MKV_DATA_SOURCE_READ_ERROR;
9 |
10 | unsigned result = _io->Read(buffer,size);
11 | if (result == 0)
12 | return MKV_DATA_SOURCE_READ_ERROR;
13 |
14 | return (int)result;
15 | }
16 |
17 | int MKVFileParser::Seek(long long offset,int whence)
18 | {
19 | return _io->Seek(offset,whence) ? 1:MKV_DATA_SOURCE_SEEK_ERROR;
20 | }
21 |
22 | long long MKVFileParser::Tell()
23 | {
24 | return _io->Tell();
25 | }
26 |
27 | long long MKVFileParser::Size()
28 | {
29 | return _io->GetSize();
30 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParserErrSpec.h:
--------------------------------------------------------------------------------
1 | #ifndef _MKV_PARSER_ERROR_SPEC_H
2 | #define _MKV_PARSER_ERROR_SPEC_H
3 |
4 | #define PARSER_MKV_OK 0
5 |
6 | #define PARSER_MKV_ERR_UNEXPECTED 0xFFFFFFFF
7 | #define PARSER_MKV_ERR_UNKNOWN 0xFFFFFFFE
8 | #define PARSER_MKV_ERR_MEMORY 0xFFFFFFFD
9 | #define PARSER_MKV_ERR_IO 0xFFFFFFFC
10 |
11 | #define PARSER_MKV_ERR_OPEN_HEAD_MISSING (PARSER_MKV_ERR_UNEXPECTED - 100)
12 | #define PARSER_MKV_ERR_OPEN_HEAD_FAILED (PARSER_MKV_ERR_OPEN_HEAD_MISSING - 1)
13 | #define PARSER_MKV_ERR_OPEN_SEEK_FAILED (PARSER_MKV_ERR_OPEN_HEAD_FAILED - 1)
14 | #define PARSER_MKV_ERR_OPEN_DOC_INVALID (PARSER_MKV_ERR_OPEN_SEEK_FAILED - 1)
15 | #define PARSER_MKV_ERR_OPEN_DOC_UNSUPPORTED (PARSER_MKV_ERR_OPEN_DOC_INVALID - 1)
16 | #define PARSER_MKV_ERR_OPEN_TIME_UNSUPPORTED (PARSER_MKV_ERR_OPEN_DOC_UNSUPPORTED - 1)
17 | #define PARSER_MKV_ERR_OPEN_TRACK_UNSUPPORTED (PARSER_MKV_ERR_OPEN_TIME_UNSUPPORTED - 1)
18 |
19 | #define PARSER_MKV_ERR_READ_END_OF_PACKET (PARSER_MKV_ERR_UNEXPECTED - 200)
20 | #define PARSER_MKV_ERR_READ_FRAME_INVALID (PARSER_MKV_ERR_READ_END_OF_PACKET - 1)
21 | #define PARSER_MKV_ERR_READ_DATA_INVALID (PARSER_MKV_ERR_READ_FRAME_INVALID - 1)
22 | #define PARSER_MKV_ERR_READ_ZLIB_CLOSED (PARSER_MKV_ERR_READ_DATA_INVALID - 1)
23 |
24 | #endif //_MKV_PARSER_ERROR_SPEC_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParserIO.h:
--------------------------------------------------------------------------------
1 | #ifndef _MKV_PARSER_IO_H
2 | #define _MKV_PARSER_IO_H
3 |
4 | #include
5 |
6 | namespace MKVParser
7 | {
8 | struct IMKVParserIO
9 | {
10 | virtual unsigned Read(void* buf,unsigned size) = 0;
11 | virtual bool Seek(long long offset = 0,int whence = SEEK_SET) = 0;
12 | virtual long long Tell() = 0;
13 | virtual long long GetSize() = 0;
14 | protected:
15 | virtual ~IMKVParserIO() {}
16 | };
17 | }
18 |
19 | #endif //_MKV_PARSER_IO_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/MKVParserZLib.cpp:
--------------------------------------------------------------------------------
1 | #include "MKVParser.h"
2 |
3 | using namespace MKVParser;
4 |
5 | bool MKVFileParser::zlibDecompress(unsigned char* inputData,unsigned inputSize,unsigned char** outputData,unsigned* outputSize)
6 | {
7 | #ifdef _MKV_PARSER_NOUSE_ZLIB
8 | return false;
9 | #else
10 | z_stream zs = {};
11 | if (inflateInit(&zs) != Z_OK)
12 | return false;
13 |
14 | zs.next_in = inputData;
15 | zs.avail_in = inputSize;
16 |
17 | unsigned pktSize = inputSize;
18 | auto pktData = (unsigned char*)malloc(MKV_ALLOC_ALIGNED(pktSize));
19 | if (pktData == nullptr)
20 | {
21 | inflateEnd(&zs);
22 | return false;
23 | }
24 |
25 | unsigned count = 0;
26 | int result = Z_OK;
27 | while (1)
28 | {
29 | if (count > 10)
30 | {
31 | free(pktData);
32 | return false;
33 | }
34 |
35 | pktSize *= 3;
36 | pktData = (unsigned char*)realloc(pktData,MKV_ALLOC_ALIGNED(pktSize));
37 | if (pktData == nullptr)
38 | {
39 | free(pktData);
40 | inflateEnd(&zs);
41 | return false;
42 | }
43 |
44 | zs.avail_out = pktSize - zs.total_out;
45 | zs.next_out = pktData + zs.total_out;
46 |
47 | result = inflate(&zs,Z_NO_FLUSH);
48 | if (result != Z_OK)
49 | break;
50 |
51 | count++;
52 | }
53 | pktSize = zs.total_out;
54 | inflateEnd(&zs);
55 |
56 | if (result != Z_STREAM_END)
57 | {
58 | free(pktData);
59 | return false;
60 | }
61 |
62 | *outputData = pktData;
63 | *outputSize = pktSize;
64 | return true;
65 | #endif
66 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/TTA1Help.cpp:
--------------------------------------------------------------------------------
1 | #include "TTA1Help.h"
2 | #include
3 |
4 | void BuildTTA1FileHeader(unsigned nch,unsigned bits,unsigned rate,double duration,TTA1_FILE_HEADER* head)
5 | {
6 | memset(head,0,sizeof(*head));
7 | head->fourcc = 0x31415454;
8 | head->format = 1;
9 | head->nch = nch;
10 | head->bits = bits;
11 | head->rate = rate;
12 | head->samples = (unsigned)(duration * (double)rate);
13 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/TTA1Help.h:
--------------------------------------------------------------------------------
1 | #ifndef _MKV_TTA1_HELP_H
2 | #define _MKV_TTA1_HELP_H
3 |
4 | #pragma pack(1)
5 | struct TTA1_FILE_HEADER
6 | {
7 | unsigned fourcc; //TTA1
8 | unsigned short format; //1 = pcm
9 | unsigned short nch;
10 | unsigned short bits;
11 | unsigned rate;
12 | unsigned samples;
13 | unsigned char others[12]; //crc....
14 | };
15 | #pragma pack()
16 |
17 | void BuildTTA1FileHeader(unsigned nch,unsigned bits,unsigned rate,double duration,TTA1_FILE_HEADER* head);
18 |
19 | #endif //_MKV_TTA1_HELP_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/WV4Help.cpp:
--------------------------------------------------------------------------------
1 | #include "WV4Help.h"
2 |
3 | bool MKVBlockFrameToWV4BlockHead(unsigned char* frame,unsigned frameLen,WAVPACK4_BLOCK_HEADER* wv4)
4 | {
5 | if (frameLen < 12)
6 | return false;
7 |
8 | unsigned samples = *(unsigned*)frame;
9 | unsigned flags = *(unsigned*)(frame + 4);
10 | unsigned crc = *(unsigned*)(frame + 8);
11 |
12 | wv4->DefaultInit();
13 | wv4->block_size = frameLen + 12;
14 | wv4->block_samples = samples;
15 | wv4->flags = flags;
16 | wv4->crc = crc;
17 |
18 | return true;
19 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/Parser/WV4Help.h:
--------------------------------------------------------------------------------
1 | #ifndef _MKV_WV4_HELP_H
2 | #define _MKV_WV4_HELP_H
3 |
4 | #pragma pack(1)
5 | struct WAVPACK4_BLOCK_HEADER
6 | {
7 | unsigned fourcc; //wvpk
8 | unsigned block_size;
9 | unsigned short version;
10 | unsigned char track_no;
11 | unsigned char index_no;
12 | unsigned total_samples;
13 | unsigned block_index;
14 | unsigned block_samples;
15 | unsigned flags;
16 | unsigned crc;
17 |
18 | void DefaultInit() throw()
19 | {
20 | fourcc = 0x6B707677;
21 | block_size = 0;
22 | version = 0x403;
23 | track_no = index_no = 0;
24 | total_samples = block_index = block_samples = 0;
25 | flags = crc = 0;
26 | }
27 | };
28 | #pragma pack()
29 |
30 | bool MKVBlockFrameToWV4BlockHead(unsigned char* frame,unsigned frameLen,WAVPACK4_BLOCK_HEADER* wv4);
31 |
32 | #endif //_MKV_WV4_HELP_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/RealCook.h:
--------------------------------------------------------------------------------
1 | #ifndef __REAL_COOK_H
2 | #define __REAL_COOK_H
3 |
4 | #pragma pack(1)
5 | struct RealAudioPrivate //48bytes
6 | {
7 | unsigned fourcc;
8 | unsigned short version;
9 | unsigned short unk1;
10 | unsigned char unk2[12];
11 | unsigned short unk3; //22bytes
12 | unsigned short flavor;
13 | unsigned coded_frame_size;
14 | unsigned unk4[3]; //12bytes
15 | unsigned short sub_packet_h;
16 | unsigned short frame_size;
17 | unsigned short sub_packet_size;
18 | unsigned short unk5;
19 | };
20 |
21 | struct RealAudioPrivateV4
22 | {
23 | RealAudioPrivate header;
24 | unsigned short sample_rate;
25 | unsigned short unknown;
26 | unsigned short sample_size;
27 | unsigned short channels;
28 | };
29 |
30 | struct RealAudioPrivateV5
31 | {
32 | RealAudioPrivate header;
33 | unsigned unk1;
34 | unsigned short unk2;
35 | unsigned short sample_rate;
36 | unsigned short unk3;
37 | unsigned short sample_size;
38 | unsigned short channels;
39 | };
40 | #pragma pack()
41 |
42 | #endif //__REAL_COOK_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MKV/VFWHelp.h:
--------------------------------------------------------------------------------
1 | #ifndef __VFW_HELP_H
2 | #define __VFW_HELP_H
3 |
4 | #define _MK_RIFF_FCC(ch4) \
5 | ((((unsigned)(ch4) & 0xFF) << 24) | \
6 | (((unsigned)(ch4) & 0xFF00) << 8) | \
7 | (((unsigned)(ch4) & 0xFF0000) >> 8) | \
8 | (((unsigned)(ch4) & 0xFF000000) >> 24))
9 |
10 | enum AVI_VFW_RIFF_TYPES
11 | {
12 | VFW_RIFF_Others = 0,
13 | VFW_RIFF_H264,
14 | VFW_RIFF_H263,
15 | VFW_RIFF_MPEG4,
16 | VFW_RIFF_MPEG4V3,
17 | VFW_RIFF_MPEG4V2,
18 | VFW_RIFF_MPEG4V1,
19 | VFW_RIFF_MPG1V,
20 | VFW_RIFF_MPG2V,
21 | VFW_RIFF_MJPEG,
22 | VFW_RIFF_WMV1,
23 | VFW_RIFF_WMV2,
24 | VFW_RIFF_WMV3,
25 | VFW_RIFF_VC1,
26 | VFW_RIFF_FFV1,
27 | VFW_RIFF_FLV1,
28 | VFW_RIFF_THEORA,
29 | VFW_RIFF_SNOW,
30 | VFW_RIFF_PRORES,
31 | VFW_RIFF_DIRAC,
32 | VFW_RIFF_CAVS,
33 | VFW_RIFF_AMV
34 | };
35 |
36 | AVI_VFW_RIFF_TYPES SearchVFWCodecIdList(unsigned id);
37 |
38 | enum WAV_VFW_RIFF_TYPES
39 | {
40 | VFW_WAV_Others = 0,
41 | VFW_WAV_PCM,
42 | VFW_WAV_ADPCM,
43 | VFW_WAV_FLOAT,
44 | VFW_WAV_PCM_ALAW,
45 | VFW_WAV_PCM_MULAW,
46 | VFW_WAV_GSM_MS,
47 | VFW_WAV_G723_1,
48 | VFW_WAV_AMR_NB,
49 | VFW_WAV_AMR_WB,
50 | VFW_WAV_WMA1,
51 | VFW_WAV_WMA2,
52 | VFW_WAV_WMA3, //Pro
53 | VFW_WAV_WMA_LOSSLESS,
54 | VFW_WAV_MP2,
55 | VFW_WAV_MP3,
56 | VFW_WAV_AAC,
57 | VFW_WAV_AAC_ADTS,
58 | VFW_WAV_AAC_LATM,
59 | VFW_WAV_AC3,
60 | VFW_WAV_DTS,
61 | VFW_WAV_FLAC,
62 | VFW_WAV_SPEEX
63 | };
64 |
65 | WAV_VFW_RIFF_TYPES SearchVFWCodecIdList2(unsigned id);
66 |
67 | #endif //__VFW_HELP_H
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MP4/Core/Internal/GlobalPrehead.h:
--------------------------------------------------------------------------------
1 | #ifndef ___ISOM_CORE_GLOBAL_PREHEAD___H___
2 | #define ___ISOM_CORE_GLOBAL_PREHEAD___H___
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #endif //___ISOM_CORE_GLOBAL_PREHEAD___H___
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MP4/Core/Internal/IsomError.h:
--------------------------------------------------------------------------------
1 | #ifndef __ISOM_ERROR_H_
2 | #define __ISOM_ERROR_H_
3 |
4 | #include "IsomGlobal.h"
5 |
6 | #define ISOM_ERR_OK 0
7 | #define ISOM_ERR_FAIL 1
8 | #define ISOM_ERR_STOP 2
9 | #define ISOM_ERR_SKIP 3
10 |
11 | #define ISOM_ERR_COMMON_IO ISOM_FCC('IOER')
12 | #define ISOM_ERR_COMMON_SIZE ISOM_FCC('SIZE')
13 | #define ISOM_ERR_COMMON_SEEK ISOM_FCC('SEEK')
14 | #define ISOM_ERR_COMMON_DATA ISOM_FCC('DATA')
15 | #define ISOM_ERR_COMMON_HEAD ISOM_FCC('HEAD')
16 | #define ISOM_ERR_COMMON_INDEX ISOM_FCC('INDX')
17 | #define ISOM_ERR_COMMON_DEPTH ISOM_FCC('DEPH')
18 | #define ISOM_ERR_COMMON_MEMORY ISOM_FCC('MEMY')
19 |
20 | #endif //__ISOM_ERROR_H_
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MP4/Core/Internal/IsomParserStream.cpp:
--------------------------------------------------------------------------------
1 | #include "IsomParser.h"
2 |
3 | using namespace Isom;
4 |
5 | bool Parser::StmReadUI64(uint64_t* value)
6 | {
7 | uint64_t temp;
8 | if (_stream->Read(&temp, 8) != 8)
9 | return false;
10 | *value = ISOM_SWAP64(temp);
11 | return true;
12 | }
13 |
14 | bool Parser::StmReadUI32(uint32_t* value)
15 | {
16 | uint32_t temp;
17 | if (_stream->Read(&temp, 4) != 4)
18 | return false;
19 | *value = ISOM_SWAP32(temp);
20 | return true;
21 | }
22 |
23 | bool Parser::StmReadUI24(uint32_t* value)
24 | {
25 | uint32_t temp;
26 | if (_stream->Read(&temp, 3) != 3)
27 | return false;
28 | temp <<= 8;
29 | *value = ISOM_SWAP32(temp);
30 | return true;
31 | }
32 |
33 | bool Parser::StmReadUI16(uint32_t* value)
34 | {
35 | uint16_t temp;
36 | if (_stream->Read(&temp, 2) != 2)
37 | return false;
38 | *value = (uint32_t)(ISOM_SWAP16(temp));
39 | return true;
40 | }
41 |
42 | bool Parser::StmReadUI08(uint32_t* value)
43 | {
44 | uint8_t temp;
45 | if (_stream->Read(&temp, 1) != 1)
46 | return false;
47 | *value = temp;
48 | return true;
49 | }
50 |
51 | bool Parser::StmReadSkip(unsigned size)
52 | {
53 | if (size > 128)
54 | return false;
55 | char buf[128];
56 | return _stream->Read(buf, size) == size;
57 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MP4/Core/Internal/IsomStreamSource.h:
--------------------------------------------------------------------------------
1 | #ifndef __ISOM_STREAM_SOURCE_H_
2 | #define __ISOM_STREAM_SOURCE_H_
3 |
4 | #include
5 |
6 | namespace Isom
7 | {
8 | struct IStreamSource
9 | {
10 | virtual unsigned Read(void* buf, unsigned size) = 0;
11 | virtual unsigned Write(void* buf, unsigned size) { return 0; }
12 |
13 | virtual bool Seek(int64_t pos) = 0;
14 | virtual int64_t Tell() = 0;
15 | virtual int64_t GetSize() = 0;
16 |
17 | virtual bool IsSeekable() { return true; }
18 | virtual bool IsFromNetwork() { return false; }
19 | protected:
20 | virtual ~IStreamSource() {}
21 | };
22 | }
23 |
24 | #endif //__ISOM_STREAM_SOURCE_H_
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MP4/MP4Demuxer.cpp:
--------------------------------------------------------------------------------
1 | #include "MP4MediaFormat.h"
2 |
3 | IAVMediaFormat* CreateMP4MediaDemuxer()
4 | {
5 | IAVMediaFormat* parser = new (std::nothrow)MP4MediaFormat();
6 | return parser;
7 | }
8 |
9 | std::shared_ptr CreateMP4MediaDemuxerSP()
10 | {
11 | auto parser = std::make_shared();
12 | return parser;
13 | }
14 |
15 | bool CheckFileStreamMP4(IAVMediaIO* pIo)
16 | {
17 | if (!pIo->IsAliveStream())
18 | if (pIo->GetSize() < 128)
19 | return false;
20 |
21 | unsigned size = 0;
22 | unsigned head = 0;
23 | pIo->Seek(0,SEEK_SET);
24 | if (pIo->Read(&size,4) != 4)
25 | return false;
26 | if (pIo->Read(&head,4) != 4)
27 | return false;
28 |
29 | size = ISOM_SWAP32(size);
30 | if (head == ISOM_FCC('ftyp') ||
31 | head == ISOM_FCC('moov') ||
32 | head == ISOM_FCC('mdat') ||
33 | head == ISOM_FCC('free') ||
34 | head == ISOM_FCC('wide') ||
35 | head == ISOM_FCC('pnot') ||
36 | head == ISOM_FCC('skip'))
37 | if (size > 8)
38 | return true;
39 |
40 | return false;
41 | }
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.Shared/MP4/MP4MediaFormat.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreDemuxers/CoreDemuxers.Shared/MP4/MP4MediaFormat.cpp
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.UWP/CoreDemuxers.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CoreDemuxers/CoreDemuxers.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | CreateFLVMediaDemuxer
3 | CreateFLVMediaDemuxerSP
4 | CheckFileStreamFLV
5 | CreateMKVMediaDemuxer
6 | CreateMKVMediaDemuxerSP
7 | CheckFileStreamMKV
8 | CreateMP4MediaDemuxer
9 | CreateMP4MediaDemuxerSP
10 | CheckFileStreamMP4
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Desktop/CoreMFSource.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/AutoComMem.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __AUTO_COM_MEM_H
6 | #define __AUTO_COM_MEM_H
7 |
8 | #ifndef _WINDOWS_
9 | #include
10 | #endif
11 |
12 | template
13 | class AutoComMem final
14 | {
15 | PVOID _p;
16 |
17 | public:
18 | AutoComMem() throw() : _p(nullptr) {}
19 |
20 | explicit AutoComMem(unsigned size) throw()
21 | {
22 | _p = CoTaskMemAlloc(size);
23 | if (_p)
24 | memset(_p,0,size);
25 | }
26 |
27 | ~AutoComMem() throw()
28 | {
29 | if (_p)
30 | CoTaskMemFree(_p);
31 | }
32 |
33 | public:
34 | T* operator()(unsigned size) throw()
35 | {
36 | if (_p != nullptr)
37 | CoTaskMemFree(_p);
38 |
39 | _p = CoTaskMemAlloc(size);
40 | if (_p)
41 | memset(_p,0,size);
42 |
43 | return Get();
44 | }
45 |
46 | public:
47 | void* operator new(std::size_t) = delete;
48 | void* operator new[](std::size_t) = delete;
49 |
50 | public:
51 | T* Get()
52 | {
53 | return (T*)_p;
54 | }
55 |
56 | void Free()
57 | {
58 | if (_p)
59 | CoTaskMemFree(_p);
60 |
61 | _p = nullptr;
62 | }
63 | };
64 |
65 | #endif //__AUTO_COM_MEM_H
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/AutoWinHandle.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __AUTO_WIN_HANDLE_H
6 | #define __AUTO_WIN_HANDLE_H
7 |
8 | #ifndef _WINDOWS_
9 | #include
10 | #endif
11 |
12 | class AutoWinHandle final
13 | {
14 | HANDLE _handle;
15 |
16 | public:
17 | AutoWinHandle() throw() : _handle(INVALID_HANDLE_VALUE) {}
18 | AutoWinHandle(HANDLE hObject) throw() //Non-explicit.
19 | {
20 | _handle = hObject;
21 | }
22 |
23 | ~AutoWinHandle() throw()
24 | {
25 | __try{
26 | if (_handle != INVALID_HANDLE_VALUE &&
27 | _handle != nullptr)
28 | CloseHandle(_handle);
29 | }__except(EXCEPTION_EXECUTE_HANDLER) {}
30 | }
31 |
32 | public:
33 | HANDLE Get() const throw()
34 | {
35 | return _handle;
36 | }
37 |
38 | public:
39 | void* operator new(std::size_t) = delete;
40 | void* operator new[](std::size_t) = delete;
41 | };
42 |
43 | #endif //__AUTO_WIN_HANDLE_H
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/MFAutoBufLock.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __MF_AUTO_BUF_LOCK_H
6 | #define __MF_AUTO_BUF_LOCK_H
7 |
8 | #include "MFCommon.h"
9 |
10 | namespace WMF{
11 |
12 | class AutoBufLock final
13 | {
14 | IMFMediaBuffer* _pMediaBuffer;
15 | PBYTE _pData;
16 |
17 | public:
18 | explicit AutoBufLock(IMFMediaBuffer* pBuffer) throw() : _pMediaBuffer(nullptr), _pData(nullptr)
19 | {
20 | if (pBuffer != nullptr)
21 | {
22 | if (SUCCEEDED(pBuffer->Lock(&_pData,nullptr,nullptr)))
23 | {
24 | _pMediaBuffer = pBuffer;
25 | _pMediaBuffer->AddRef();
26 | }
27 | }
28 | }
29 |
30 | ~AutoBufLock() throw()
31 | {
32 | Unlock();
33 | }
34 |
35 | public:
36 | PBYTE GetPtr() const throw()
37 | {
38 | return _pData;
39 | }
40 |
41 | void Unlock() throw()
42 | {
43 | if (_pMediaBuffer)
44 | {
45 | _pMediaBuffer->Unlock();
46 | _pMediaBuffer->Release();
47 | }
48 |
49 | _pMediaBuffer = nullptr;
50 | }
51 | };
52 |
53 | } //namespace WMF.
54 |
55 | #endif //__MF_AUTO_BUF_LOCK_H
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/MFCommon.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __MF_COMMON_H
6 | #define __MF_COMMON_H
7 |
8 | #ifndef _WINDOWS_
9 | #include
10 | #endif
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | #endif //__MF_COMMON_H
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/MFMiscHelp.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __MF_SAMPLE_HELP_H
6 | #define __MF_SAMPLE_HELP_H
7 |
8 | #include "MFCommon.h"
9 |
10 | namespace WMF{
11 | namespace Misc{
12 |
13 | HRESULT CreateSampleWithBuffer(IMFSample** ppSample,IMFMediaBuffer** ppBuffer,DWORD dwBufSize,DWORD dwAlignedSize = 0);
14 | HRESULT CreateSampleAndCopyData(IMFSample** ppSample,PVOID pData,DWORD dwDataSize,MFTIME pts,MFTIME duration);
15 |
16 | HRESULT CreateAudioMediaType(IMFMediaType** ppMediaType);
17 | HRESULT CreateVideoMediaType(IMFMediaType** ppMediaType);
18 |
19 | HRESULT IsAudioMediaType(IMFMediaType* pMediaType);
20 | HRESULT IsVideoMediaType(IMFMediaType* pMediaType);
21 |
22 | HRESULT IsAudioPCMSubType(IMFMediaType* pMediaType);
23 | HRESULT IsVideoRGBSubType(IMFMediaType* pMediaType);
24 | HRESULT IsVideoYUVSubType(IMFMediaType* pMediaType);
25 |
26 | HRESULT GetMediaTypeFromPD(IMFPresentationDescriptor* ppd,DWORD dwStreamIndex,IMFMediaType** ppMediaType);
27 |
28 | LONG64 SecondsToMFTime(double seconds);
29 | double SecondsFromMFTime(LONG64 time);
30 | double GetSecondsFromMFSample(IMFSample* pSample);
31 |
32 | bool IsMFTExists(LPCWSTR clsid);
33 | bool IsMFTExists(LPCSTR clsid);
34 |
35 | }} //namespace WMF::Misc.
36 |
37 | #endif //__MF_SAMPLE_HELP_H
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/MFMiscHelp2.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __MF_SAMPLE_HELP2_H
6 | #define __MF_SAMPLE_HELP2_H
7 |
8 | #include "MFCommon.h"
9 |
10 | namespace WMF{
11 | namespace MediaType{
12 |
13 | void SetMajorAndSubType(IMFMediaType* pMediaType,const GUID& majorType,const GUID& subType);
14 |
15 | enum MFMediaType
16 | {
17 | MediaType_MajorType,
18 | MediaType_SubType
19 | };
20 |
21 | GUID GetMediaTypeGUID(IMFMediaType* pMediaType,MFMediaType guidType);
22 |
23 | struct MFVideoBasicInfo
24 | {
25 | unsigned width;
26 | unsigned height;
27 | MFRatio fps;
28 | MFRatio ar;
29 | MFVideoInterlaceMode interlace_mode;
30 | unsigned sample_size;
31 | };
32 | HRESULT GetBasicVideoInfo(IMFMediaType* pMediaType,MFVideoBasicInfo* info);
33 |
34 | struct MFAudioBasicInfo
35 | {
36 | unsigned channelCount;
37 | unsigned sampleRate;
38 | unsigned sampleSize;
39 | unsigned chLayout;
40 | unsigned blockAlign;
41 | };
42 | HRESULT GetBasicAudioInfo(IMFMediaType* pMediaType,MFAudioBasicInfo* info);
43 |
44 | HRESULT GetBlobDataAlloc(IMFMediaType* pMediaType,const GUID& guidKey,BYTE** ppBuffer,PDWORD pdwSize);
45 |
46 | }} //namespace WMF::MediaType.
47 |
48 | #endif
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/Common/MFWorkQueue.h:
--------------------------------------------------------------------------------
1 | #if _MSC_VER > 1000
2 | #pragma once
3 | #endif
4 |
5 | #ifndef __MF_WORK_QUEUE_H
6 | #define __MF_WORK_QUEUE_H
7 |
8 | #include "MFCommon.h"
9 |
10 | namespace WMF{
11 |
12 | class AutoWorkQueue final
13 | {
14 | public:
15 | AutoWorkQueue() throw()
16 | {
17 | HRESULT hr = MFLockPlatform();
18 | if (SUCCEEDED(hr))
19 | hr = MFAllocateSerialWorkQueue(MFASYNC_CALLBACK_QUEUE_MULTITHREADED,&_dwWorkQueue);
20 |
21 | if (FAILED(hr))
22 | _dwWorkQueue = MFASYNC_CALLBACK_QUEUE_STANDARD;
23 | }
24 |
25 | ~AutoWorkQueue() throw()
26 | {
27 | if (_dwWorkQueue != MFASYNC_CALLBACK_QUEUE_STANDARD)
28 | {
29 | MFUnlockWorkQueue(_dwWorkQueue);
30 | MFUnlockPlatform();
31 | }
32 | }
33 |
34 | public:
35 | inline DWORD GetWorkQueue() const throw()
36 | {
37 | return _dwWorkQueue;
38 | }
39 |
40 | inline HRESULT PutWorkItem(IMFAsyncCallback* pCallback,IUnknown* pState) const throw()
41 | {
42 | return MFPutWorkItem2(_dwWorkQueue,0,
43 | pCallback,pState);
44 | }
45 |
46 | private:
47 | DWORD _dwWorkQueue;
48 | };
49 |
50 | } //namespace WMF.
51 |
52 | #endif //__MF_WORK_QUEUE_H
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/DbgLogOutput.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void DbgLogPrintf(const wchar_t* str,...)
5 | {
6 | #ifdef _DEBUG
7 | if (str == nullptr)
8 | return;
9 |
10 | va_list args;
11 | va_start(args,str);
12 |
13 | WCHAR sz[1024] = {};
14 | _vsnwprintf_s(sz,ARRAYSIZE(sz),str,args);
15 | wcscat(sz,L"\n");
16 | OutputDebugStringW(sz);
17 |
18 | va_end(args);
19 | #endif
20 | }
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/DbgLogOutput.h:
--------------------------------------------------------------------------------
1 | void DbgLogPrintf(const wchar_t* str,...);
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_AudioMediaType.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource_AudioMediaType.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_Desktop.cpp:
--------------------------------------------------------------------------------
1 | #include "HDMediaSource.h"
2 |
3 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
4 |
5 | #define WIN8_CHECK_COND "GetPackageId"
6 | bool HDMediaSource::IsWindows8()
7 | {
8 | return GetProcAddress(
9 | GetModuleHandleA("KernelBase.dll"),WIN8_CHECK_COND) != nullptr;
10 | }
11 |
12 | static unsigned SkipH264AudOffset(unsigned char* pb,unsigned len)
13 | {
14 | if (pb[0] != 0 ||
15 | pb[1] != 0 ||
16 | pb[2] != 0 ||
17 | pb[3] != 0 ||
18 | pb[4] != 0x09)
19 | return 0;
20 |
21 | return 6;
22 | }
23 |
24 | HRESULT HDMediaSource::ProcessMPEG2TSToMP4Sample(IMFSample* pH264ES,IMFSample** ppH264)
25 | {
26 | ComPtr pOldBuffer;
27 | HRESULT hr = pH264ES->GetBufferByIndex(0,pOldBuffer.GetAddressOf());
28 | HR_FAILED_RET(hr);
29 |
30 | WMF::AutoBufLock lock_old(pOldBuffer.Get());
31 | if (lock_old.GetPtr() == nullptr)
32 | return E_UNEXPECTED;
33 |
34 | DWORD dwOldBufSize = 0;
35 | pOldBuffer->GetCurrentLength(&dwOldBufSize);
36 | if (dwOldBufSize == 0)
37 | return E_UNEXPECTED;
38 |
39 | unsigned offset = SkipH264AudOffset(lock_old.GetPtr(),dwOldBufSize);
40 | if (offset == 0 ||
41 | offset >= dwOldBufSize)
42 | return E_NOT_SET;
43 |
44 | ComPtr pNewSample;
45 | hr = WMF::Misc::CreateSampleAndCopyData(pNewSample.GetAddressOf(),
46 | lock_old.GetPtr() + offset,dwOldBufSize - offset,-1,0);
47 |
48 | if (SUCCEEDED(hr))
49 | *ppH264 = pNewSample.Detach();
50 |
51 | return hr;
52 | }
53 |
54 | #endif
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_EventGenerator.cpp:
--------------------------------------------------------------------------------
1 | #include "HDMediaSource.h"
2 |
3 | HRESULT HDMediaSource::BeginGetEvent(IMFAsyncCallback *pCallback,IUnknown *punkState)
4 | {
5 | CritSec::AutoLock lock(_cs);
6 |
7 | HRESULT hr = CheckShutdown();
8 | if (FAILED(hr))
9 | return hr;
10 |
11 | return _pEventQueue->BeginGetEvent(pCallback,punkState);
12 | }
13 |
14 | HRESULT HDMediaSource::EndGetEvent(IMFAsyncResult *pResult,IMFMediaEvent **ppEvent)
15 | {
16 | CritSec::AutoLock lock(_cs);
17 |
18 | HRESULT hr = CheckShutdown();
19 | if (FAILED(hr))
20 | return hr;
21 |
22 | return _pEventQueue->EndGetEvent(pResult,ppEvent);
23 | }
24 |
25 | HRESULT HDMediaSource::GetEvent(DWORD dwFlags,IMFMediaEvent **ppEvent)
26 | {
27 | ComPtr pEventQueue;
28 |
29 | {
30 | CritSec::AutoLock lock(_cs);
31 |
32 | HRESULT hr = CheckShutdown();
33 | if (FAILED(hr))
34 | return hr;
35 |
36 | pEventQueue = _pEventQueue;
37 | }
38 |
39 | return pEventQueue->GetEvent(dwFlags,ppEvent);
40 | }
41 |
42 | HRESULT HDMediaSource::QueueEvent(MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,const PROPVARIANT *pvValue)
43 | {
44 | CritSec::AutoLock lock(_cs);
45 |
46 | HRESULT hr = CheckShutdown();
47 | if (FAILED(hr))
48 | return hr;
49 |
50 | return _pEventQueue->QueueEventParamVar(met,guidExtendedType,hrStatus,pvValue);
51 | }
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_GetService.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource_GetService.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_MkStreams.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource_MkStreams.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_OpenAsync.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource_OpenAsync.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_Parser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource_Parser.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaSource_TaskQueue.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaSource_TaskQueue.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaStream.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaStream.cpp
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaStream.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/CoreMFSource/CoreMFSource.Shared/HDMediaStream.h
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/HDMediaStream_EventGenerator.cpp:
--------------------------------------------------------------------------------
1 | #include "HDMediaStream.h"
2 |
3 | HRESULT HDMediaStream::BeginGetEvent(IMFAsyncCallback *pCallback,IUnknown *punkState)
4 | {
5 | SourceAutoLock lock(_pMediaSource.Get());
6 |
7 | HRESULT hr = CheckShutdown();
8 | if (FAILED(hr))
9 | return hr;
10 |
11 | return _pEventQueue->BeginGetEvent(pCallback,punkState);
12 | }
13 |
14 | HRESULT HDMediaStream::EndGetEvent(IMFAsyncResult *pResult,IMFMediaEvent **ppEvent)
15 | {
16 | SourceAutoLock lock(_pMediaSource.Get());
17 |
18 | HRESULT hr = CheckShutdown();
19 | if (FAILED(hr))
20 | return hr;
21 |
22 | return _pEventQueue->EndGetEvent(pResult,ppEvent);
23 | }
24 |
25 | HRESULT HDMediaStream::GetEvent(DWORD dwFlags,IMFMediaEvent **ppEvent)
26 | {
27 | ComPtr pEventQueue;
28 |
29 | {
30 | SourceAutoLock lock(_pMediaSource.Get());
31 |
32 | HRESULT hr = CheckShutdown();
33 | if (FAILED(hr))
34 | return hr;
35 |
36 | pEventQueue = _pEventQueue;
37 | }
38 |
39 | return pEventQueue->GetEvent(dwFlags,ppEvent);
40 | }
41 |
42 | HRESULT HDMediaStream::QueueEvent(MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,const PROPVARIANT *pvValue)
43 | {
44 | SourceAutoLock lock(_pMediaSource.Get());
45 |
46 | HRESULT hr = CheckShutdown();
47 | if (FAILED(hr))
48 | return hr;
49 |
50 | return _pEventQueue->QueueEventParamVar(met,guidExtendedType,hrStatus,pvValue);
51 | }
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/MFMediaIOEx.cpp:
--------------------------------------------------------------------------------
1 | #include "MFMediaIOEx.h"
2 |
3 | unsigned MFMediaIOEx::Read(void* pb,unsigned size)
4 | {
5 | if (!CreateEvents())
6 | return 0;
7 |
8 | _dwReadOKSize = 0;
9 | _blockState = true;
10 | HRESULT hr = _pStream->BeginRead((BYTE*)pb,size,this,nullptr);
11 | if (FAILED(hr))
12 | {
13 | _blockState = false;
14 | return 0;
15 | }
16 | auto result = GetReadResult();
17 | _blockState = false;
18 |
19 | if (result != ReadOK || _dwReadOKSize == 0)
20 | return 0;
21 | return _dwReadOKSize;
22 | }
23 |
24 | MFMediaIOEx::ReadResult MFMediaIOEx::GetReadResult()
25 | {
26 | HANDLE handles[] = {_hEventRead,_hEventCancel};
27 | DWORD result = WaitForMultipleObjectsEx(_countof(handles),handles,FALSE,_dwReadTimeout,FALSE);
28 | if (result == WAIT_TIMEOUT)
29 | return ReadTimeout;
30 | else if (result == WAIT_FAILED)
31 | return ReadFailed;
32 | return result == 0 ? ReadOK:ReadCancel;
33 | }
34 |
35 | HRESULT MFMediaIOEx::Invoke(IMFAsyncResult* pAsyncResult)
36 | {
37 | _dwReadOKSize = 0;
38 | if (_pStream)
39 | _pStream->EndRead(pAsyncResult,(ULONG*)&_dwReadOKSize);
40 | SetEvent(_hEventRead);
41 | return S_OK;
42 | }
43 |
44 | HRESULT MFMediaIOEx::QueryInterface(REFIID iid,void** ppv)
45 | {
46 | if (ppv == nullptr)
47 | return E_POINTER;
48 | if (iid != IID_IUnknown && iid != IID_IMFAsyncCallback)
49 | return E_NOINTERFACE;
50 |
51 | *ppv = static_cast(this);
52 | AddRef();
53 | return S_OK;
54 | }
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/MFSeekInfo.hxx:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "pch.h"
4 |
5 | #ifndef __IMFSeekInfo_INTERFACE_DEFINED__
6 | #if (WINVER >= _WIN32_WINNT_WIN8)
7 |
8 | MIDL_INTERFACE("26AFEA53-D9ED-42B5-AB80-E64F9EE34779")
9 | IMFSeekInfo : public IUnknown
10 | {
11 | public:
12 | virtual HRESULT STDMETHODCALLTYPE GetNearestKeyFrames(const GUID*,const PROPVARIANT*,PROPVARIANT*,PROPVARIANT*);
13 | };
14 |
15 | EXTERN_C const GUID MF_SCRUBBING_SERVICE;
16 | #endif
17 | #else
18 | #if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
19 | EXTERN_C const GUID MF_SCRUBBING_SERVICE;
20 | #endif
21 | #endif
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/main.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "GlobalSettings.h"
3 | #include "HDCoreByteStreamHandler.h"
4 | #include
5 |
6 | HMODULE khInstance;
7 |
8 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
9 | {
10 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
11 | khInstance = hModule;
12 | DisableThreadLibraryCalls(hModule);
13 | GlobalOptionStartup();
14 | Module::GetModule().Create();
15 | }else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
16 | Module::GetModule().Terminate();
17 | GlobalOptionClear();
18 | }
19 | return TRUE;
20 | }
21 |
22 | STDAPI DllGetActivationFactory(HSTRING activatibleClassId, IActivationFactory** factory)
23 | {
24 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
25 | return E_NOTIMPL;
26 | #else
27 | return Module::GetModule().GetActivationFactory(activatibleClassId, factory);
28 | #endif
29 | }
30 |
31 | STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
32 | {
33 | return Module::GetModule().GetClassObject(rclsid, riid, ppv);
34 | }
35 |
36 | STDAPI DllCanUnloadNow()
37 | {
38 | return Module::GetModule().Terminate() ? S_OK:S_FALSE;
39 | }
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.Shared/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #include "Common\MFCommon.h"
15 |
16 | using namespace Microsoft::WRL;
17 | using namespace Microsoft::WRL::Wrappers;
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.UWP/CoreMFSource.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CoreMFSource/CoreMFSource.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow PRIVATE
3 | DllGetClassObject PRIVATE
4 | DllGetActivationFactory PRIVATE
5 | GetCoreMFsGlobalSettings
6 | GetCoreMFsGlobalCS
--------------------------------------------------------------------------------
/Demo/SYEngineDesktop/MediaExtensionInstaller.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "pch.h"
4 | #include "MediaExtensionActivate.h"
5 |
6 | class MediaExtensionInstaller sealed
7 | {
8 | ComPtr _objs;
9 |
10 | public:
11 | MediaExtensionInstaller() { MFStartup(MF_VERSION); MFCreateCollection(&_objs); }
12 | ~MediaExtensionInstaller() { _objs->RemoveAllElements(); MFShutdown(); }
13 |
14 | public:
15 | bool InstallSchemeHandler(LPCWSTR clsid, LPCWSTR activatableClassId, LPCWSTR dllFile, LPCWSTR schemeType);
16 | bool InstallByteStreamHandler(LPCWSTR clsid, LPCWSTR activatableClassId, LPCWSTR dllFile, LPCWSTR fileExt, LPCWSTR mimeType);
17 | };
--------------------------------------------------------------------------------
/Demo/SYEngineDesktop/SYEngineDesktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Demo/SYEngineDesktop/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 | #include
14 |
15 | using namespace Microsoft::WRL;
16 | using namespace Microsoft::WRL::Wrappers;
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/MultipartStreamMatroska/0.mp4:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:0215411af1a71c6698530e94affd8eae37d926b781a7e96e01bc3851ee53a15c
3 | size 4001531
4 |
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/MultipartStreamMatroska/1.mp4:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:32e85d1e3b69d15d9bea9c7309e845f8d986584360ebe74f56448f8642c671fb
3 | size 2121062
4 |
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/Demo/SYEngineUWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("SYEngineUWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SYEngineUWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 程序集的版本信息由下列四个值组成:
18 | //
19 | // 主版本
20 | // 次版本
21 | // 生成号
22 | // 修订号
23 | //
24 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
25 | //通过使用 "*",如下所示:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Demo/SYEngineUWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Desktop/MultipartStreamMatroska.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/DemuxLavf.h:
--------------------------------------------------------------------------------
1 | #ifndef __DEMUX_LAVF_H
2 | #define __DEMUX_LAVF_H
3 |
4 | extern "C"
5 | {
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | }
14 |
15 | #endif //__DEMUX_LAVF_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/DemuxProxy.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/DemuxProxy.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/DsIOCallback.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/DsIOCallback.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MatroskaJoinStream.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MatroskaJoinStream.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MatroskaJoinStream.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MatroskaJoinStream.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MatroskaMerge.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MatroskaMerge.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MemoryBuffer.cpp:
--------------------------------------------------------------------------------
1 | #include "MemoryBuffer.h"
2 | #include
3 | #include
4 | #include
5 |
6 | #define MEMORY_ALLOC_ALIGN(x) ((((x) >> 2) << 2) + 8)
7 |
8 | bool MemoryBuffer::Alloc(unsigned size, bool zero_mem) throw()
9 | {
10 | if (size > _alloc_size)
11 | {
12 | Free();
13 | _ptr = malloc(MEMORY_ALLOC_ALIGN(size));
14 | if (_ptr)
15 | _alloc_size = size;
16 | }
17 |
18 | if (_ptr && zero_mem)
19 | memset(_ptr, 0, size);
20 | return _ptr != NULL;
21 | }
22 |
23 | bool MemoryBuffer::Realloc(unsigned new_size, bool zero_mem) throw()
24 | {
25 | if (new_size <= _alloc_size)
26 | return Alloc(new_size, false);
27 | if (_ptr == NULL)
28 | return Alloc(new_size, true);
29 |
30 | _ptr = realloc(_ptr, new_size);
31 | if (_ptr && zero_mem)
32 | memset((char*)_ptr + _alloc_size, 0, new_size - _alloc_size);
33 | _alloc_size = new_size;
34 | return _ptr != NULL;
35 | }
36 |
37 | void MemoryBuffer::Free() throw()
38 | {
39 | if (_ptr)
40 | free(_ptr);
41 | _ptr = NULL;
42 | _alloc_size = 0;
43 | }
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MemoryBuffer.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEMORY_BUFFER_H
2 | #define __MEMORY_BUFFER_H
3 |
4 | #include
5 |
6 | class MemoryBuffer
7 | {
8 | void* _ptr;
9 | unsigned _alloc_size;
10 |
11 | public:
12 | explicit MemoryBuffer(unsigned size) throw() : _ptr(NULL), _alloc_size(0)
13 | { Alloc(size, true); }
14 | MemoryBuffer() throw() : _ptr(NULL), _alloc_size(0) {}
15 | ~MemoryBuffer() throw() { Free(); }
16 |
17 | bool Alloc(unsigned size, bool zero_mem = false) throw();
18 | bool Realloc(unsigned new_size, bool zero_mem = false) throw();
19 | void Free() throw();
20 |
21 | template
22 | inline T Get() const throw() { return (T)_ptr; }
23 | inline unsigned Length() const throw() { return _alloc_size; }
24 | };
25 |
26 | #endif //__MEMORY_BUFFER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MemoryStream.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEMORY_STREAM_H
2 | #define __MEMORY_STREAM_H
3 |
4 | #include "MemoryBuffer.h"
5 |
6 | class MemoryStream
7 | {
8 | MemoryBuffer _buffer;
9 | unsigned _offset;
10 | unsigned _bound_size;
11 |
12 | public:
13 | MemoryStream() throw() : _offset(0), _bound_size(0) {}
14 |
15 | unsigned Read(void* buf, unsigned size, bool non_move_offset = false);
16 | unsigned Write(const void* buf, unsigned size, bool non_move_offset = false);
17 |
18 | bool SetOffset(unsigned off);
19 | unsigned GetOffset() { return _offset; }
20 |
21 | bool SetLength(unsigned new_length);
22 | unsigned GetLength() { return _bound_size; }
23 | unsigned GetPendingLength() { return GetLength() - GetOffset(); }
24 |
25 | bool IsEof() { return _offset == _bound_size; }
26 |
27 | inline void* Pointer() { return _buffer.Get() + _offset; }
28 | inline MemoryBuffer* Buffer() throw() { return &_buffer; }
29 |
30 | private:
31 | static void memcpy_8bytes(void* dst, const void* src, unsigned length);
32 | };
33 |
34 | #endif //__MEMORY_STREAM_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MergeManager.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MergeManager.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MergeManager.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/MergeManager.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/RingBlockBuffer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/RingBlockBuffer.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/TextReader.h:
--------------------------------------------------------------------------------
1 | #ifndef __TEXT_READER_H
2 | #define __TEXT_READER_H
3 |
4 | class StringArray;
5 | class TextReader
6 | {
7 | public:
8 | struct TextLine
9 | {
10 | char** Line;
11 | int Count;
12 | };
13 |
14 | TextReader() throw();
15 | explicit TextReader(int max_count) throw();
16 | ~TextReader() throw();
17 |
18 | bool ParseFile(const char* file_path) throw();
19 | bool ParseFile(const wchar_t* file_path) throw(); //_GLIBCXX_USE_WCHAR_T
20 |
21 | inline TextLine* GetTextLine() throw() { return &_lines; }
22 |
23 | private:
24 | void ReadLines(void* fs, bool wchar);
25 |
26 | TextLine _lines;
27 | int _max_count;
28 |
29 | StringArray* _dyn_lines;
30 | };
31 |
32 | #endif //__TEXT_READER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/WindowsHttpDataSource.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/WindowsHttpDataSource.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/WindowsHttpDownloader.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/WindowsHttpDownloader.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/WindowsHttpTaskManager.h:
--------------------------------------------------------------------------------
1 | #ifndef __DOWNLOAD_WINDOWS_HTTP_TASK_MANAGER_H
2 | #define __DOWNLOAD_WINDOWS_HTTP_TASK_MANAGER_H
3 |
4 | #include "WindowsHttpDataSource.h"
5 | #include "downloader\TaskManagerBase.h"
6 |
7 | namespace Downloader {
8 | namespace Windows {
9 |
10 | class WindowsHttpTaskManager : public TaskManagerBase
11 | {
12 | public:
13 | WindowsHttpTaskManager(unsigned block_size_kb = 64, unsigned block_count = 80)
14 | { _block_size_kb = block_size_kb; _block_count = block_count; }
15 |
16 | protected:
17 | virtual ~WindowsHttpTaskManager() {}
18 |
19 | virtual bool OnStartTask(int index);
20 | virtual bool OnStopTask(int index);
21 |
22 | virtual bool OnPauseTask(int index);
23 | virtual bool OnResumeTask(int index);
24 |
25 | virtual bool OnUpdateTask(int index, Item* new_task_info);
26 |
27 | virtual void OnUnload() { DestroyTasks(); }
28 |
29 | private:
30 | void DestroyTasks() throw();
31 |
32 | unsigned _block_size_kb;
33 | unsigned _block_count;
34 | };
35 | }}
36 |
37 | #endif //__DOWNLOAD_WINDOWS_HTTP_TASK_MANAGER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/WindowsTaskManager.h:
--------------------------------------------------------------------------------
1 | #ifndef __DOWNLOAD_WINDOWS_TASK_MANAGER_H
2 | #define __DOWNLOAD_WINDOWS_TASK_MANAGER_H
3 |
4 | #include "downloader\TaskManagerBase.h"
5 | #include
6 |
7 | namespace Downloader {
8 | namespace Windows {
9 |
10 | class WindowsTaskManager : public TaskManagerBase
11 | {
12 | public:
13 | WindowsTaskManager() {}
14 |
15 | protected:
16 | virtual ~WindowsTaskManager() { DestroyTasks(); }
17 |
18 | virtual bool OnStartTask(int index);
19 | virtual bool OnStopTask(int index);
20 |
21 | private:
22 | void DestroyTasks() throw();
23 |
24 | class Win32DataSource : public Core::DataSource
25 | {
26 | HANDLE _hFile;
27 | public:
28 | explicit Win32DataSource(HANDLE hFile) throw()
29 | { _hFile = hFile; }
30 | virtual ~Win32DataSource() throw()
31 | { if (_hFile != INVALID_HANDLE_VALUE) CloseHandle(_hFile); }
32 |
33 | virtual Core::CommonResult InitCheck();
34 | virtual Core::CommonResult ReadBytes(void* buf, unsigned size, unsigned* read_size);
35 | virtual Core::CommonResult SetPosition(int64_t offset);
36 | virtual Core::CommonResult GetLength(int64_t* size);
37 |
38 | virtual unsigned GetFlags() { return Core::DataSource::Flags::kFromLocalHost; }
39 | virtual const char* GetMarker() { return "Win32"; }
40 | };
41 | };
42 | }}
43 |
44 | #endif //__DOWNLOAD_WINDOWS_TASK_MANAGER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/downloader/DownloadTask.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/downloader/DownloadTask.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/downloader/TaskManagerBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/downloader/TaskManagerBase.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/mkv/AkaMatroskaIOCallback.h:
--------------------------------------------------------------------------------
1 | #ifndef __AKA_MATROSKA_IO_CALLBACK_H
2 | #define __AKA_MATROSKA_IO_CALLBACK_H
3 |
4 | #include
5 | #include
6 |
7 | namespace AkaMatroska {
8 | namespace Core {
9 |
10 | struct IOCallback
11 | {
12 | virtual unsigned Read(void* buf, unsigned size) { return 0; }
13 | virtual unsigned Write(const void* buf, unsigned size) = 0;
14 |
15 | virtual int64_t GetPosition() = 0; //same ftell
16 | virtual int64_t SetPosition(int64_t offset) = 0; //same lseek.(-1 is failed.)
17 |
18 | virtual int64_t GetSize() { return 0; }
19 | protected:
20 | virtual ~IOCallback() {}
21 | };
22 | }}
23 |
24 | #endif //__AKA_MATROSKA_IO_CALLBACK_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/mkv/AkaMatroskaPrehead.h:
--------------------------------------------------------------------------------
1 | #ifndef __AKA_MATROSKA_PREHEAD_H
2 | #define __AKA_MATROSKA_PREHEAD_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #endif //__AKA_MATROSKA_PREHEAD_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/parser/AACParser.cpp:
--------------------------------------------------------------------------------
1 | #include "AACParser.h"
2 |
3 | static void ParseAudioSpecificConfig(unsigned char* pb, AACParser::AudioSpecificConfig& asc)
4 | {
5 | asc.audioObjectType = (pb[0] & 0xF8) >> 3;
6 | asc.samplingFrequencyIndex = ((pb[0] & 0x07) << 1) | (pb[1] >> 7);
7 | asc.channelConfiguration = (pb[1] >> 3) & 0x0F;
8 |
9 | asc.GASpecificConfig.frameLengthFlag = (pb[1] >> 2) & 0x01;
10 | asc.GASpecificConfig.dependsOnCoreCoder = (pb[1] >> 1) & 0x01;
11 | asc.GASpecificConfig.extensionFlag = pb[1] & 0x01;
12 | }
13 |
14 | void AACParser::Parse(unsigned char* buf) throw()
15 | {
16 | static const int aac_sample_rate_table[] = {
17 | 96000, 88200, 64000, 48000, 44100, 32000,
18 | 24000, 22050, 16000, 12000, 11025, 8000, 7350,
19 | 0, 0, 0, 0
20 | };
21 |
22 | ParseAudioSpecificConfig(buf, config);
23 | if (config.samplingFrequencyIndex > 15)
24 | return;
25 | if (config.channelConfiguration == 0 || config.channelConfiguration > 8)
26 | return;
27 |
28 | channels = config.channelConfiguration;
29 | samplerate = aac_sample_rate_table[config.samplingFrequencyIndex];
30 | if (config.audioObjectType == 5 && config.GASpecificConfig.dependsOnCoreCoder == 1)
31 | he_lc_core_flag = 1;
32 | }
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/parser/AACParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __AAC_PARSER_H
2 | #define __AAC_PARSER_H
3 |
4 | struct AACParser
5 | {
6 | unsigned channels;
7 | unsigned samplerate;
8 | int he_lc_core_flag;
9 |
10 | struct AudioSpecificConfig
11 | {
12 | unsigned audioObjectType; //5bit
13 | unsigned samplingFrequencyIndex; //4bit
14 | unsigned channelConfiguration; //4bit
15 | struct //3bit
16 | {
17 | unsigned frameLengthFlag;
18 | unsigned dependsOnCoreCoder;
19 | unsigned extensionFlag;
20 | } GASpecificConfig;
21 | };
22 | AudioSpecificConfig config;
23 |
24 | void Parse(unsigned char* buf) throw(); //2bytes need.
25 | };
26 |
27 | #endif //__AAC_PARSER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/parser/AVCParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __AVC_PARSER_H
2 | #define __AVC_PARSER_H
3 |
4 | struct AVCParser
5 | {
6 | unsigned profile;
7 | unsigned profile_level;
8 | unsigned ref_frames;
9 | unsigned bit_depth; //+8
10 | unsigned max_frame_num; //+4
11 | unsigned max_pic_order_cnt; //+4
12 | unsigned width, height;
13 | unsigned sar_width, sar_height;
14 | unsigned fps_tick, fps_timescale; //if fixed_fps_flag is set, tick * 2.
15 | enum ChromaTypes
16 | {
17 | ChromaFormatUnk = 0,
18 | ChromaFormat420 = 1, //default
19 | ChromaFormat422 = 2,
20 | ChromaFormat444 = 3
21 | };
22 | ChromaTypes chroma_format;
23 | int fixed_fps_flag;
24 | int progressive_flag;
25 | int mbaff_flag; //if progressive_flag is no set.
26 | enum EntropyCodingTypes //from PPS
27 | {
28 | CodingModeCAVLC,
29 | CodingModeCABAC
30 | };
31 | EntropyCodingTypes ec_type;
32 | unsigned lengthSizeMinusOne;
33 |
34 | void ParseSPS(const unsigned char* access_unit, unsigned size) throw();
35 | void ParsePPS(const unsigned char* access_unit, unsigned size) throw();
36 |
37 | void Parse(const unsigned char* buf, unsigned size) throw();
38 | };
39 |
40 | #endif //__AVC_PARSER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/parser/FLACParser.cpp:
--------------------------------------------------------------------------------
1 | #include "FLACParser.h"
2 | extern "C"
3 | {
4 | #include
5 | #include
6 | }
7 |
8 | void FLACParser::Parse(unsigned char* buf, unsigned size) throw()
9 | {
10 | unsigned char extradata[64] = {};
11 | if (size > 64)
12 | return;
13 | memcpy(extradata, buf, size);
14 |
15 | AVCodecContext* codec = avcodec_alloc_context3(NULL);
16 | if (codec == NULL)
17 | return;
18 | codec->extradata = &extradata[0];
19 | codec->extradata_size = size;
20 | FLACExtradataFormat format;
21 | uint8_t* head = NULL;
22 | if (ff_flac_is_extradata_valid(codec, &format, &head)) {
23 | FLACStreaminfo info = {};
24 | ff_flac_parse_streaminfo(codec, &info, head);
25 | nch = info.channels;
26 | rate = info.samplerate;
27 | bps = info.bps;
28 | max_blocksize = info.max_blocksize;
29 | max_framesize = info.max_framesize;
30 | }
31 |
32 | av_free(codec);
33 | }
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/Core/parser/FLACParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __FLAC_PARSER_H
2 | #define __FLAC_PARSER_H
3 |
4 | struct FLACParser
5 | {
6 | unsigned nch;
7 | unsigned rate;
8 | unsigned bps;
9 |
10 | unsigned max_blocksize;
11 | unsigned max_framesize;
12 |
13 | void Parse(unsigned char* buf, unsigned size) throw();
14 | };
15 |
16 | #endif //__FLAC_PARSER_H
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/MultipartStream.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/MultipartStream.cpp
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/MultipartStream.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/MultipartStream.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/ThreadImpl.cpp:
--------------------------------------------------------------------------------
1 | #include "ThreadImpl.h"
2 |
3 | struct ThreadParams
4 | {
5 | ThreadImpl* Object;
6 | void* Userdata;
7 | HANDLE NoitfyEvent;
8 | };
9 |
10 | bool ThreadImpl::ThreadStart(void* param)
11 | {
12 | if (_hThread != NULL)
13 | return false;
14 |
15 | ThreadParams p;
16 | p.Object = this;
17 | p.Userdata = param;
18 | #ifdef CreateEventEx
19 | p.NoitfyEvent = CreateEventExW(NULL, NULL, 0, EVENT_ALL_ACCESS);
20 | #else
21 | p.NoitfyEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
22 | #endif
23 | if (p.NoitfyEvent == NULL)
24 | return false;
25 |
26 | _hThread = CreateThread(NULL, 0, &ThreadImpl::DoThreadInvoke, &p, 0, NULL);
27 | WaitForSingleObjectEx(p.NoitfyEvent, INFINITE, FALSE);
28 | CloseHandle(p.NoitfyEvent);
29 | return _hThread != NULL;
30 | }
31 |
32 | void ThreadImpl::OnThreadInvoke(void* param)
33 | {
34 | ThreadInvoke(param);
35 | CloseHandle(_hThread);
36 | _hThread = NULL;
37 | ThreadEnded();
38 | }
39 |
40 | DWORD WINAPI ThreadImpl::DoThreadInvoke(PVOID pv)
41 | {
42 | ThreadParams p = *(ThreadParams*)pv;
43 | SetEvent(p.NoitfyEvent);
44 | ((ThreadImpl*)p.Object)->OnThreadInvoke(p.Userdata);
45 | return GetCurrentThreadId();
46 | }
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/ThreadImpl.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/ThreadImpl.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/UrlHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/MultipartStreamMatroska/MultipartStreamMatroska.Shared/UrlHandler.h
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/main.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "UrlHandler.h"
3 | #include
4 |
5 | HMODULE khInstance;
6 |
7 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
8 | {
9 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
10 | khInstance = hModule;
11 | DisableThreadLibraryCalls(hModule);
12 | Module::GetModule().Create();
13 | }else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
14 | Module::GetModule().Terminate();
15 | }
16 | return TRUE;
17 | }
18 |
19 | STDAPI DllGetActivationFactory(HSTRING activatibleClassId, IActivationFactory** factory)
20 | {
21 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
22 | return E_NOTIMPL;
23 | #else
24 | return Module::GetModule().GetActivationFactory(activatibleClassId, factory);
25 | #endif
26 | }
27 |
28 | STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
29 | {
30 | return Module::GetModule().GetClassObject(rclsid, riid, ppv);
31 | }
32 |
33 | STDAPI DllCanUnloadNow()
34 | {
35 | return Module::GetModule().Terminate() ? S_OK:S_FALSE;
36 | }
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.Shared/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #include
16 | #include
17 |
18 | using namespace Microsoft::WRL;
19 | using namespace Microsoft::WRL::Wrappers;
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.UWP/MultipartStreamMatroska.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MultipartStreamMatroska/MultipartStreamMatroska.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow PRIVATE
3 | DllGetClassObject PRIVATE
4 | DllGetActivationFactory PRIVATE
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.Desktop/RtmpStream.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.Shared/RtmpStream.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/RtmpStream/RtmpStream.Shared/RtmpStream.cpp
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.Shared/RtmpThread.cpp:
--------------------------------------------------------------------------------
1 | #include "RtmpThread.h"
2 |
3 | struct ThreadParams
4 | {
5 | RtmpThread* Object;
6 | void* Userdata;
7 | HANDLE NoitfyEvent;
8 | };
9 |
10 | bool RtmpThread::ThreadStart(void* param)
11 | {
12 | if (_hThread != NULL)
13 | return false;
14 |
15 | ThreadParams p;
16 | p.Object = this;
17 | p.Userdata = param;
18 | #ifdef CreateEventEx
19 | p.NoitfyEvent = CreateEventExW(NULL, NULL, 0, EVENT_ALL_ACCESS);
20 | #else
21 | p.NoitfyEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
22 | #endif
23 | if (p.NoitfyEvent == NULL)
24 | return false;
25 |
26 | _hThread = CreateThread(NULL, 0, &RtmpThread::DoThreadInvoke, &p, 0, NULL);
27 | WaitForSingleObjectEx(p.NoitfyEvent, INFINITE, FALSE);
28 | CloseHandle(p.NoitfyEvent);
29 | return _hThread != NULL;
30 | }
31 |
32 | void RtmpThread::OnThreadInvoke(void* param)
33 | {
34 | ThreadInvoke(param);
35 | CloseHandle(_hThread);
36 | _hThread = NULL;
37 | ThreadEnded();
38 | }
39 |
40 | DWORD WINAPI RtmpThread::DoThreadInvoke(PVOID pv)
41 | {
42 | ThreadParams p = *(ThreadParams*)pv;
43 | SetEvent(p.NoitfyEvent);
44 | ((RtmpThread*)p.Object)->OnThreadInvoke(p.Userdata);
45 | return GetCurrentThreadId();
46 | }
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.Shared/RtmpThread.h:
--------------------------------------------------------------------------------
1 | // Copy from MultipartStreamMatroska
2 | #pragma once
3 |
4 | #include
5 |
6 | class RtmpThread {
7 | protected:
8 | RtmpThread() throw() : _hThread(NULL) {}
9 | ~RtmpThread() throw()
10 | {
11 | if (_hThread) CloseHandle(_hThread);
12 | }
13 |
14 | bool ThreadStart(void* param = NULL);
15 | void ThreadWait(unsigned time = INFINITE)
16 | {
17 | WaitForSingleObjectEx(_hThread, time, FALSE);
18 | }
19 | bool ThreadIsRun() const throw()
20 | {
21 | return _hThread != NULL;
22 | }
23 |
24 | virtual void ThreadInvoke(void* param) = 0;
25 | virtual void ThreadEnded() {}
26 |
27 | private:
28 | void OnThreadInvoke(void* param);
29 |
30 | HANDLE _hThread;
31 | static DWORD WINAPI DoThreadInvoke(PVOID pv);
32 | };
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.Shared/RtmpUrlHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/RtmpStream/RtmpStream.Shared/RtmpUrlHandler.h
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.Shared/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | using namespace Microsoft::WRL;
4 |
5 | HMODULE khInstance;
6 |
7 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
8 | {
9 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
10 | khInstance = hModule;
11 | DisableThreadLibraryCalls(hModule);
12 | Module::GetModule().Create();
13 | }
14 | else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
15 | Module::GetModule().Terminate();
16 | }
17 | return TRUE;
18 | }
19 |
20 | STDAPI DllGetActivationFactory(HSTRING activatibleClassId, IActivationFactory** factory)
21 | {
22 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
23 | return E_NOTIMPL;
24 | #else
25 | return Module::GetModule().GetActivationFactory(activatibleClassId, factory);
26 | #endif
27 | }
28 |
29 | STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
30 | {
31 | return Module::GetModule().GetClassObject(rclsid, riid, ppv);
32 | }
33 |
34 | STDAPI DllCanUnloadNow()
35 | {
36 | return Module::GetModule().Terminate() ? S_OK : S_FALSE;
37 | }
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.UWP/RtmpStream.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/RtmpStream/RtmpStream.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow PRIVATE
3 | DllGetClassObject PRIVATE
4 | DllGetActivationFactory PRIVATE
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/AutoLib.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | class AutoLibrary
4 | {
5 | HMODULE _mod;
6 |
7 | public:
8 | AutoLibrary() noexcept // -> KernelBase.dll
9 | {
10 | MEMORY_BASIC_INFORMATION mbi = {};
11 | VirtualQuery(&VirtualQuery, &mbi, sizeof(mbi));
12 | _mod = (HMODULE)mbi.AllocationBase;
13 | }
14 | explicit AutoLibrary(HMODULE hMod) noexcept { _mod = hMod; }
15 | explicit AutoLibrary(const char* file_name) noexcept
16 | {
17 | MEMORY_BASIC_INFORMATION mbi = {};
18 | VirtualQuery(&VirtualQuery, &mbi, sizeof(mbi));
19 |
20 | AutoLibrary kernel32((HMODULE)mbi.AllocationBase);
21 | _mod = kernel32.GetProcAddr
22 | ("LoadLibraryExA")(file_name, NULL, 0);
23 | }
24 | ~AutoLibrary() noexcept
25 | { if (_mod) FreeLibrary(_mod); }
26 |
27 | inline HMODULE GetModule() const noexcept
28 | { return _mod; }
29 | template
30 | inline Return GetProcAddr(const char* name) const noexcept
31 | { return (Return)GetProcAddress(_mod, name); }
32 | };
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/Core.idl:
--------------------------------------------------------------------------------
1 | import "Playlist.idl";
2 |
3 | namespace SYEngine
4 | {
5 | delegate String PlaylistSegmentUrlUpdateEventHandler
6 | (String unique_id, String op_type, Int32 cur_index, Int32 total_count, String cur_url);
7 |
8 | delegate Boolean PlaylistSegmentDetailUpdateEventHandler
9 | (String unique_id, String op_type, Int32 cur_index, Int32 total_count, IPlaylistNetworkUpdateInfo info);
10 |
11 | static runtimeclass Core
12 | {
13 | static Boolean Initialize();
14 | static Boolean Initialize(IMapView custom_handler);
15 | static void Uninitialize();
16 |
17 | static Double NetworkBufferTimeInSeconds { get; set; };
18 | static Int32 NetworkBufferSizeInBytes { get; set; };
19 |
20 | static Boolean ForceNetworkMode { get; set; };
21 | static Boolean ForceSoftwareDecode { get; set; };
22 |
23 | static PlaylistSegmentUrlUpdateEventHandler PlaylistSegmentUrlUpdateDelegate { get; set; };
24 | static PlaylistSegmentDetailUpdateEventHandler PlaylistSegmentDetailUpdateDelegate { get; set; };
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/MFSeekInfo.hxx:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "pch.h"
4 |
5 | #ifndef __IMFSeekInfo_INTERFACE_DEFINED__
6 | #if (WINVER >= _WIN32_WINNT_WIN8)
7 |
8 | MIDL_INTERFACE("26AFEA53-D9ED-42B5-AB80-E64F9EE34779")
9 | IMFSeekInfo : public IUnknown
10 | {
11 | public:
12 | virtual HRESULT STDMETHODCALLTYPE GetNearestKeyFrames(const GUID*,const PROPVARIANT*,PROPVARIANT*,PROPVARIANT*);
13 | };
14 |
15 | EXTERN_C const GUID MF_SCRUBBING_SERVICE;
16 | #endif
17 | #else
18 | #if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
19 | EXTERN_C const GUID MF_SCRUBBING_SERVICE;
20 | #endif
21 | #endif
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/MediaExtensionInstaller.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "pch.h"
4 | #include "MediaExtensionActivate.h"
5 |
6 | class MediaExtensionInstaller sealed
7 | {
8 | ComPtr _objs;
9 |
10 | public:
11 | MediaExtensionInstaller() { MFStartup(MF_VERSION); MFCreateCollection(&_objs); }
12 | ~MediaExtensionInstaller() { _objs->RemoveAllElements(); MFShutdown(); }
13 |
14 | public:
15 | bool InstallSchemeHandler(LPCWSTR clsid, LPCWSTR activatableClassId, LPCWSTR dllFile, LPCWSTR schemeType);
16 | bool InstallByteStreamHandler(LPCWSTR clsid, LPCWSTR activatableClassId, LPCWSTR dllFile, LPCWSTR fileExt, LPCWSTR mimeType);
17 | };
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/MediaInformation.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "MediaInformation.g.h"
3 |
4 | #include "MediaInfo.h"
5 |
6 |
7 | namespace winrt::SYEngine::implementation {
8 |
9 | struct MediaInformation : MediaInformationT
10 | {
11 | MediaInformation();
12 |
13 | Windows::Foundation::IAsyncAction OpenAsync(Windows::Foundation::Uri uri);
14 |
15 | Windows::Foundation::IAsyncAction OpenAsync(Windows::Storage::Streams::IRandomAccessStream stream);
16 |
17 | Windows::Media::MediaProperties::AudioEncodingProperties GetAudioInfo();
18 |
19 | Windows::Media::MediaProperties::VideoEncodingProperties GetVideoInfo();
20 |
21 | double Duration();
22 |
23 | int64_t FileSize();
24 |
25 | hstring MimeType();
26 |
27 | double GetKeyFrameTime(double user_time);
28 |
29 | private:
30 | void InitAVInfo();
31 |
32 | std::shared_ptr info_;
33 | MediaInfo::FormatInfo format_;
34 | MediaInfo::StreamInfo audio_;
35 | MediaInfo::StreamInfo video_;
36 | };
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/MediaInformation.idl:
--------------------------------------------------------------------------------
1 | namespace SYEngine
2 | {
3 | runtimeclass MediaInformation
4 | {
5 | [default_overload]
6 | Windows.Foundation.IAsyncAction OpenAsync(Windows.Foundation.Uri uri);
7 | Windows.Foundation.IAsyncAction OpenAsync(Windows.Storage.Streams.IRandomAccessStream stream);
8 |
9 | Windows.Media.MediaProperties.AudioEncodingProperties GetAudioInfo();
10 | Windows.Media.MediaProperties.VideoEncodingProperties GetVideoInfo();
11 |
12 | Double Duration { get; };
13 | Int64 FileSize { get; };
14 |
15 | String MimeType { get; };
16 |
17 | Double GetKeyFrameTime(Double user_time);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/Playlist.idl:
--------------------------------------------------------------------------------
1 | namespace SYEngine
2 | {
3 | enum PlaylistTypes
4 | {
5 | LocalFile,
6 | NetworkHttp,
7 | };
8 |
9 | struct PlaylistNetworkConfigs
10 | {
11 | Double ExplicitTotalDurationSeconds;
12 | Boolean DetectDurationForParts;
13 | Boolean NotUseCorrectTimestamp;
14 | Boolean DownloadRetryOnFail;
15 | Int32 FetchNextPartThresholdSeconds;
16 | Int32 BufferBlockSizeKB;
17 | Int32 BufferBlockCount;
18 | String HttpCookie;
19 | String HttpReferer;
20 | String HttpUserAgent;
21 | String UniqueId;
22 | };
23 |
24 | runtimeclass Playlist
25 | {
26 | Playlist(PlaylistTypes type);
27 |
28 | PlaylistNetworkConfigs NetworkConfigs;
29 |
30 | Boolean Append(String url, Int32 sizeInBytes, Single durationInSeconds);
31 | void Clear();
32 | void SetDebugFile(String fileName);
33 | Windows.Foundation.IAsyncOperation SaveAndGetFileUriAsync();
34 | };
35 |
36 | interface IPlaylistNetworkUpdateInfo
37 | {
38 | String Url;
39 | Int32 Timeout;
40 |
41 | Boolean SetRequestHeader(String name, String value);
42 | String GetRequestHeader(String name);
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/SYEngine_UWP.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | using namespace Microsoft::WRL;
13 |
--------------------------------------------------------------------------------
/SYEngine/SYEngine.UWP/readme.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | C++/WinRT SYEngine.UWP Project Overview
3 | ========================================================================
4 |
5 | This project demonstrates how to get started authoring Windows Runtime
6 | classes directly with standard C++, using the C++/WinRT SDK component
7 | to generate implementation headers from interface (IDL) files. The
8 | generated Windows Runtime component binary and WinMD files should then
9 | be bundled with the Universal Windows Platform (UWP) app consuming them.
10 |
11 | Steps:
12 | 1. Create an interface (IDL) file to define your Windows Runtime class,
13 | its default interface, and any other interfaces it implements.
14 | 2. Build the project once to generate module.g.cpp, module.h.cpp, and
15 | implementation templates under the "Generated Files" folder, as
16 | well as skeleton class definitions under "Generated Files\sources".
17 | 3. Use the skeleton class definitions for reference to implement your
18 | Windows Runtime classes.
19 |
20 | ========================================================================
21 | Learn more about C++/WinRT here:
22 | http://aka.ms/cppwinrt/
23 | ========================================================================
24 |
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Desktop/TransformFilter.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/AVCParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __AVC_PARSER_H
2 | #define __AVC_PARSER_H
3 |
4 | struct AVCParser
5 | {
6 | unsigned profile;
7 | unsigned profile_level;
8 | unsigned ref_frames;
9 | unsigned bit_depth; //+8
10 | unsigned max_frame_num; //+4
11 | unsigned max_pic_order_cnt; //+4
12 | unsigned width, height;
13 | unsigned sar_width, sar_height;
14 | unsigned fps_tick, fps_timescale; //if fixed_fps_flag is set, tick * 2.
15 | enum ChromaTypes
16 | {
17 | ChromaFormatUnk = 0,
18 | ChromaFormat420 = 1, //default
19 | ChromaFormat422 = 2,
20 | ChromaFormat444 = 3
21 | };
22 | ChromaTypes chroma_format;
23 | int fixed_fps_flag;
24 | int progressive_flag;
25 | int mbaff_flag; //if progressive_flag is no set.
26 | enum EntropyCodingTypes //from PPS
27 | {
28 | CodingModeCAVLC,
29 | CodingModeCABAC
30 | };
31 | EntropyCodingTypes ec_type;
32 | unsigned lengthSizeMinusOne;
33 |
34 | void ParseSPS(const unsigned char* access_unit, unsigned size) throw();
35 | void ParsePPS(const unsigned char* access_unit, unsigned size) throw();
36 |
37 | void Parse(const unsigned char* buf, unsigned size) throw();
38 | };
39 |
40 | #endif //__AVC_PARSER_H
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/FFmpegAudioDecoder.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "FFmpegDecodeServices.h"
4 |
5 | class FFmpegAudioDecoder
6 | {
7 | public:
8 | FFmpegAudioDecoder() {}
9 | ~FFmpegAudioDecoder() { Close(); }
10 |
11 | public:
12 | IMFMediaType* Open(AVCodecID codecid, IMFMediaType* pMediaType);
13 | void Close();
14 |
15 | HRESULT Decode(IMFSample* pSample, IMFSample** ppDecodedSample);
16 | void Flush();
17 |
18 | private:
19 | HRESULT Process(const BYTE* buf, unsigned size, LONG64 dts, bool discontinuity);
20 | HRESULT CreateDecodedSample(AVFrame* frame, IMFSample** ppSample);
21 | void PackCopyDecodedContent(BYTE* copyTo, unsigned copySize, AVFrame* frame);
22 |
23 | IMFMediaType* CreateResultMediaType(AVCodecContext* ctx);
24 |
25 | private:
26 | AVCodecContext* _context;
27 | AVFrame* _frame;
28 |
29 | WAVEFORMATEX _wfx;
30 | LONG64 _timestamp, _saved_duration;
31 | int _prev_nb_samples;
32 | bool _is_planar;
33 | };
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/FFmpegDecodeFilter.cpp:
--------------------------------------------------------------------------------
1 | #include "FFmpegDecodeFilter.h"
2 | #include "FFmpegDecodeServices.h"
3 | #include
4 |
5 | static std::recursive_mutex kAVCodecMTLock;
6 |
7 | static int AVCodecMTLockCallback(void** mutex, AVLockOp op)
8 | {
9 | switch (op)
10 | {
11 | case AV_LOCK_CREATE:
12 | *mutex = &kAVCodecMTLock;
13 | break;
14 | case AV_LOCK_OBTAIN:
15 | kAVCodecMTLock.lock();
16 | break;
17 | case AV_LOCK_RELEASE:
18 | kAVCodecMTLock.unlock();
19 | break;
20 | case AV_LOCK_DESTROY:
21 | *mutex = NULL;
22 | break;
23 | }
24 | return 0;
25 | }
26 |
27 | HRESULT FFmpegDecodeFilter::QueryInterface(REFIID iid, void** ppv)
28 | {
29 | if (ppv == NULL)
30 | return E_POINTER;
31 | if (iid != IID_IUnknown &&
32 | iid != __uuidof(ITransformFilter))
33 | return E_NOINTERFACE;
34 | *ppv = this;
35 | AddRef();
36 | return S_OK;
37 | }
38 |
39 | HRESULT FFmpegDecodeFilter::GetService(REFIID riid, void** ppv)
40 | {
41 | std::lock_guard lock(_mutex);
42 |
43 | if (_services == NULL) {
44 | avcodec_register_all();
45 | av_lockmgr_register(&AVCodecMTLockCallback); //or to use InitOnceExecuteOnce.
46 |
47 | auto p = new(std::nothrow) FFmpegDecodeServices();
48 | if (p == NULL)
49 | return E_OUTOFMEMORY;
50 | p->QueryInterface(IID_PPV_ARGS(&_services));
51 | p->Release();
52 | }
53 |
54 | if (ppv == NULL)
55 | return E_POINTER;
56 | if (_services == NULL)
57 | return E_ABORT;
58 | return _services->QueryInterface(riid, ppv);
59 | }
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/FFmpegDecodeFilter.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TransformFilter.h"
4 | #include
5 |
6 | class FFmpegDecodeFilter : public ITransformFilter
7 | {
8 | public:
9 | FFmpegDecodeFilter() : _ref_count(1), _services(NULL) {}
10 | virtual ~FFmpegDecodeFilter() { if (_services) _services->Release(); }
11 |
12 | public:
13 | STDMETHODIMP_(ULONG) AddRef() { return InterlockedIncrement(&_ref_count); }
14 | STDMETHODIMP_(ULONG) Release()
15 | { ULONG rc = InterlockedDecrement(&_ref_count); if (rc == 0) delete this; return rc; }
16 | STDMETHODIMP QueryInterface(REFIID iid,void** ppv);
17 |
18 | STDMETHODIMP GetService(REFIID riid, void** ppv);
19 |
20 | private:
21 | ULONG _ref_count;
22 |
23 | IUnknown* _services;
24 | std::recursive_mutex _mutex;
25 | };
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/TransformFilter.Shared.vcxitems.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/TransformFilter.h:
--------------------------------------------------------------------------------
1 | #ifndef __TRANSFORM_FILTER_H_
2 | #define __TRANSFORM_FILTER_H_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #ifndef _DEFINE_COM_INTERFACE
12 | #define _DEFINE_COM_INTERFACE(n,x) class n : public x
13 | #endif
14 | #ifndef _DEFINE_COM_INTERFACE_IID
15 | #define _DEFINE_COM_INTERFACE_IID(n,x,g) MIDL_INTERFACE(g) n : public x
16 | #endif
17 |
18 | _DEFINE_COM_INTERFACE_IID(ITransformFilter,IUnknown,"52C32D23-A134-4334-95F0-A63A2C58982B")
19 | {
20 | public:
21 | virtual STDMETHODIMP GetService(REFIID riid, void** ppv) PURE;
22 | };
23 |
24 | #endif //__TRANSFORM_FILTER_H_
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/TransformServices.h:
--------------------------------------------------------------------------------
1 | #ifndef __TRANSFORM_SERVICES_H_
2 | #define __TRANSFORM_SERVICES_H_
3 |
4 | #include "TransformFilter.h"
5 |
6 | _DEFINE_COM_INTERFACE_IID(ITransformAllocator,IUnknown,"90D4CA50-479B-4664-8008-CC8F88BF2607")
7 | {
8 | public:
9 | virtual STDMETHODIMP CreateSample(IMFSample** ppSample) PURE;
10 | virtual STDMETHODIMP IsUseDXVA(BOOL* bUseDXVA) PURE;
11 | };
12 |
13 | _DEFINE_COM_INTERFACE_IID(ITransformLoader,IUnknown,"91D4CA50-479B-4664-8008-CC8F88BF2607")
14 | {
15 | public:
16 | virtual STDMETHODIMP CheckMediaType(IMFMediaType* pMediaType) PURE;
17 | virtual STDMETHODIMP SetInputMediaType(IMFMediaType* pMediaType) PURE;
18 | virtual STDMETHODIMP GetOutputMediaType(IMFMediaType** ppMediaType) PURE;
19 | virtual STDMETHODIMP GetCurrentInputMediaType(IMFMediaType** ppMediaType) PURE;
20 | virtual STDMETHODIMP GetCurrentOutputMediaType(IMFMediaType** ppMediaType) PURE;
21 | };
22 |
23 | _DEFINE_COM_INTERFACE_IID(ITransformWorker,IUnknown,"92D4CA50-479B-4664-8008-CC8F88BF2607")
24 | {
25 | public:
26 | virtual STDMETHODIMP SetAllocator(ITransformAllocator* pAllocator) PURE;
27 | virtual STDMETHODIMP ProcessSample(IMFSample* pSample, IMFSample** ppNewSample) PURE;
28 | virtual STDMETHODIMP ProcessFlush() PURE;
29 | };
30 |
31 | #endif //__TRANSFORM_SERVICES_H_
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.Shared/main.cpp:
--------------------------------------------------------------------------------
1 | #include "FFmpegDecodeFilter.h"
2 | #include
3 |
4 | HRESULT WINAPI CreateAVCodecTransformFilter(IUnknown** ppunk)
5 | {
6 | if (ppunk == NULL)
7 | return E_INVALIDARG;
8 |
9 | auto p = new(std::nothrow) FFmpegDecodeFilter();
10 | if (p == NULL)
11 | return E_OUTOFMEMORY;
12 |
13 | *ppunk = static_cast(p);
14 | return S_OK;
15 | }
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.UWP/TransformFilter.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TransformFilter/TransformFilter.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | CreateAVCodecTransformFilter
--------------------------------------------------------------------------------
/UpgradeLog.htm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mematrix/SYEngine/71aa35c973d1be0a00581610402cc8035735f7ab/UpgradeLog.htm
--------------------------------------------------------------------------------
/WinhttpWrapper/WinHttpWrapper.UWP/WinHttpWrapper.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/WinhttpWrapper/WinhttpWrapper.Shared/WinhttpWrapper.Shared.vcxitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | {17fa6670-7feb-4abf-a408-aba3c7bd604d}
7 | WinhttpWrapper
8 | WinhttpWrapper.Shared
9 | 248F659F-DAC5-46E8-AC09-60EC9FC95053
10 |
11 |
12 |
13 | %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/WinhttpWrapper/WinhttpWrapper.Shared/WinhttpWrapper.Shared.vcxitems.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/WinhttpWrapper/WinhttpWrapper.Shared/auto_lib.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | class AutoLibrary
4 | {
5 | HMODULE _mod;
6 |
7 | public:
8 | AutoLibrary() throw() // -> KernelBase.dll
9 | {
10 | MEMORY_BASIC_INFORMATION mbi = {};
11 | VirtualQuery(&VirtualQuery, &mbi, sizeof(mbi));
12 | _mod = (HMODULE)mbi.AllocationBase;
13 | }
14 | explicit AutoLibrary(HMODULE hMod) throw() { _mod = hMod; }
15 | explicit AutoLibrary(const char* file_name) throw()
16 | {
17 | MEMORY_BASIC_INFORMATION mbi = {};
18 | VirtualQuery(&VirtualQuery, &mbi, sizeof(mbi));
19 |
20 | AutoLibrary kernel32((HMODULE)mbi.AllocationBase);
21 | _mod = kernel32.GetProcAddr
22 | ("LoadLibraryExA")(file_name, NULL, 0);
23 | }
24 | ~AutoLibrary() throw()
25 | { if (_mod) FreeLibrary(_mod); }
26 |
27 | inline HMODULE GetModule() const throw()
28 | { return _mod; }
29 | template
30 | inline Return GetProcAddr(const char* name) const throw()
31 | { return (Return)GetProcAddress(_mod, name); }
32 | };
--------------------------------------------------------------------------------
/WinhttpWrapper/exports.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | WinHttpAddRequestHeaders @1 NONAME
3 | WinHttpCheckPlatform @2 NONAME
4 | WinHttpCloseHandle @3 NONAME
5 | WinHttpConnect @4 NONAME
6 | WinHttpCrackUrl @5 NONAME
7 | WinHttpCreateUrl @6 NONAME
8 | WinHttpOpen @7 NONAME
9 | WinHttpOpenRequest @8 NONAME
10 | WinHttpQueryDataAvailable @9 NONAME
11 | WinHttpQueryHeaders @10 NONAME
12 | WinHttpQueryOption @11 NONAME
13 | WinHttpReadData @12 NONAME
14 | WinHttpReceiveResponse @13 NONAME
15 | WinHttpSendRequest @14 NONAME
16 | WinHttpSetCredentials @15 NONAME
17 | WinHttpSetOption @16 NONAME
18 | WinHttpSetStatusCallback @17 NONAME
19 | WinHttpSetTimeouts @18 NONAME
20 | WinHttpWriteData @19 NONAME
21 | ObtainUserAgentString @20 NONAME
--------------------------------------------------------------------------------
/ffcodecs/build_config_lgpl.txt:
--------------------------------------------------------------------------------
1 | version: git-75a7565bcb69701823a922c6b2becb35fbd7983f (2016-01-27)
2 | configure:
3 | --disable-programs --disable-dxva2 --disable-network --disable-gpl --disable-doc --disable-avdevice --disable-avfilter --disable-postproc --disable-encoders --disable-muxers --disable-protocols --disable-filters --disable-bsfs --disable-hwaccels --disable-decoders --disable-demuxers --disable-parsers --disable-indevs --disable-outdevs --enable-demuxer=matroska --enable-demuxer=flv --enable-demuxer=mov --enable-demuxer=mpegps --enable-demuxer=mpegts --enable-demuxer=rm --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=vp6 --enable-decoder=vp6a --enable-decoder=vp6f --enable-decoder=vp8 --enable-decoder=vp9 --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=rv30 --enable-decoder=rv40 --enable-decoder=cook --enable-decoder=flac --enable-decoder=alac --enable-decoder=aac --enable-decoder=mp3 --enable-decoder=mp3float --enable-decoder=vorbis --enable-parser=aac --enable-parser=ac3 --enable-parser=dca --enable-parser=flac --enable-parser=vorbis --enable-parser=opus --enable-parser=cook --enable-parser=h264 --enable-parser=hevc --enable-parser=vp8 --enable-parser=vp9 --enable-parser=mpegvideo --enable-parser=mpegaudio --enable-parser=vc1 --enable-parser=rv30 --enable-parser=rv40 --enable-w32threads --disable-shared --disable-debug --enable-static
--------------------------------------------------------------------------------
/ffcodecs/ffcodecs.Desktop/ffcodecs.Desktop.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/ffcodecs/ffcodecs.Shared/ffcodecs.Shared.vcxitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | {7E0215A1-1E2D-414F-A8E9-CA3C7118A192}
7 | ffcodecs
8 | ffcodecs.Shared
9 | 248F659F-DAC5-46E8-AC09-60EC9FC95053
10 |
11 |
12 |
13 | %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ffcodecs/ffcodecs.Shared/ffcodecs.Shared.vcxitems.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ffcodecs/ffcodecs.Shared/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
4 | {
5 | if (ul_reason_for_call == DLL_PROCESS_ATTACH)
6 | DisableThreadLibraryCalls(hModule);
7 | return TRUE;
8 | }
--------------------------------------------------------------------------------
/ffcodecs/ffcodecs.UWP/ffcodecs.UWP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/include/libavcodec/ac3_parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * AC-3 parser prototypes
3 | * Copyright (c) 2003 Fabrice Bellard
4 | * Copyright (c) 2003 Michael Niedermayer
5 | *
6 | * This file is part of FFmpeg.
7 | *
8 | * FFmpeg is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * FFmpeg is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with FFmpeg; if not, write to the Free Software
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 | */
22 |
23 | #ifndef AVCODEC_AC3_PARSER_H
24 | #define AVCODEC_AC3_PARSER_H
25 |
26 | #include
27 | #include
28 |
29 | /**
30 | * Extract the bitstream ID and the frame size from AC-3 data.
31 | */
32 | int av_ac3_parse_header(const uint8_t *buf, size_t size,
33 | uint8_t *bitstream_id, uint16_t *frame_size);
34 |
35 |
36 | #endif /* AVCODEC_AC3_PARSER_H */
37 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/include/libavcodec/adts_parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVCODEC_ADTS_PARSER_H
20 | #define AVCODEC_ADTS_PARSER_H
21 |
22 | #include
23 | #include
24 |
25 | #define AV_AAC_ADTS_HEADER_SIZE 7
26 |
27 | /**
28 | * Extract the number of samples and frames from AAC data.
29 | * @param[in] buf pointer to AAC data buffer
30 | * @param[out] samples Pointer to where number of samples is written
31 | * @param[out] frames Pointer to where number of frames is written
32 | * @return Returns 0 on success, error code on failure.
33 | */
34 | int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
35 | uint8_t *frames);
36 |
37 | #endif /* AVCODEC_ADTS_PARSER_H */
38 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/include/libavutil/avconfig.h:
--------------------------------------------------------------------------------
1 | /* Generated by ffmpeg configure */
2 | #ifndef AVUTIL_AVCONFIG_H
3 | #define AVUTIL_AVCONFIG_H
4 | #define AV_HAVE_BIGENDIAN 0
5 | #define AV_HAVE_FAST_UNALIGNED 1
6 | #endif /* AVUTIL_AVCONFIG_H */
7 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/include/libavutil/ffversion.h:
--------------------------------------------------------------------------------
1 | /* Automatically generated by version.sh, do not manually edit! */
2 | #ifndef AVUTIL_FFVERSION_H
3 | #define AVUTIL_FFVERSION_H
4 | #define FFMPEG_VERSION "n4.3-dev-3717-g569a9d3d70"
5 | #endif /* AVUTIL_FFVERSION_H */
6 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/include/libavutil/hwcontext_mediacodec.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H
20 | #define AVUTIL_HWCONTEXT_MEDIACODEC_H
21 |
22 | /**
23 | * MediaCodec details.
24 | *
25 | * Allocated as AVHWDeviceContext.hwctx
26 | */
27 | typedef struct AVMediaCodecDeviceContext {
28 | /**
29 | * android/view/Surface handle, to be filled by the user.
30 | *
31 | * This is the default surface used by decoders on this device.
32 | */
33 | void *surface;
34 | } AVMediaCodecDeviceContext;
35 |
36 | #endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */
37 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/include/libavutil/macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * @ingroup lavu
22 | * Utility Preprocessor macros
23 | */
24 |
25 | #ifndef AVUTIL_MACROS_H
26 | #define AVUTIL_MACROS_H
27 |
28 | /**
29 | * @addtogroup preproc_misc Preprocessor String Macros
30 | *
31 | * String manipulation macros
32 | *
33 | * @{
34 | */
35 |
36 | #define AV_STRINGIFY(s) AV_TOSTRING(s)
37 | #define AV_TOSTRING(s) #s
38 |
39 | #define AV_GLUE(a, b) a ## b
40 | #define AV_JOIN(a, b) AV_GLUE(a, b)
41 |
42 | /**
43 | * @}
44 | */
45 |
46 | #define AV_PRAGMA(s) _Pragma(#s)
47 |
48 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
49 |
50 | #endif /* AVUTIL_MACROS_H */
51 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/lib/runtime/arm/ffmpeg.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:54378d7659d2130a0cf7a63833cdd839aea0b677d144447fea19d67d00a42ddd
3 | size 9798938
4 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/lib/runtime/x64/ffmpeg.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:3c28c147a289a0873f5906235cad794d58927a9099e84bb9671001776ef67672
3 | size 14436838
4 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/lib/runtime/x86/ffmpeg.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:63f2ad84bcfe911b342b3b53a739e34112a0917f2bf83c0268a77b92af167c2e
3 | size 39509386
4 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/lib/uwp/arm/ffmpeg.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:965a5079b517753ca3b4c751e1138188879c812fd4aba1cd40eede370bf620b4
3 | size 28034260
4 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/lib/uwp/x64/ffmpeg.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:c1d864a218207d066ba45c77bd5eddc4f6a6640c61bc0121e06bb377142cb037
3 | size 36296328
4 |
--------------------------------------------------------------------------------
/ffcodecs/ffmpeg/lib/uwp/x86/ffmpeg.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:ec12372f06662415b05463354b3d9f90c3f4f53e7f7d7bbb76f7cb9bf87c0609
3 | size 26650094
4 |
--------------------------------------------------------------------------------