本文整理汇总了C++中Ztring类的典型用法代码示例。如果您正苦于以下问题:C++ Ztring类的具体用法?C++ Ztring怎么用?C++ Ztring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ztring类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RJMD_property
//---------------------------------------------------------------------------
void File_Rm::RJMD_property(std::string Name)
{
//Element_Name("Property");
//Parsing
Ztring value;
std::string name;
int32u type, flags, num_subproperties, name_length, value_length;
Element_Begin1("MetadataProperty");
Skip_B4( "size");
Get_B4 (type, "type");
Get_B4 (flags, "flags");
Skip_Flags(flags, 0, "readonly"); //Read only, cannot be modified.
Skip_Flags(flags, 1, "private"); //Private, do not expose to users.
Skip_Flags(flags, 2, "type_dexcriptor"); //Type descriptor used to further define type of value.
Skip_B4( "value_offset"); //The offset to the value_length , relative to the beginning of the MetadataProperty structure.
Skip_B4( "subproperties_offset"); //The offset to the subproperties_list , relative to the beginning of the MetadataProperty structure.
Get_B4 (num_subproperties, "num_subproperties"); //The number of subproperties for this MetadataProperty structure.
Get_B4 (name_length, "name_length"); //The length of the name data, including the null-terminator.
Get_String(name_length, name, "name"); //The name of the property (string data).
Get_B4 (value_length, "value_length"); //The length of the value data.
switch(type)
{
case 0x00 : //Nothing
Skip_XX(value_length, "Junk");
break;
case 0x01 : //String (text).
Get_Local(value_length, value, "value"); //String.
break;
case 0x02 : //Separated list of strings, separator specified as sub-property/type descriptor.
Get_Local(value_length, value, "value"); //String.
break;
case 0x03 : //Boolean flag—either 1 byte or 4 bytes, check size value.
switch(value_length)
{
case 1 : {
int8u valueI;
Get_L1(valueI, "value"); //1-byte boolean.
value.From_Number(valueI);
}
break;
case 4 : {
int32u valueI;
Get_L4(valueI, "value"); //4-byte boolean.
value.From_Number(valueI);
}
break;
default: Skip_XX(value_length, "Unknown");
}
break;
case 0x04 : //Four-byte integer.
{
int32u valueI;
Get_L4(valueI, "value");
value.From_Number(valueI);
}
break;
case 0x05 : //Byte stream.
Skip_XX(value_length, "Byte stream");
break;
case 0x06 : //String (URL).
Get_Local(value_length, value, "value"); //String.
break;
case 0x07 : //String representation of the date in the form: YYYYmmDDHHMMSS (m = month, M = minutes).
Get_Local(value_length, value, "value"); //String.
break;
case 0x08 : //String (file name)
Get_Local(value_length, value, "value"); //String.
break;
case 0x09 : //This property has subproperties, but its own value is empty.
Skip_XX(value_length, "junk");
break;
case 0x0A : //Large buffer of data, use sub-properties/type descriptors to identify mime-type.
Skip_XX(value_length, "data");
break;
default : //Unknown
Skip_XX(value_length, "unknown");
break;
}
//Filling
if (!Name.empty())
Name+='/';
Name+=name;
if (Name!="Track/Comments/DataSize"
&& Name!="Track/Comments/MimeType"
)
Fill(Stream_General, 0, Name.c_str(), value);
//Parsing
for (int32u Pos=0; Pos<num_subproperties; Pos++)
{
Element_Begin1("PropListEntry");
Skip_B4( "offset"); //The offset for this indexed sub-property, relative to the beginning of the containing MetadataProperty.
Skip_B4( "num_props_for_name"); //The number of sub-properties that share the same name. For example, a lyrics property could have multiple versions as differentiated by the language sub-property type descriptor.
Element_End0();
}
for (int32u Pos=0; Pos<num_subproperties; Pos++)
{
//.........这里部分代码省略.........
开发者ID:aleksei-t,项目名称:flylinkdc-r5xx,代码行数:101,代码来源:File_Rm.cpp
示例2: Reject
//---------------------------------------------------------------------------
bool File_Dxw::FileHeader_Begin()
{
XMLDocument document;
if (!FileHeader_Begin_XML(document))
return false;
{
XMLElement* Root=document.FirstChildElement("indexFile");
if (Root)
{
const char* Attribute=Root->Attribute("xmlns");
if (Attribute==NULL || Ztring().From_UTF8(Attribute)!=__T("urn:digimetrics-xml-wrapper"))
{
Reject("DXW");
return false;
}
Accept("DXW");
Fill(Stream_General, 0, General_Format, "DXW");
ReferenceFiles_Accept(this, Config);
#if defined(MEDIAINFO_REFERENCES_YES)
XMLElement* Track=Root->FirstChildElement();
while (Track)
{
if (string(Track->Value())=="clip")
{
sequence* Sequence=new sequence;
Attribute=Track->Attribute("file");
if (Attribute)
{
Sequence->AddFileName(Ztring().From_UTF8(Attribute));
Attribute=Track->Attribute("type");
if (Attribute)
{
Ztring StreamKind; StreamKind.From_UTF8(Attribute);
if (StreamKind==__T("video"))
Sequence->StreamKind=Stream_Video;
if (StreamKind==__T("audio"))
Sequence->StreamKind=Stream_Audio;
if (StreamKind==__T("data"))
Sequence->StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing
}
Attribute=Track->Attribute("source");
if (Attribute)
{
Ztring StreamKind; StreamKind.From_UTF8(Attribute);
if (StreamKind==__T("main"))
Sequence->IsMain=true;
}
Attribute=Track->Attribute("default_timecode");
if (Attribute)
{
Sequence->Config["File_DefaultTimeCode"].From_UTF8(Attribute);
}
Sequence->StreamID=ReferenceFiles->Sequences_Size()+1;
}
Attribute=Track->Attribute("framerate");
if (Attribute)
{
Sequence->FrameRate_Set(Ztring().From_UTF8(Attribute).To_float64());
Attribute=Track->Attribute("type");
if (Attribute)
{
Ztring StreamKind; StreamKind.From_UTF8(Attribute);
if (StreamKind==__T("video"))
Sequence->StreamKind=Stream_Video;
if (StreamKind==__T("audio"))
Sequence->StreamKind=Stream_Audio;
if (StreamKind==__T("data"))
Sequence->StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing
}
XMLElement* Frame=Track->FirstChildElement();
while (Frame)
{
if (string(Frame->Value())=="frame")
{
Attribute=Frame->Attribute("file");
if (Attribute)
Sequence->AddFileName(Ztring().From_UTF8(Attribute));
}
Frame=Frame->NextSiblingElement();
}
}
Sequence->StreamID=ReferenceFiles->Sequences_Size()+1;
ReferenceFiles->AddSequence(Sequence);
}
//.........这里部分代码省略.........
开发者ID:MediaArea,项目名称:MediaInfoLib,代码行数:101,代码来源:File_Dxw.cpp
示例3: IsWin9X
namespace ZenLib
{
//***************************************************************************
// OS info
//***************************************************************************
//---------------------------------------------------------------------------
bool IsWin9X ()
{
#ifdef ZENLIB_USEWX
return true;
#else //ZENLIB_USEWX
#ifdef WINDOWS
if (GetVersion()<0x80000000)
return false;
else
return true;
#else //WINDOWS
return true;
#endif
#endif //ZENLIB_USEWX
}
//***************************************************************************
// Shell
//***************************************************************************
void Shell_Execute(const Ztring &ToExecute)
{
#ifdef ZENLIB_USEWX
#else //ZENLIB_USEWX
#ifdef WINDOWS
#ifdef UNICODE
if (IsWin9X())
ShellExecuteA(NULL, "open", ToExecute.To_Local().c_str(), NULL, NULL, 0);
else
ShellExecute (NULL, _T("open"), ToExecute.c_str(), NULL, NULL, 0);
#else
ShellExecute(NULL, _T("open"), ToExecute.c_str(), NULL, NULL, 0);
#endif
#else
//Not supported
#endif
#endif //ZENLIB_USEWX
}
//***************************************************************************
// Directories
//***************************************************************************
//---------------------------------------------------------------------------
// Select directory code
// Extracted from TBffolder by Torsten Johann ([email protected])
Ztring Directory_Select_Caption;
#ifdef WINDOWS
#ifdef UNICODE
char InitDirA[MAX_PATH];
wchar_t InitDir [MAX_PATH];
int __stdcall ShowOpenFolder_CallbackProc (HWND hwnd, UINT uMsg, LPARAM, LPARAM)
{
if (uMsg==BFFM_INITIALIZED)
{
if (IsWin9X())
{
SetWindowTextA (hwnd, Directory_Select_Caption.To_Local().c_str()); // Caption
SendMessageA (hwnd, BFFM_ENABLEOK, 0, TRUE);
SendMessageA (hwnd, BFFM_SETSELECTION, true, (LPARAM)&InitDirA);
}
else
{
SetWindowText (hwnd, Directory_Select_Caption.c_str()); // Caption
SendMessage (hwnd, BFFM_ENABLEOK, 0, TRUE);
SendMessage (hwnd, BFFM_SETSELECTION, true, (LPARAM)&InitDir);
}
}
return 0;
}
Ztring OpenFolder_Show(void* Handle, const Ztring &Title, const Ztring &Caption)
{
//Caption
Directory_Select_Caption=Caption;
if (IsWin9X())
{
return Ztring(); //Not supported in Win9X
}
else
{
//Values
LPMALLOC Malloc;
LPSHELLFOLDER ShellFolder;
BROWSEINFO BrowseInfo;
LPITEMIDLIST ItemIdList;
//Initializing the SHBrowseForFolder function
//.........这里部分代码省略.........
开发者ID:eagleatustb,项目名称:p2pdown,代码行数:101,代码来源:OS_Utils.cpp
示例4: Reject
//---------------------------------------------------------------------------
bool File_Hls::FileHeader_Begin()
{
//Element_Size
if (File_Size>1024*1024 || File_Size<10)
{
Reject("HLS");
return false; //HLS files are not big
}
if (Buffer_Size<File_Size)
return false; //Wait for complete file
Ztring Document; Document.From_UTF8((char*)Buffer, Buffer_Size);
ZtringList Lines;
size_t LinesSeparator_Pos=Document.find_first_of(__T("\r\n"));
if (LinesSeparator_Pos>File_Size-1)
{
Reject("HLS");
return false;
}
Ztring LinesSeparator;
if (Document[LinesSeparator_Pos]==__T('\r') && LinesSeparator_Pos+1<Document.size() && Document[LinesSeparator_Pos+1]==__T('\n'))
LinesSeparator=__T("\r\n");
else if (Document[LinesSeparator_Pos]==__T('\r'))
LinesSeparator=__T("\r");
else if (Document[LinesSeparator_Pos]==__T('\n'))
LinesSeparator=__T("\n");
else
{
Reject("HLS");
return false;
}
Lines.Separator_Set(0, LinesSeparator);
Lines.Write(Document);
if (Lines(0)!=__T("#EXTM3U"))
{
Reject("HLS");
return false;
}
Accept("HLS");
Fill(Stream_General, 0, General_Format, "HLS");
ReferenceFiles=new File__ReferenceFilesHelper(this, Config);
if (!IsSub)
ReferenceFiles->ContainerHasNoId=true;
File__ReferenceFilesHelper::reference ReferenceFile;
bool IsGroup=false;
for (size_t Line=0; Line<Lines.size(); Line++)
{
if (!Lines[Line].empty())
{
if (Lines[Line].find(__T("#EXT-X-KEY:"))==0)
{
ZtringListList List;
List.Separator_Set(0, __T(","));
List.Separator_Set(1, __T("="));
List.Write(Lines[Line].substr(11, string::npos));
for (size_t Pos=0; Pos<List.size(); ++Pos)
{
if (List[Pos](0)==__T("METHOD"))
{
if (List[Pos](1).find(__T("AES-128"))==0)
{
Fill(Stream_General, 0, General_Encryption_Format, "AES");
Fill(Stream_General, 0, General_Encryption_Length, "128");
Fill(Stream_General, 0, General_Encryption_Method, "Segment");
Fill(Stream_General, 0, General_Encryption_Mode, "CBC");
Fill(Stream_General, 0, General_Encryption_Padding, "PKCS7");
Fill(Stream_General, 0, General_Encryption_InitializationVector, "Sequence number");
#if MEDIAINFO_AES
//Trying to get the key from FileName.FileExt.key
if (Config->Encryption_Key_Get().empty())
{
File KeyFile;
if (KeyFile.Open(File_Name+__T(".key")))
{
if (KeyFile.Size_Get()==16)
{
int8u Key[16];
if (KeyFile.Read(Key, 16)==16)
Config->Encryption_Key_Set(Key, 16);
}
else
Fill(Stream_General, 0, "Encryption_Key_Problem", KeyFile.Size_Get());
}
}
#endif
}
Fill(Stream_General, 0, General_Encryption, List[Pos](1));
}
}
}
else if (Lines[Line].find(__T("#EXT-X-STREAM-INF:"))==0)
{
//.........这里部分代码省略.........
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:101,代码来源:File_Hls.cpp
示例5: Peek_B4
//---------------------------------------------------------------------------
void File_Id3::Read_Buffer_Continue()
{
//Buffer size
if (Buffer_Size<128)
return;
int32u Magic;
Peek_B4(Magic);
Ztring TitleAddition;
Ztring ArtistAddition;
Ztring AlbumAddition;
Ztring GenreAddition;
if (Magic==0x5441472B)
{
if (Buffer_Size<227+128)
return;
Skip_C4 ( "ID");
Get_Local (60, TitleAddition, "Title");
Get_Local (60, ArtistAddition, "Artist");
Get_Local (60, AlbumAddition, "Album");
Skip_B1 ( "Speed");
Get_Local (30, GenreAddition, "Genre");
Skip_Local(6, "Start time"); //mmm:ss
Skip_Local(6, "End time"); //mmm:ss
TitleAddition.TrimRight();
ArtistAddition.TrimRight();
AlbumAddition.TrimRight();
GenreAddition.TrimRight();
}
//Parsing
Ztring Title, Artist, Album, Year, Comment;
int8u Track=0, Genre;
Skip_C3 ( "ID");
Get_Local (30, Title, "Title");
Get_Local (30, Artist, "Artist");
Get_Local (30, Album, "Album");
Get_Local ( 4, Year, "Year");
Get_Local (30, Comment, "Comment");
if (Comment.size()<29) //Id3v1.1 specifications : Track number addition
{
Element_Offset-=2;
int8u Zero;
Peek_B1(Zero);
if (Zero==0)
{
Skip_B1( "Zero");
Get_B1 (Track, "Track");
}
else
Element_Offset+=2;
}
Get_B1 (Genre, "Genre");
FILLING_BEGIN();
if (TitleAddition.empty())
Title.TrimRight();
if (ArtistAddition.empty())
Artist.TrimRight();
if (AlbumAddition.empty())
Album.TrimRight();
Year.TrimRight();
Comment.TrimRight();
Accept("Id3");
Stream_Prepare(Stream_General);
Fill(Stream_General, 0, General_Album, Album+AlbumAddition);
Fill(Stream_General, 0, General_Track, Title+TitleAddition);
Fill(Stream_General, 0, General_Performer, Artist+ArtistAddition);
Fill(Stream_General, 0, General_Comment, Comment);
Fill(Stream_General, 0, General_Recorded_Date, Year);
if (GenreAddition.empty())
Fill(Stream_General, 0, General_Genre, GenreAddition);
if (Genre && Genre!=(int8u)-1)
Fill(Stream_General, 0, General_Genre, Genre);
if (Track)
Fill(Stream_General, 0, General_Track_Position, Track);
Finish("Id3");
FILLING_END();
}
开发者ID:wangarong,项目名称:mpc-loop,代码行数:85,代码来源:File_Id3.cpp
示例6: __T
//---------------------------------------------------------------------------
Ztring Export_PBCore::Transform(MediaInfo_Internal &MI)
{
//Current date/time is ISO format
time_t Time=time(NULL);
Ztring TimeS; TimeS.Date_From_Seconds_1970((int32u)Time);
TimeS.FindAndReplace(__T("UTC "), __T(""));
TimeS.FindAndReplace(__T(" "), __T("T"));
TimeS+=__T('Z');
Ztring ToReturn;
ToReturn+=__T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
ToReturn+=__T("<PBCoreDescriptionDocument xsi:schemaLocation=\"http://www.pbcore.org/PBCore/PBCoreNamespace.html http://www.pbcore.org/PBCore/PBCoreXSD_Ver_1-2-1.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.pbcore.org/PBCore/PBCoreNamespace.html\">\n");
ToReturn+=__T("\t<!-- Generated at ")+TimeS+__T(" by ")+MediaInfoLib::Config.Info_Version_Get()+__T(" -->\n");
ToReturn+=__T("\t<!-- Warning: MediaInfo outputs only pbcoreInstantiation, other mandatory PBCore data is junk -->\n");
ToReturn+=__T("\t<pbcoreIdentifier>\n");
ToReturn+=__T("\t\t<identifier>***</identifier>\n");
ToReturn+=__T("\t\t<identifierSource>***</identifierSource>\n");
ToReturn+=__T("\t</pbcoreIdentifier>\n");
ToReturn+=__T("\t<pbcoreTitle>\n");
ToReturn+=__T("\t\t<title>***</title>\n");
ToReturn+=__T("\t</pbcoreTitle>\n");
ToReturn+=__T("\t<pbcoreDescription>\n");
ToReturn+=__T("\t\t<description>***</description>\n");
ToReturn+=__T("\t\t<descriptionType>***</descriptionType>\n");
ToReturn+=__T("\t</pbcoreDescription>\n");
ToReturn+=__T("\t<pbcoreInstantiation>\n");
//pbcoreFormatID
ToReturn+=__T("\t\t<pbcoreFormatID>\n");
//formatIdentifier
ToReturn+=__T("\t\t\t<formatIdentifier>")+MI.Get(Stream_General, 0, General_FileName)+__T("</formatIdentifier>\n");
//formatIdentifierSource
ToReturn+=__T("\t\t\t<formatIdentifierSource version=\"PBCoreXSD_Ver_1.2_D1\">File Name</formatIdentifierSource>\n");
ToReturn+=__T("\t\t</pbcoreFormatID>\n");
//formatDigital
if (!MI.Get(Stream_General, 0, General_InternetMediaType).empty())
{
ToReturn+=__T("\t\t<formatDigital>");
ToReturn+=MI.Get(Stream_General, 0, General_InternetMediaType);
ToReturn+=__T("</formatDigital>\n");
}
else
{
//TODO: how to implement formats without Media Type?
ToReturn+=__T("\t\t<formatDigital>");
if (MI.Count_Get(Stream_Video))
ToReturn+=__T("video/x-");
else if (MI.Count_Get(Stream_Image))
ToReturn+=__T("image/x-");
else if (MI.Count_Get(Stream_Audio))
ToReturn+=__T("audio/x-");
else
ToReturn+=__T("application/x-");
ToReturn+=Ztring(MI.Get(Stream_General, 0, __T("Format"))).MakeLowerCase();
ToReturn+=__T("</formatDigital>\n");
}
//formatLocation
ToReturn+=__T("\t\t<formatLocation>")+MI.Get(Stream_General, 0, General_CompleteName)+__T("</formatLocation>\n");
//dateCreated
if (!MI.Get(Stream_General, 0, General_Encoded_Date).empty())
{
Ztring dateCreated=MI.Get(Stream_General, 0, General_Recorded_Date);
dateCreated.FindAndReplace(__T("UTC"), __T("-"));
dateCreated.FindAndReplace(__T(" "), __T("T"));
dateCreated+=__T('Z');
ToReturn+=__T("\t\t<dateCreated>")+dateCreated+__T("</dateCreated>\n");
}
//dateIssued
if (!MI.Get(Stream_General, 0, General_Recorded_Date).empty())
{
Ztring dateIssued=MI.Get(Stream_General, 0, General_Recorded_Date);
dateIssued.FindAndReplace(__T("UTC"), __T("-"));
dateIssued.FindAndReplace(__T(" "), __T("T"));
dateIssued+=__T('Z');
ToReturn+=__T("\t\t<dateIssued>")+dateIssued+__T("</dateIssued>\n");
}
//formatMediaType
if (!PBCore_MediaType(MI).empty())
ToReturn+=__T("\t\t<formatMediaType version=\"PBCoreXSD_Ver_1.2_D1\">")+PBCore_MediaType(MI)+__T("</formatMediaType>\n");
else
ToReturn+=__T("\t\t<formatMediaType version=\"PBCoreXSD_Ver_1.2_D1\">application/octet-stream</formatMediaType>\n");
//formatGenerations
ToReturn+=__T("\t\t<formatGenerations version=\"PBCoreXSD_Ver_1.2_D1\" />\n");
//formatFileSize
if (!MI.Get(Stream_General, 0, General_FileSize).empty())
ToReturn+=__T("\t\t<formatFileSize>")+MI.Get(Stream_General, 0, General_FileSize)+__T("</formatFileSize>\n");
//formatTimeStart
if (!MI.Get(Stream_Video, 0, Video_Delay_Original_String3).empty())
ToReturn+=__T("\t\t<formatTimeStart>")+MI.Get(Stream_Video, 0, Video_Delay_Original_String3)+__T("</formatTimeStart>\n");
else if (!MI.Get(Stream_Video, 0, Video_Delay_String3).empty())
//.........这里部分代码省略.........
开发者ID:3F,项目名称:FlightSDCpp,代码行数:101,代码来源:Export_PBCore.cpp
示例7: Element_WaitForMoreData
//---------------------------------------------------------------------------
bool File_SubRip::FileHeader_Begin()
{
if (!IsSub && (Buffer_Size<File_Size && Buffer_Size<65536))
{
Element_WaitForMoreData();
return false;
}
ZtringListList List;
List.Separator_Set(0, __T("\n\n"));
List.Separator_Set(1, __T("\n"));
if (Buffer[0]==0xEF
&& Buffer[1]==0xBB
&& Buffer[2]==0xBF)
HasBOM=true;
bool IsLocal=false;
Ztring Temp;
Temp.From_UTF8((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0));
if (Temp.empty())
{
Temp.From_Local((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0)); // Trying from local code page
IsLocal=true;
}
Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive);
List.Write(Temp);
if (List(0, 0)==__T("WEBVTT FILE") || List(0, 0)==__T("WEBVTT"))
IsVTT=true;
if (!IsVTT)
{
size_t IsOk=0;
size_t IsNok=0;
for (size_t Pos=0; Pos<List.size(); Pos++)
{
if (List(Pos, 0).To_int64u()==Pos+1)
IsOk++;
else
IsNok++;
if (List(Pos, 1).size()>22 && List(Pos, 1)[2]==__T(':') && List(Pos, 1)[5]==__T(':') && List(Pos, 1).find(__T(" --> "))!=string::npos)
IsOk++;
else
IsNok++;
}
if (!IsOk || IsNok>IsOk/2)
{
Reject();
return true;
}
}
if (!IsSub && File_Size!=(int64u)-1 && Buffer_Size!=File_Size)
{
Element_WaitForMoreData();
return false;
}
if (!Status[IsAccepted])
{
Accept();
Fill(Stream_General, 0, General_Format, IsVTT?"WebVTT":"SubRip");
Stream_Prepare(Stream_Text);
Fill(Stream_Text, 0, "Format", IsVTT?"WebVTT":"SubRip");
Fill(Stream_Text, 0, "Codec", IsVTT?"WebVTT":"SubRip");
}
if (IsLocal)
Temp.From_Local((const char*)Buffer+(HasBOM?3:0), Buffer_Size-(HasBOM?3:0));
else
Temp.From_UTF8((const char*)Buffer+(HasBOM?3:0), Buffer_Size-(HasBOM?3:0));
Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive);
List.Write(Temp);
#if MEDIAINFO_DEMUX
size_t Pos=0;
for (;;)
{
if (Pos>=List.size())
break;
if (List[Pos].size()>=3 || (IsVTT && List[Pos].size()>=2))
{
Ztring PTS_Begin_String=List[Pos][IsVTT?0:1].SubString(Ztring(), __T(" --> "));
Ztring PTS_End_String=List[Pos][IsVTT?0:1].SubString(__T(" --> "), Ztring());
if (IsVTT)
{
size_t Extra_Pos=PTS_End_String.find(__T(' '));
if (Extra_Pos!=string::npos)
PTS_End_String.resize(Extra_Pos); //Discarding positioning
}
item Item;
Item.PTS_Begin=SubRip_str2timecode(PTS_Begin_String.To_UTF8().c_str());
Item.PTS_End=SubRip_str2timecode(PTS_End_String.To_UTF8().c_str());
for (size_t Pos2=IsVTT?1:2; Pos2<List[Pos].size(); Pos2++)
//.........这里部分代码省略.........
开发者ID:0vermind,项目名称:NeoLoader,代码行数:101,代码来源:File_SubRip.cpp
示例8: Accept
//---------------------------------------------------------------------------
bool File_SequenceInfo::FileHeader_Begin()
{
XMLDocument document;
if (!FileHeader_Begin_XML(document))
return false;
{
XMLElement* Root=document.FirstChildElement("SEQUENCEINFO");
if (Root)
{
Accept("SequenceInfo");
Fill(Stream_General, 0, General_Format, "SequenceInfo");
ReferenceFiles=new File__ReferenceFilesHelper(this, Config);
File__ReferenceFilesHelper::reference ReferenceFile;
ReferenceFile.StreamKind=Stream_Video;
FileName FN(File_Name);
Ztring Base=FN.Path_Get();
size_t Pos=Base.rfind(PathSeparator);
if (Pos!=string::npos)
{
Ztring ToAdd=Base.substr(Pos, string::npos);
Ztring DirectoryBase=Base;
DirectoryBase+=ToAdd;
DirectoryBase+=__T('_');
size_t DirNumberCount=1;
Ztring Directory=DirectoryBase;
for (; DirNumberCount<9; DirNumberCount++)
{
Directory+=__T('0');
if (Dir::Exists(Directory))
break;
}
if (DirNumberCount<9)
{
int32u DirNumber=0;
do
{
Ztring Number=Ztring::ToZtring(DirNumber);
if (Number.size()<DirNumberCount)
Number.insert(0, DirNumberCount-Number.size(), __T('0'));
Directory=DirectoryBase;
Directory+=Number;
if (!Dir::Exists(Directory))
break;
Ztring FileBase=Directory;
FileBase+=ToAdd;
FileBase+=__T('_');
FileBase+=__T('.');
size_t FileNumberCount=1;
Ztring FullFile=FileBase;
Ztring Extension;
for (; FileNumberCount<10; FileNumberCount++)
{
FullFile.insert(FullFile.begin()+FullFile.size()-Extension.size()-1, __T('0'));
if (Extension.empty())
{
ZtringList List=Dir::GetAllFileNames(FullFile+__T('*'));
if (List.size()>=2)
{
FileNumberCount=(size_t)-1; //Problem, which one to choose?
break;
}
else if (List.size()==1)
{
FileName Temp(List[0]);
Extension=Temp.Extension_Get();
FileBase+=Extension;
FullFile=FileBase;
break;
}
}
else if (File::Exists(FullFile))
break;
}
bool FromZero=true;
if (FileNumberCount>=9)
{
//Trying with consecutive file numbers betweens dirs
Number=Ztring::ToZtring(ReferenceFile.FileNames.size());
FullFile=FileBase;
FullFile.insert(FullFile.size()-Extension.size()-1, Number);
FileNumberCount=Number.size();
if (!File::Exists(FullFile))
{
FileNumberCount++;
for (; FileNumberCount<10; FileNumberCount++)
{
FullFile.insert(FullFile.begin()+FullFile.size()-Extension.size()-Number.size()-1, __T('0'));
if (File::Exists(FullFile))
{
FromZero=false;
//.........这里部分代码省略.........
开发者ID:JanWillem32,项目名称:mpc-hc,代码行数:101,代码来源:File_SequenceInfo.cpp
示例9: Stream_Prepare
//---------------------------------------------------------------------------
void File_Flac::Read_File()
{
//Init
FLAC::Metadata::SimpleIterator SI;
if (!SI.is_valid())
return;
if (!SI.init(CompleteFileName.To_Local().c_str(), true, true))
return;
//Filling
Stream_Prepare(Stream_General);
Fill("Format", "FLAC");
Stream_Prepare(Stream_Audio);
Fill("Codec", "FLAC");
do {
switch(SI.get_block_type())
{
case FLAC__METADATA_TYPE_STREAMINFO:
{
FLAC::Metadata::StreamInfo* StreamInfo=(FLAC::Metadata::StreamInfo*)SI.get_block();
if (StreamInfo)
{
if (StreamInfo->get_min_framesize()==StreamInfo->get_max_framesize()
&& StreamInfo->get_min_framesize()!=0 ) // 0 means it is unknown
Fill("BitRate_Mode", "CBR");
else
Fill("BitRate_Mode", "VBR");
Fill("SamplingRate", StreamInfo->get_sample_rate());
Fill("Channel(s)", StreamInfo->get_channels());
Fill("Resolution", StreamInfo->get_bits_per_sample());
Fill(Stream_General, 0, "PlayTime", (int32u)(int64u_float64(StreamInfo->get_total_samples())*1000/StreamInfo->get_sample_rate()));
}
}
break;
case FLAC__METADATA_TYPE_PADDING:
break;
case FLAC__METADATA_TYPE_APPLICATION:
break;
case FLAC__METADATA_TYPE_SEEKTABLE:
break;
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
{
FLAC::Metadata::VorbisComment* vorbiscomment =(FLAC::Metadata::VorbisComment*)SI.get_block();
if (vorbiscomment)
{
Fill("Encoded_Library", vorbiscomment->get_vendor_string());
for(size_t t=0; t<vorbiscomment->get_num_comments(); t++)
{
std::string Key(vorbiscomment->get_comment(t).get_field_name(), vorbiscomment->get_comment(t).get_field_name_length());
Ztring Value; Value.From_UTF8(vorbiscomment->get_comment(t).get_field_value(), vorbiscomment->get_comment(t).get_field_value_length());
//Parsing
if (Key=="ALBUM") Fill(Stream_General, 0, "Album", Value);
else if (Key=="ARTIST") Fill(Stream_General, 0, "Performer", Value);
else if (Key=="COPYRIGHT") Fill(Stream_General, 0, "Copyright", Value);
else if (Key=="DATE") Fill(Stream_General, 0, "Recorded_Date", Value);
else if (Key=="DESCRIPTION") Fill(Stream_General, 0, "Comment", Value);
else if (Key=="LOCATION") Fill(Stream_General, 0, "RecordingLocation", Value);
else if (Key=="PERFORMER") Fill(Stream_General, 0, "Performer", Value);
else if (Key=="TITLE") Fill(Stream_General, 0, "Title", Value);
else if (Key=="TRACKNUMBER") Fill(Stream_General, 0, "Track", Value);
else Fill(Stream_General, 0, Key.c_str(), Value);
}
}
}
break;
case FLAC__METADATA_TYPE_CUESHEET:
break;
};
}
while(SI.next());
}
开发者ID:aidv,项目名称:scripts,代码行数:75,代码来源:File_Flac.cpp
示例10: Enums_Create
//---------------------------------------------------------------------------
// Main
ZenLib::Ztring Enums_Create()
{
Ztring Out;
Ztring Result;
Ztring Contents;
//Load header
Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.1.txt", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Generic", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"General", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Video", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Audio", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Text", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Other", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Image", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
Result=Enums_Create_Item(L"Stream", L"Menu", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
//Load footer
Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.9.txt", Contents);
if (!Result.empty())
return Result;
Out+=Contents;
//Write file
Result=Enums_Create_Save(L"../Source/MediaInfo/File__Analyse_Automatic.h", Out);
if (!Result.empty())
return Result;
return Out;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:68,代码来源:Enums.cpp
示例11: Reject
//---------------------------------------------------------------------------
bool File_Dxw::FileHeader_Begin()
{
//Element_Size
if (File_Size>1024*1024)
{
Reject("DXW");
return false; //DXW files are not big
}
TiXmlDocument document(File_Name.To_Local().c_str());
if (document.LoadFile())
{
TiXmlElement* Root=document.FirstChildElement("indexFile");
if (Root)
{
const char* Attribute=Root->Attribute("xmlns");
if (Attribute==NULL || Ztring().From_UTF8(Attribute)!=_T("urn:digimetrics-xml-wrapper"))
{
Reject("DXW");
return false;
}
Accept("DXW");
Fill(Stream_General, 0, General_Format, "DXW");
ReferenceFiles=new File__ReferenceFilesHelper(this, Config);
TiXmlElement* Track=Root->FirstChildElement();
while (Track)
{
if (string(Track->Value())=="clip")
{
File__ReferenceFilesHelper::reference ReferenceFile;
Attribute=Track->Attribute("file");
if (Attribute)
{
ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Attribute));
Attribute=Track->Attribute("type");
if (Attribute)
{
Ztring StreamKind; StreamKind.From_UTF8(Attribute);
if (StreamKind==_T("video"))
ReferenceFile.StreamKind=Stream_Video;
if (StreamKind==_T("audio"))
ReferenceFile.StreamKind=Stream_Audio;
if (StreamKind==_T("data"))
ReferenceFile.StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing
}
ReferenceFile.StreamID=ReferenceFiles->References.size()+1;
}
Attribute=Track->Attribute("framerate");
if (Attribute)
{
ReferenceFile.FrameRate=Ztring().From_UTF8(Attribute).To_float64();
Attribute=Track->Attribute("type");
if (Attribute)
{
Ztring StreamKind; StreamKind.From_UTF8(Attribute);
if (StreamKind==_T("video"))
ReferenceFile.StreamKind=Stream_Video;
if (StreamKind==_T("audio"))
ReferenceFile.StreamKind=Stream_Audio;
if (StreamKind==_T("data"))
ReferenceFile.StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing
}
TiXmlElement* Frame=Track->FirstChildElement();
while (Frame)
{
if (string(Frame->Value())=="frame")
{
Attribute=Frame->Attribute("file");
if (Attribute)
ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Attribute));
}
Frame=Frame->NextSiblingElement();
}
}
ReferenceFile.StreamID=ReferenceFiles->References.size()+1;
ReferenceFiles->References.push_back(ReferenceFile);
}
Track=Track->NextSiblingElement();
}
}
else
{
Reject("DXW");
return false;
}
}
else
//.........这里部分代码省略.........
开发者ID:achiarifman,项目名称:mkm4v,代码行数:101,代码来源:File_Dxw.cpp
示例12: Element_WaitForMoreData
//---------------------------------------------------------------------------
bool File_SubRip::FileHeader_Begin()
{
if (!IsSub && (Buffer_Size<File_Size && Buffer_Size<65536))
{
Element_WaitForMoreData();
return false;
}
ZtringListList List;
List.Separator_Set(0, __T("\n\n"));
List.Separator_Set(1, __T("\n"));
if (Buffer_Size>=3
&& Buffer[0]==0xEF
&& Buffer[1]==0xBB
&& Buffer[2]==0xBF)
HasBOM=true;
bool IsLocal=false;
Ztring Temp;
Temp.From_UTF8((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0));
if (Temp.empty())
{
#ifdef WINDOWS
Temp.From_Local((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0)); // Trying from local code page
#else //WINDOWS
Temp.From_ISO_8859_1((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0));
#endif //WINDOWS
IsLocal=true;
}
Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive);
List.Write(Temp);
if (List(0, 0)==__T("WEBVTT FILE") || List(0, 0)==__T("WEBVTT"))
IsVTT=true;
if (!IsVTT)
{
size_t IsOk=0;
size_t IsNok=0;
for (size_t Pos=0; Pos<List.size(); Pos++)
{
if (List(Pos, 0).To_int64u()==Pos+1)
IsOk++;
else
IsNok++;
if (List(Pos, 1).size()>22 && List(Pos, 1)[2]==__T(':') && List(Pos, 1)[5]==__T(':') && List(Pos, 1).find(__T(" --> "))!=string::npos)
IsOk++;
else
IsNok++;
}
if (!IsOk || IsNok>IsOk/2)
{
Reject();
return true;
}
}
if (!IsSub && File_Size!=(int64u)-1 && Buffer_Size!=File_Size)
{
Element_WaitForMoreData();
return false;
}
if (!Status[IsAccepted])
{
Accept();
Fill(Stream_General, 0, General_Format, IsVTT?"WebVTT":"SubRip");
Stream_Prepare(Stream_Text);
Fill(Stream_Text, 0, "Format", IsVTT?"WebVTT":"SubRip");
Fill(Stream_Text, 0, "Co
|
请发表评论