1 /* Copyright (c) MediaArea.net SARL. All Rights Reserved. 2 * 3 * Use of this source code is governed by a BSD-style license that can 4 * be found in the License.html file in the root of the source tree. 5 */ 6 7 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 // 9 // Some containers use 4-channel stream for 2 AES3 (Stereo) transport 10 // We need to split the 4-channel streams in two before sending 11 // data to AES parser 12 // 13 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 14 15 //--------------------------------------------------------------------------- 16 #ifndef MediaInfo_File_ChannelSplittingH 17 #define MediaInfo_File_ChannelSplittingH 18 //--------------------------------------------------------------------------- 19 20 //--------------------------------------------------------------------------- 21 #include "MediaInfo/Audio/File_Pcm.h" 22 #include <cstring> 23 //--------------------------------------------------------------------------- 24 25 namespace MediaInfoLib 26 { 27 28 //*************************************************************************** 29 // Class File_ChannelSplitting 30 //*************************************************************************** 31 #ifdef MEDIAINFO_SMPTEST0337_YES 32 class File_ChannelSplitting : public File_Pcm_Base 33 { 34 public : 35 //In 36 Ztring Codec; 37 int8u Sign; 38 int8u BitDepth; 39 int16u SamplingRate; 40 bool Aligned; 41 42 struct common 43 { 44 struct channel 45 { 46 int8u* Buffer; 47 size_t Buffer_Size; 48 size_t Buffer_Size_Max; 49 std::vector<File__Analyze*> Parsers; 50 bool IsPcm; 51 channelcommon::channel52 channel() 53 { 54 Buffer=NULL; 55 Buffer_Size=0; 56 Buffer_Size_Max=0; 57 IsPcm=false; 58 } 59 ~channelcommon::channel60 ~channel() 61 { 62 delete[] Buffer; //Buffer=NULL; 63 for (size_t Pos=0; Pos<Parsers.size(); Pos++) 64 delete Parsers[Pos]; 65 } 66 resizecommon::channel67 void resize(size_t NewSize) 68 { 69 delete[] Buffer; 70 Buffer_Size_Max=NewSize; 71 Buffer=new int8u[Buffer_Size_Max]; 72 } 73 }; 74 vector<channel*> SplittedChannels[2]; //0 = Subframe, 1=Frame 75 commoncommon76 common() 77 { 78 } 79 ~commoncommon80 ~common() 81 { 82 for (int c=0; c<2; c++) 83 for (size_t Pos=0; Pos<SplittedChannels[c].size(); Pos++) 84 delete SplittedChannels[c][Pos]; //Channels[c][Pos]=NULL; 85 } 86 }; 87 int64u StreamID; 88 common* Common; 89 int8u Channel_Total; 90 91 //Constructor/Destructor 92 File_ChannelSplitting(); 93 ~File_ChannelSplitting(); 94 95 private : 96 //Streams management 97 void Streams_Fill(); 98 void Streams_Finish(); 99 100 //Buffer - Global 101 void Read_Buffer_Init (); 102 void Read_Buffer_Continue (); 103 void Read_Buffer_Continue_Parse (); 104 void Read_Buffer_Unsynched(); 105 106 //Temp 107 bool AllFilled; 108 bool AllFinished; 109 size_t SplittedChannels_c; 110 size_t SplittedChannels_i; 111 }; 112 113 #endif // MEDIAINFO_SMPTEST0337_YES 114 } //NameSpace 115 116 #endif 117 118