void Reader_Directory::P2_Directory_Cleanup(ZtringList &List) { //if there is a CONTENTS/CLIP folder, this is P2 Ztring ToSearch=Ztring(1, PathSeparator)+_T("CONTENTS")+PathSeparator+_T("CLIP")+PathSeparator; //"/CONTENTS/CLIP/" for (size_t File_Pos=0; File_Pos<List.size(); File_Pos++) { size_t P2_Pos=List[File_Pos].find(ToSearch); if (P2_Pos!=string::npos && P2_Pos!=0 && P2_Pos+1+8+1+4+1+10==List[File_Pos].size()) { //This is a P2 CLIP Ztring Path_Begin=List[File_Pos]; Path_Begin.resize(Path_Begin.size()-(1+8+1+4+1+10)); Path_Begin+=Ztring(1, PathSeparator); bool HasChanged=false; for (size_t Pos=0; Pos<List.size(); Pos++) { if (List[Pos].find(Path_Begin)==0 && List[Pos].find(Path_Begin+_T("CONTENTS")+PathSeparator+_T("CLIP")+PathSeparator)==string::npos) //Remove all subdirs of Path_Begin but not with CLIP { //Removing the file in the P2 directory List.erase(List.begin()+Pos); Pos--; HasChanged=true; } } if (HasChanged) File_Pos=0; } } }
void __fastcall TPreferences_SheetF::Column_Kind0Change(TObject *Sender) { //Look for position of Sender int Pos=0; while (Sender!=Column_Kind[Pos]) Pos++; //Set Pos to 0 Column_Pos[Pos]->ItemIndex=0; //Fill Column_Parameter Column_Parameter[Pos]->Items->Clear(); if (Column_Kind[Pos]->ItemIndex==0) //General Infos_Parameters[Pos].Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("General"))+__T("\r\n"), __T("\r\n\r\n"))); if (Column_Kind[Pos]->ItemIndex==1) //Video Infos_Parameters[Pos].Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Video"))+__T("\r\n"), __T("\r\n\r\n"))); if (Column_Kind[Pos]->ItemIndex==2) //Audio Infos_Parameters[Pos].Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Audio"))+__T("\r\n"), __T("\r\n\r\n"))); if (Column_Kind[Pos]->ItemIndex==3) //Text Infos_Parameters[Pos].Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Text"))+__T("\r\n"), __T("\r\n\r\n"))); if (Column_Kind[Pos]->ItemIndex==4) //Chapters Infos_Parameters[Pos].Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Chapters"))+__T("\r\n"), __T(""))); for (size_t Info_Pos=0; Info_Pos<Infos_Parameters[Pos].size(); Info_Pos++) Column_Parameter[Pos]->Items->Add(Infos_Parameters[Pos].Read(Info_Pos, 0).c_str()); Column_Parameter[Pos]->ItemIndex=0; Column_Parameter0Change(Column_Parameter[Pos]); }
//--------------------------------------------------------------------------- Ztring File::Created_Get() { #ifdef ZENLIB_USEWX if (File_Handle==NULL) #else //ZENLIB_USEWX #ifdef ZENLIB_STANDARD //if (File_Handle==-1) if (File_Handle==NULL) #elif defined WINDOWS if (File_Handle==NULL) #endif #endif //ZENLIB_USEWX return Ztring(); #ifdef ZENLIB_USEWX return Ztring(); //Not implemented #else //ZENLIB_USEWX #ifdef ZENLIB_STANDARD return Ztring(); //Not implemented #elif defined WINDOWS FILETIME TimeFT; if (GetFileTime(File_Handle, &TimeFT, NULL, NULL)) { int64u Time64=0x100000000ULL*TimeFT.dwHighDateTime+TimeFT.dwLowDateTime; Ztring Time; Time.Date_From_Milliseconds_1601(Time64/10000); return Time; } else return Ztring(); //There was a problem #endif #endif //ZENLIB_USEWX }
//--------------------------------------------------------------------------- // Sauvegarde CFG bool ZtringListListF::CFG_Sauvegarder () { File F; if (!F.Create(Name, true)) return Error; Ztring ToWrite; Ztring Propriete, Valeur, Commentaire; ; for (size_t Pos=0; Pos<size(); Pos++) { Propriete=Read(Pos, 0); Valeur=Read(Pos, 1); Commentaire=Read(Pos, 2); if (Propriete!=Ztring()) { ToWrite+=Propriete+__T(" = "); if (Valeur!=Ztring()) ToWrite+=Valeur+__T(" "); } if (Commentaire!=Ztring()) ToWrite+=__T("; ")+Commentaire; ToWrite+=EOL; } F.Write(ToWrite); return true; }
Ztring MediaInfo_Config_PerPackage::Event_CallBackFunction_Set (const Ztring &Value) { ZtringList List=Value; CriticalSectionLocker CSL(CS); if (List.empty()) { Event_CallBackFunction=(MediaInfo_Event_CallBackFunction*)NULL; Event_UserHandler=NULL; } else for (size_t Pos=0; Pos<List.size(); Pos++) { if (List[Pos].find(__T("CallBack=memory://"))==0) Event_CallBackFunction=(MediaInfo_Event_CallBackFunction*)Ztring(List[Pos].substr(18, std::string::npos)).To_int64u(); else if (List[Pos].find(__T("UserHandle=memory://"))==0) Event_UserHandler=(void*)Ztring(List[Pos].substr(20, std::string::npos)).To_int64u(); else if (List[Pos].find(__T("UserHandler=memory://"))==0) Event_UserHandler=(void*)Ztring(List[Pos].substr(21, std::string::npos)).To_int64u(); else return("Problem during Event_CallBackFunction value parsing"); } return Ztring(); }
void __fastcall TPreferences_CustomF::ListeChange(TObject *Sender) { //Save modification Ztring C1=Memo->Text.c_str(); C1.FindAndReplace(__T("\r\n"), __T("\\r\\n")); if (ItemIndex!=-1) EditedCustom(ItemIndex, 1)=C1; ItemIndex=Liste->ItemIndex; //Show new item C1=EditedCustom.Read(ItemIndex, 1); C1.FindAndReplace(__T("\\r\\n"), __T("\r\n")); Memo->Text=C1.c_str(); //Manage list of options Infos->Items->Clear(); if (Liste->ItemIndex==0) Infos_Parameters.Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("General"))+__T("\r\n"), __T("\r\n\r\n"))); else if (Liste->ItemIndex==1) Infos_Parameters.Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Video"))+__T("\r\n"), __T("\r\n\r\n"))); else if (Liste->ItemIndex==2) Infos_Parameters.Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Audio"))+__T("\r\n"), __T("\r\n\r\n"))); else if (Liste->ItemIndex==3) Infos_Parameters.Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Text"))+__T("\r\n"), __T("\r\n\r\n"))); else if (Liste->ItemIndex==4) Infos_Parameters.Write(Ztring(MediaInfoNameSpace::MediaInfo::Option_Static(__T("Info_Parameters_CSV"))).SubString(Prefs->Translate(__T("Chapters"))+__T("\r\n"), __T(""))); else Infos_Parameters.clear(); for (size_t Pos=0; Pos<Infos_Parameters.size(); Pos++) Infos->Items->Add(Infos_Parameters.Read(Pos, 0).c_str()); }
void Reader_Directory::Xdcam_Directory_Cleanup(ZtringList &List) { //if there is a XDCAM/Clip folder, this is Xdcam Ztring ToSearch=Ztring(1, PathSeparator)+_T("Clip")+PathSeparator; //"/Clip/" for (size_t File_Pos=0; File_Pos<List.size(); File_Pos++) { size_t Xdcam_Pos=List[File_Pos].find(ToSearch); if (Xdcam_Pos!=string::npos && Xdcam_Pos!=0 && Xdcam_Pos+1+4+1+12==List[File_Pos].size()) { //This is a XDCAM CLIP Ztring Path_Begin=List[File_Pos]; Path_Begin.resize(Path_Begin.size()-(1+4+1+12)); Path_Begin+=Ztring(1, PathSeparator); if (Dir::Exists(Path_Begin+_T("Edit")) && Dir::Exists(Path_Begin+_T("General")) && Dir::Exists(Path_Begin+_T("Sub"))) { bool HasChanged=false; for (size_t Pos=0; Pos<List.size(); Pos++) { if (List[Pos].find(Path_Begin)==0 && (List[Pos].find(Path_Begin+_T("Clip")+PathSeparator)==string::npos || (List[Pos].find(_T(".XML"))!=List[Pos].size()-4))) //Remove all subdirs of Path_Begin but not with the right XML { //Removing the file in the XDCAM directory List.erase(List.begin()+Pos); Pos--; HasChanged=true; } } if (HasChanged) File_Pos=0; } } } }
Ztring MediaInfo_Config_MediaInfo::Option (const String &Option, const String &Value) { String Option_Lower(Option); size_t Egal_Pos=Option_Lower.find(_T('=')); if (Egal_Pos==string::npos) Egal_Pos=Option_Lower.size(); transform(Option_Lower.begin(), Option_Lower.begin()+Egal_Pos, Option_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix if (Option_Lower==_T("file_isseekable")) { File_IsSeekable_Set(!(Value==_T("0") || Value.empty())); return _T(""); } else if (Option_Lower==_T("file_isseekable_get")) { return File_IsSeekable_Get()?"1":"0"; } else if (Option_Lower==_T("file_forceparser")) { File_ForceParser_Set(Value); return _T(""); } else if (Option_Lower==_T("file_forceparser_get")) { return File_ForceParser_Get(); } else if (Option_Lower==_T("file_filter")) { File_Filter_Set(Ztring(Value).To_int64u()); return _T(""); } else if (Option_Lower==_T("file_filter_get")) { return Ztring();//.From_Number(File_Filter_Get()); } else if (Option_Lower==_T("file_duplicate")) { return File_Duplicate_Set(Value); } else if (Option_Lower==_T("file_duplicate_get")) { //if (File_Duplicate_Get()) return _T("1"); //else // return _T(""); } else if (Option_Lower==_T("file_mpegts_forcemenu")) { File_MpegTs_ForceMenu_Set(!(Value==_T("0") || Value.empty())); return _T(""); } else if (Option_Lower==_T("file_mpegts_forcemenu_get")) { return File_MpegTs_ForceMenu_Get()?"1":"0"; } else return _T("Option not known"); }
//--------------------------------------------------------------------------- void __fastcall TPreferencesF::Sheet_NewClick(TObject *Sender) { AnsiString S1="New"; if (!InputQuery(_T("New sheet"), _T("Enter name of new sheet"), S1)) return; Prefs->Create(Sheet, Ztring().From_Local(S1.c_str())); ComboBox_Update(Sheet_Sel, Sheet); //Selecting and edit Sheet_Sel->ItemIndex=Prefs->FilesList[Sheet].Find(Ztring().From_Local(S1.c_str())); Sheet_EditClick(Sender); }
//--------------------------------------------------------------------------- void __fastcall TPreferencesF::Custom_NewClick(TObject *Sender) { AnsiString S1=_T("New"); if (!InputQuery(_T("New Output"), _T("Enter name of new Output"), S1)) return; Prefs->Create(Custom, Ztring().From_Local(S1.c_str())); ComboBox_Update(Custom_Sel, Custom); //Selecting and edit Custom_Sel->ItemIndex=Prefs->FilesList[Custom].Find(Ztring().From_Local(S1.c_str())); Custom_EditClick(Sender); }
//--------------------------------------------------------------------------- void __fastcall TPreferencesF::Language_NewClick(TObject *Sender) { AnsiString S1="New"; if (!InputQuery(_T("New language"), _T("Enter name of new language"), S1)) return; Prefs->Create(Language, Ztring().From_Local(S1.c_str())); ComboBox_Update(General_Language_Sel, Language); ComboBox_Update(Language_Sel, Language); //Selecting and edit Language_Sel->ItemIndex=Prefs->FilesList[Language].Find(Ztring().From_Local(S1.c_str())); Language_EditClick(Sender); }
//--------------------------------------------------------------------------- Ztring FileName::Path_Get() const { #ifdef ZENLIB_USEWX wxFileName FN(c_str()); return FN.GetPath().c_str(); #else //ZENLIB_USEWX //Path limit size_t Pos_Path=rfind(FileName_PathSeparator); if (Pos_Path==Ztring::npos) return Ztring(); //Not found else return Ztring(*this, 0, Pos_Path); #endif //ZENLIB_USEWX }
//--------------------------------------------------------------------------- void File_DvbSubtitle::Streams_Fill() { Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "DVB Subtitle"); for (std::map<int8u, subtitle_stream_data>::iterator subtitle_stream=subtitle_streams.begin(); subtitle_stream!=subtitle_streams.end(); ++subtitle_stream) for (std::map<int16u, page_data>::iterator page=subtitle_stream->second.pages.begin(); page!=subtitle_stream->second.pages.end(); ++page) for (std::map<int8u, region_data>::iterator region=page->second.regions.begin(); region!=page->second.regions.end(); ++region) { Fill(Stream_Text, 0, "subtitle_stream_id", subtitle_stream->first); (*Stream_More)[Stream_Text][0](Ztring().From_Local("subtitle_stream_id"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "page_id", page->first); (*Stream_More)[Stream_Text][0](Ztring().From_Local("page_id"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_id", region->first); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_id"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_horizontal_address", region->second.page_composition_segment?Ztring::ToZtring(region->second.region_horizontal_address):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_horizontal_address"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_vertical_address", region->second.page_composition_segment?Ztring::ToZtring(region->second.region_vertical_address):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_vertical_address"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_width", region->second.region_composition_segment?Ztring::ToZtring(region->second.region_width):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_width"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_height", region->second.region_composition_segment?Ztring::ToZtring(region->second.region_height):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_height"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_depth", region->second.region_composition_segment?Ztring::ToZtring(DvbSubtitle_region_depth[region->second.region_depth]):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_depth"), Info_Options)=__T("N NI"); } }
//--------------------------------------------------------------------------- // Chargement CFG bool ZtringListListF::CFG_Charger () { //Read file File F(Name); int8u* Buffer=new int8u[(size_t)F.Size_Get()+1]; size_t BytesCount=F.Read(Buffer, (size_t)F.Size_Get()); F.Close(); if (BytesCount==Error) { delete[] Buffer; //Buffer=NULL; return false; } Buffer[(int32u)BytesCount]=(int8u)'\0'; //Convert File --> ZtringList ZtringList List; List.Separator_Set(0, EOL); Ztring Z1; Z1.From_UTF8((char*)Buffer, 0, BytesCount); List.Write(Z1); Ztring SeparatorT=Separator[1]; Separator[1]=__T(";"); Ztring Propriete, Valeur, Commentaire; for (size_t Pos=0; Pos<List.size(); Pos++) { Ztring &Lu=List(Pos); if (Lu.find(__T("="))>0) { //Obtention du Name Propriete=Lu.SubString(Ztring(), __T("=")); NettoyerEspaces(Propriete); //Obtention de la valeur Valeur=Lu.SubString(__T("="), __T(";"), 0, Ztring_AddLastItem); NettoyerEspaces(Valeur); } //Obtention du commentaire Commentaire=Lu.SubString(__T(";"), Ztring(), 0, Ztring_AddLastItem); NettoyerEspaces(Commentaire); //Ecriture push_back((Propriete+__T(";")+Valeur+__T(";")+Commentaire).c_str()); //Visual C++ 6 is old... } Separator[1]=SeparatorT; delete[] Buffer; //Buffer=NULL; return true; }
//--------------------------------------------------------------------------- Ztring File::Modified_Local_Get() { #ifdef ZENLIB_USEWX if (File_Handle==NULL) #else //ZENLIB_USEWX #ifdef ZENLIB_STANDARD //if (File_Handle==-1) if (File_Handle==NULL) #elif defined WINDOWS if (File_Handle==NULL) #endif #endif //ZENLIB_USEWX return Ztring(); #ifdef ZENLIB_USEWX return Ztring(); //Not implemented #else //ZENLIB_USEWX #ifdef ZENLIB_STANDARD struct stat Stat; int Result=stat(File_Name.To_Local().c_str(), &Stat); if (Result<0) return Ztring(); //Error Ztring Time; Time.Date_From_Seconds_1970_Local(Stat.st_mtime); return Time; #elif defined WINDOWS FILETIME TimeFT; if (GetFileTime(File_Handle, NULL, NULL, &TimeFT)) { int64u Time64=0x100000000ULL*TimeFT.dwHighDateTime+TimeFT.dwLowDateTime; //100-ns TIME_ZONE_INFORMATION Info; DWORD Result=GetTimeZoneInformation(&Info); if (Result!=TIME_ZONE_ID_INVALID) { Time64-=((int64s)Info.Bias)*60*1000*1000*10; if (Result==TIME_ZONE_ID_DAYLIGHT) Time64-=((int64s)Info.DaylightBias)*60*1000*1000*10; else Time64-=((int64s)Info.StandardBias)*60*1000*1000*10; } Ztring Time; Time.Date_From_Milliseconds_1601(Time64/10000); Time.FindAndReplace(_T("UTC "), _T("")); return Time; } else return Ztring(); //There was a problem #endif #endif //ZENLIB_USEWX }
//--------------------------------------------------------------------------- void File_SubRip::Read_Buffer_Continue() { if (!IsSub && (Buffer_Size<File_Size && Buffer_Size<65536)) { Element_WaitForMoreData(); return; } ZtringListList Temp; Temp.Separator_Set(0, __T("\r\n\r\n")); Temp.Separator_Set(1, __T("\r\n")); Temp.Write(Ztring().From_UTF8((const char*)Buffer, Buffer_Size>65536?65536:Buffer_Size)); if (Temp.empty()) Temp.Write(Ztring().From_Local((const char*)Buffer, Buffer_Size>65536?65536:Buffer_Size)); // Trying from local code page size_t IsOk=0; size_t IsNok=0; for (size_t Pos=0; Pos<Temp.size(); Pos++) { if (Temp(Pos, 0).To_int64u()==Pos+1) IsOk++; else IsNok++; if (Temp(Pos, 1).size()>22 && Temp(Pos, 1)[2]==__T(':') && Temp(Pos, 1)[5]==__T(':') && Temp(Pos, 1).find(__T(" --> "))!=string::npos) IsOk++; else IsNok++; } if (!IsOk || IsNok>IsOk/2) { Reject(); return; } if (!Status[IsAccepted]) { Accept(); Fill(Stream_General, 0, General_Format, "SubRip"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, "Format", "SubRip"); Fill(Stream_Text, 0, "Codec", "SubRip"); } Element_Offset=File_Size; }
//--------------------------------------------------------------------------- void File_Cdxa::Streams_Finish () { if (!MI) return; //If nothing if (MI->Info==NULL || !MI->Info->Status[IsAccepted]) { Fill(Stream_General, 0, General_Format, "CDXA"); } else { //General MI->Info->Open_Buffer_Finalize(); Merge(*(MI->Info)); Merge(*(MI->Info), Stream_General, 0, 0); const Ztring &Format=Retrieve(Stream_General, 0, General_Format); Fill(Stream_General, 0, General_Format, (Ztring(_T("CDXA/"))+Format).c_str(), Unlimited, true); Clear(Stream_General, 0, General_Duration); Clear(Stream_Video, 0, Video_Duration); } //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data { delete MI; MI=NULL; } }
void MediaInfo_Config_MediaInfo::Event_Send (const int8u* Data_Content, size_t Data_Size, const Ztring &File_Name) { CriticalSectionLocker CSL(CS); if (Event_CallBackFunction) Event_CallBackFunction ((unsigned char*)Data_Content, Data_Size, Event_UserHandler); else { MediaInfo_Event_Generic* Event_Generic=(MediaInfo_Event_Generic*)Data_Content; if ((Event_Generic->EventCode&0x00FFFF00)==(MediaInfo_Event_Global_Demux<<8)) { if (!MediaInfoLib::Config.Demux_Get()) return; if (File_Name.empty()) return; MediaInfo_Event_Global_Demux_0* Event=(MediaInfo_Event_Global_Demux_0*)Data_Content; Ztring File_Name_Final(File_Name); for (size_t Pos=0; Pos<Event->StreamIDs_Size; Pos++) File_Name_Final+=_T(".")+Ztring().From_Number(Event->StreamIDs[Pos], 16); File_Name_Final+=_T(".raw"); File F; F.Open(File_Name_Final, File::Access_Write_Append); F.Write(Event->Content, Event->Content_Size); } } }
//--------------------------------------------------------------------------- void File_Pdf::Object_Root() { Element_Info1("Document Catalog"); //Parsing string Key; Ztring Value; while (Element_Offset<Element_Size) { if (Get_Next(Key, Value)) { for (;;) { Get_Next(Key, Value); if (Key.empty()) break; else if (Key=="Metadata") { int32u ObjectNumber=Value.To_int32u(); Objects[ObjectNumber].Type=Type_Metadata; Objects[ObjectNumber].TopObject=Objects_Current->first; Objects[Objects_Current->first].Bottoms.push_back(ObjectNumber); Param_Info1(__T("Metadata is at offset 0x"+Ztring().From_Number(Objects[ObjectNumber].Offset))); } } continue; } if (Key.empty()) break; } }
//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Header_Parse() { //Parsing size_t Size=0; int8u type, Size_ToAdd; Get_B1(type, "type"); if (type==0) { Header_Fill_Code(0x00, "Padding"); Header_Fill_Size(1); return; } do { Get_B1(Size_ToAdd, "size"); Size=(Size<<7) | (Size_ToAdd&0x7F); } while (Size_ToAdd&0x80); //Filling Header_Fill_Code(type, Ztring().From_CC1(type)); if (Element_Offset+Size>=Element_Size) Size=(size_t)(Element_Size-Element_Offset); //Found one file with too big size but content is OK, cutting the block Header_Fill_Size(Element_Offset+Size); }
//--------------------------------------------------------------------------- // Operator () Ztring &ZtringList::operator() (size_type Pos) { if (Pos>=size()) Write(Ztring(), Pos); return operator[](Pos); }
//--------------------------------------------------------------------------- void Riff_AVI__Tdat_tc_O::Read_Internal () { //Integrity if (Global->iXML) throw exception_valid("2 tc_O chunks"); //Reading Read_Internal_ReadAllInBuffer(); //Parsing Ztring Value; bool IsOk=true; for (Chunk.Content.Buffer_Offset=0; Chunk.Content.Buffer_Offset<Chunk.Content.Size; Chunk.Content.Buffer_Offset++) if (Chunk.Content.Buffer[Chunk.Content.Buffer_Offset]!=0x00 && Chunk.Content.Buffer[Chunk.Content.Buffer_Offset]!=':' && Chunk.Content.Buffer[Chunk.Content.Buffer_Offset]!=';' && (Chunk.Content.Buffer[Chunk.Content.Buffer_Offset]<'0' || Chunk.Content.Buffer[Chunk.Content.Buffer_Offset]>'9')) { IsOk=false; break; } Chunk.Content.Buffer_Offset=0; if (IsOk) Get_String(Chunk.Content.Size, Value); else for (Chunk.Content.Buffer_Offset=0; Chunk.Content.Buffer_Offset<Chunk.Content.Size; Chunk.Content.Buffer_Offset++) Value+=Ztring().From_CC1(Chunk.Content.Buffer+Chunk.Content.Buffer_Offset); //Filling Global->Tdat->Strings["tc_o"]=Value; }
//--------------------------------------------------------------------------- void File_Nut::Header_Parse() { //Parsing int8u N; Peek_B1(N); if (N==0x4E) //'N' { //Header int64u startcode, forward_ptr; Get_B8(startcode, "startcode"); Get_VS(forward_ptr, "forward_ptr"); if (forward_ptr>4096) Skip_B4( "header_checksum"); Header_Fill_Code(startcode, Ztring().From_Number(startcode, 16)); //Quick filling for CC8 with text Header_Fill_Size(Element_Offset+forward_ptr); //4 for cheksum } else { //Frame Header_Fill_Code(0, "Frame"); Header_Fill_Size(0); Finish(); } }
//--------------------------------------------------------------------------- void File_Caf::desc() { //Parsing float64 SampleRate; int32u FormatID, FormatFlags, BytesPerPacket, FramesPerPacket, ChannelsPerFrame, BitsPerChannel; Get_BF8(SampleRate, "SampleRate"); Get_C4 (FormatID, "FormatID"); Get_B4 (FormatFlags, "FormatFlags"); Get_B4 (BytesPerPacket, "BytesPerPacket"); Get_B4 (FramesPerPacket, "FramesPerPacket"); Get_B4 (ChannelsPerFrame, "ChannelsPerFrame"); Get_B4 (BitsPerChannel, "BitsPerChannel"); FILLING_BEGIN(); if (SampleRate) Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); CodecID_Fill(Ztring().From_CC4(FormatID), Stream_Audio, 0, InfoCodecID_Format_Mpeg4); if (ChannelsPerFrame) Fill(Stream_Audio, 0, Audio_Channel_s_, ChannelsPerFrame); if (BitsPerChannel) Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerChannel); if (BytesPerPacket && SampleRate && FramesPerPacket) Fill(Stream_Audio, 0, Audio_BitRate, SampleRate*BytesPerPacket*8/FramesPerPacket); FILLING_END(); }
InfoMap::InfoMap (const char* S) : std::multimap<ZenLib::Ztring, ZenLib::ZtringList> () { Separator[0]=EOL; Separator[1]=__T(";"); Write(Ztring(S)); }
//--------------------------------------------------------------------------- void File_Exr::Header_Parse() { //Header if (CC4(Buffer+Buffer_Offset)==0x762F3101) //"v/1"+1 { //Filling Header_Fill_Code(0, "File header"); Header_Fill_Size(12); return; } //Image data if (name_End==0) { //Filling Header_Fill_Code(0, "Image data"); Header_Fill_Size(ImageData_End-(File_Offset+Buffer_Offset)); return; } int32u size; Get_String(name_End, name, "name"); Element_Offset++; //Null byte Get_String(type_End, type, "type"); Element_Offset++; //Null byte Get_L4 (size, "size"); //Filling Header_Fill_Code(0, Ztring().From_Local(name.c_str())); Header_Fill_Size(name_End+1+type_End+1+4+size); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::Header_Parse() { if (TotalSize<=15) //First 10 is minimum size of a tag, Second 10 is ID3v2 header size { //Place for footer Header_Fill_Code((int64u)-1, "File Footer"); Header_Fill_Size(TotalSize); return; } //Parsing Ztring SizeT; int64u Size; int32u Field; Get_C3 (Field, "Field"); Get_Local(5, SizeT, "Size"); Size=8+SizeT.To_int64u(); //Filling if (Size+15>TotalSize) Size=TotalSize-15; Header_Fill_Code(Field, Ztring().From_CC3(Field)); Header_Fill_Size(Size); TotalSize-=Size; }
void ZtringListList::Write(const Ztring &ToWrite, size_type Pos0, size_type Pos1) { if (Pos0>=size()) Write(Ztring(), Pos0); operator[](Pos0).Write(ToWrite, Pos1); }
void Reader_Directory::Bdmv_Directory_Cleanup(ZtringList &List) { //if there is a BDMV folder, this is blu-ray Ztring ToSearch=Ztring(1, PathSeparator)+_T("BDMV")+PathSeparator+_T("index.bdmv"); //"\BDMV\index.bdmv" for (size_t File_Pos=0; File_Pos<List.size(); File_Pos++) { size_t BDMV_Pos=List[File_Pos].find(ToSearch); if (BDMV_Pos!=string::npos && BDMV_Pos!=0 && BDMV_Pos+16==List[File_Pos].size()) { //This is a BDMV index, parsing the directory only if index and movie objects are BOTH present ToSearch=List[File_Pos]; ToSearch.resize(ToSearch.size()-10); ToSearch+=_T("MovieObject.bdmv"); //"%CompletePath%\BDMV\MovieObject.bdmv" if (List.Find(ToSearch)!=string::npos) { //We want the folder instead of the files List[File_Pos].resize(List[File_Pos].size()-11); //only %CompletePath%\BDMV ToSearch=List[File_Pos]; for (size_t Pos=0; Pos<List.size(); Pos++) { if (List[Pos].find(ToSearch)==0 && List[Pos]!=ToSearch) //Remove all subdirs of ToSearch but not ToSearch { //Removing the file in the blu-ray directory List.erase(List.begin()+Pos); Pos--; } } } } } }
//--------------------------------------------------------------------------- // An Element // Size 2 bytes, Pos=4 // Code 5 bytes, Pos=6 // void File_Jpeg::Header_Parse() { //Parsing int16u code, size=0; Get_B2 (code, "code"); switch (code) { case Elements::TEM : case Elements::RST0 : case Elements::RST1 : case Elements::RST2 : case Elements::RST3 : case Elements::RST4 : case Elements::RST5 : case Elements::RST6 : case Elements::RST7 : case Elements::SOI : case Elements::EOI : break; //Size=0 default : Get_B2 (size, "size"); } //Filling Header_Fill_Code(code, Ztring().From_CC2(code)); Header_Fill_Size(2+size); }