本文整理汇总了C++中MediaInfo_Internal类的典型用法代码示例。如果您正苦于以下问题:C++ MediaInfo_Internal类的具体用法?C++ MediaInfo_Internal怎么用?C++ MediaInfo_Internal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MediaInfo_Internal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PBCore_MediaType
//---------------------------------------------------------------------------
Ztring PBCore_MediaType(MediaInfo_Internal &MI)
{
if (MI.Count_Get(Stream_Video))
return __T("Video");
else if (MI.Count_Get(Stream_Audio))
return __T("Sound");
else if (MI.Count_Get(Stream_Image))
return __T("Static Image");
else if (MI.Count_Get(Stream_Text))
return __T("Text");
else
return Ztring();
}
示例2: PBCore_Transform__Common_End
//---------------------------------------------------------------------------
void PBCore_Transform__Common_End(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
{
//essenceTrackAnnotation - all fields (except *_String*) separated by |
Ztring Temp;
for (size_t Pos=0; Pos<MI.Count_Get(StreamKind, StreamPos); Pos++)
if (MI.Get(StreamKind, StreamPos, Pos, Info_Name).find(__T("String"))==std::string::npos && !MI.Get(StreamKind, StreamPos, Pos).empty())
Temp+=MI.Get(StreamKind, StreamPos, Pos, Info_Name)+__T(": ")+MI.Get(StreamKind, StreamPos, Pos)+__T('|');
if (!Temp.empty())
{
Temp.resize(Temp.size()-1);
ToReturn+=__T("\t\t\t<essenceTrackAnnotation>"); ToReturn+=Temp; ToReturn+=__T("</essenceTrackAnnotation>\n");
}
}
示例3: PBCore_Transform_Video
//---------------------------------------------------------------------------
void PBCore_Transform_Video(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
{
ToReturn+=__T("\t\t<pbcoreEssenceTrack>\n");
//essenceTrackType
ToReturn+=__T("\t\t\t<essenceTrackType>Video</essenceTrackType>\n");
//Common
PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Video, StreamPos);
//essenceTrackFrameSize
if (!MI.Get(Stream_Video, StreamPos, Video_Width).empty())
ToReturn+=__T("\t\t\t<essenceTrackFrameSize>")+MI.Get(Stream_Video, StreamPos, Video_Width)+__T('x')+MI.Get(Stream_Video, StreamPos, Video_Height)+__T("</essenceTrackFrameSize>\n");
//essenceTrackAspectRatio
if (!MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio).empty())
ToReturn+=__T("\t\t\t<essenceTrackAspectRatio>")+MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio)+__T("</essenceTrackAspectRatio>\n");
//essenceTrackFrameRate
if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackFrameRate>");
ToReturn+=MI.Get(Stream_Video, StreamPos, Video_FrameRate);
if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode).empty())
ToReturn+=__T(' ')+MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode);
ToReturn+=__T("</essenceTrackFrameRate>\n");
}
//Comon
PBCore_Transform__Common_End(ToReturn, MI, Stream_Video, StreamPos);
ToReturn+=__T("\t\t</pbcoreEssenceTrack>\n");
}
示例4: PBCore_Transform_Audio
//---------------------------------------------------------------------------
void PBCore_Transform_Audio(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
{
ToReturn+=__T("\t\t<pbcoreEssenceTrack>\n");
//essenceTrackType
ToReturn+=__T("\t\t\t<essenceTrackType>Audio</essenceTrackType>\n");
//Common
PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Audio, StreamPos);
if (!MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate).empty())
ToReturn+=__T("\t\t\t<essenceTrackSamplingRate>")+MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate)+__T("</essenceTrackSamplingRate>\n");
//Comon
PBCore_Transform__Common_End(ToReturn, MI, Stream_Audio, StreamPos);
ToReturn+=__T("\t\t</pbcoreEssenceTrack>\n");
}
示例5: PBCore_Transform_Menu
//---------------------------------------------------------------------------
void PBCore_Transform_Menu(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
{
//Only if TimeCode
if (MI.Get(Stream_Menu, StreamPos, Menu_Format)!=__T("TimeCode"))
return;
ToReturn+=__T("\t\t<pbcoreEssenceTrack>\n");
//essenceTrackType
ToReturn+=__T("\t\t\t<essenceTrackType>timecode</essenceTrackType>\n");
//Common
PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Menu, StreamPos);
//Common
PBCore_Transform__Common_End(ToReturn, MI, Stream_Menu, StreamPos);
ToReturn+=__T("\t\t</pbcoreEssenceTrack>\n");
}
示例6: PBCore_Transform_Text
//---------------------------------------------------------------------------
void PBCore_Transform_Text(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
{
//Init
Ztring Format=MI.Get(Stream_Text, StreamPos, Text_Format);
ToReturn+=__T("\t\t<pbcoreEssenceTrack>\n");
//essenceTrackType
ToReturn+=__T("\t\t\t<essenceTrackType>");
if (Format==__T("EIA-608") || Format==__T("EIA-708"))
ToReturn+=__T("caption");
else
ToReturn+=__T("text");
ToReturn+=__T("</essenceTrackType>\n");
//Common
PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Text, StreamPos);
//Common
PBCore_Transform__Common_End(ToReturn, MI, Stream_Text, StreamPos);
ToReturn+=__T("\t\t</pbcoreEssenceTrack>\n");
}
示例7: Transform
//---------------------------------------------------------------------------
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())
//.........这里部分代码省略.........
示例8: Reject
//.........这里部分代码省略.........
{
//EditRate
if (!strcmp(Resource_Item->Value(), "EditRate"))
{
const char* EditRate=Resource_Item->GetText();
Resource.IgnoreFramesRate=atof(EditRate);
const char* EditRate2=strchr(EditRate, ' ');
if (EditRate2!=NULL)
{
float64 EditRate2f=atof(EditRate2);
if (EditRate2f)
Resource.IgnoreFramesRate/=EditRate2f;
}
}
//EntryPoint
if (!strcmp(Resource_Item->Value(), "EntryPoint"))
{
Resource.IgnoreFramesBefore=atoi(Resource_Item->GetText());
if (Resource.IgnoreFramesAfter!=(int64u)-1)
Resource.IgnoreFramesAfter+=Resource.IgnoreFramesBefore;
}
//Id
if (!strcmp(File_Item->Value(), "Id") && Resource_Id.empty())
Resource_Id.From_UTF8(File_Item->GetText());
//SourceDuration
if (!strcmp(Resource_Item->Value(), "SourceDuration"))
Resource.IgnoreFramesAfter=Resource.IgnoreFramesBefore+atoi(Resource_Item->GetText());
//TrackFileId
if (!strcmp(Resource_Item->Value(), "TrackFileId"))
Resource.FileName.From_UTF8(Resource_Item->GetText());
}
if (Resource.FileName.empty())
Resource.FileName=Resource_Id;
ReferenceFile.CompleteDuration.push_back(Resource);
}
}
}
}
if (ReferenceFile.CompleteDuration.empty())
{
File__ReferenceFilesHelper::reference::completeduration Resource;
Resource.FileName=Asset_Id;
ReferenceFile.CompleteDuration.push_back(Resource);
}
ReferenceFile.StreamID=ReferenceFiles->References.size()+1;
ReferenceFiles->References.push_back(ReferenceFile);
}
}
}
}
}
}
}
}
Element_Offset=File_Size;
//Getting files names
FileName Directory(File_Name);
Ztring Assetmap_FileName=Directory.Path_Get()+PathSeparator+__T("ASSETMAP.xml");
bool IsOk=false;
if (File::Exists(Assetmap_FileName))
IsOk=true;
else
{
Assetmap_FileName.resize(Assetmap_FileName.size()-4); //Old fashion, without ".xml"
if (File::Exists(Assetmap_FileName))
IsOk=true;
}
if (IsOk)
{
MediaInfo_Internal MI;
MI.Option(__T("File_KeepInfo"), __T("1"));
Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T(""));
Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T(""));
MI.Option(__T("ParseSpeed"), __T("0"));
MI.Option(__T("Demux"), Ztring());
MI.Option(__T("File_IsReferenced"), __T("1"));
size_t MiOpenResult=MI.Open(Assetmap_FileName);
MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value
MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value
if (MiOpenResult
&& (MI.Get(Stream_General, 0, General_Format)==__T("DCP AM")
|| MI.Get(Stream_General, 0, General_Format)==__T("IMF AM")))
{
MergeFromAm(((File_DcpAm*)MI.Info)->Streams);
}
}
ReferenceFiles->FilesForStorage=true;
//All should be OK...
return true;
}
示例9: Accept
//---------------------------------------------------------------------------
bool File_Xdcam_Clip::FileHeader_Begin()
{
XMLDocument document;
if (!FileHeader_Begin_XML(document))
return false;
{
XMLElement* Root=document.FirstChildElement("NonRealTimeMeta");
if (Root)
{
Accept("Xdcam_Clip");
Fill(Stream_General, 0, General_Format, "XDCAM Clip");
XMLElement* Element;
//CreationDate
Element=Root->FirstChildElement("CreationDate");
if (Element)
Fill(Stream_General, 0, General_Recorded_Date, Element->Attribute("value"));
//LastUpdate
Element=Root->FirstChildElement("LastUpdate");
if (Element)
Fill(Stream_General, 0, General_Tagged_Date, Element->Attribute("value"));
//Duration
Ztring Duration, EditUnit;
Element=Root->FirstChildElement("Duration");
if (Element)
Duration=Element->Attribute("value");
Element=Root->FirstChildElement("LtcChangeTable");
if (Element)
EditUnit=Element->Attribute("tcFps");
int64u Duration_Frames=Duration.To_int64u();
int64u EditUnit_Denominator=EditUnit.To_int64u();
if (Duration_Frames && EditUnit_Denominator)
Fill(Stream_General, 0, General_Duration, ((float32)Duration_Frames)*1000/EditUnit_Denominator, 0);
int64u File_Size_Total=File_Size;
#if defined(MEDIAINFO_MXF_YES)
if (File_Name.size()>12
&& File_Name[File_Name.size()-7]==__T('M')
&& File_Name[File_Name.size()-6]==__T('0')
&& File_Name[File_Name.size()-5]==__T('1')
&& File_Name[File_Name.size()-4]==__T('.')
&& File_Name[File_Name.size()-3]==__T('X')
&& File_Name[File_Name.size()-2]==__T('M')
&& File_Name[File_Name.size()-1]==__T('L'))
{
Ztring file=File_Name.substr(File_Name.size()-12, 5);
Ztring MXF_File=File_Name;
MXF_File.resize(MXF_File.size()-12);
MXF_File+=file;
if (File::Exists(MXF_File+__T(".MXF")))
MXF_File+=__T(".MXF");
if (File::Exists(MXF_File+__T(".MP4")))
MXF_File+=__T(".MP4");
//int8u ReadByHuman=Ztring(MediaInfo::Option_Static(__T("ReadByHuman_Get"))).To_int8u();
//MediaInfo::Option_Static(__T("ReadByHuman"), __T("0"));
MediaInfo_Internal MI;
if (MI.Open(MXF_File))
{
//MediaInfo::Option_Static(__T("ReadByHuman"), ReadByHuman?__T("1"):__T("0"));
Merge(MI);
Fill(Stream_Video, StreamPos_Last, "Source", MXF_File);
File_Size_Total+=Ztring(MI.Get(Stream_General, 0, General_FileSize)).To_int64u();
//Commercial names
Fill(Stream_General, 0, General_Format_Commercial_IfAny, MI.Get(Stream_General, 0, General_Format_Commercial_IfAny));
Ztring Format_Commercial=MI.Get(Stream_General, 0, General_Format_Commercial_IfAny);
if (!Format_Commercial.empty())
{
Format_Commercial.FindAndReplace(__T("XDCAM "), Ztring());
Fill(Stream_General, 0, General_Format_Commercial, __T("XDCAM Clip ")+Format_Commercial, true);
}
}
//else
// MediaInfo::Option_Static(__T("ReadByHuman"), ReadByHuman?__T("1"):__T("0"));
}
#endif //defined(MEDIAINFO_MXF_YES)
//Device
Element=Root->FirstChildElement("Device");
if (Element)
Fill(Stream_General, 0, General_Encoded_Application, string(Element->Attribute("manufacturer"))+" "+Element->Attribute("modelName"), true, true);
if (File_Size_Total!=File_Size)
Fill(Stream_General, 0, General_FileSize, File_Size_Total, 10, true);
}
else
{
Reject("Xdcam_Clip");
return false;
}
}
//All should be OK...
//.........这里部分代码省略.........
示例10: Reject
//.........这里部分代码省略.........
{
//AssetList
if (!strcmp(PackingList_Item->Value(), "AssetList"))
{
for (XMLElement* AssetList_Item=PackingList_Item->FirstChildElement(); AssetList_Item; AssetList_Item=AssetList_Item->NextSiblingElement())
{
//Asset
if (!strcmp(AssetList_Item->Value(), "Asset"))
{
File__ReferenceFilesHelper::reference ReferenceFile;
bool IsCPL=false;
bool PreviousFileNameIsAnnotationText=false;
for (XMLElement* File_Item=AssetList_Item->FirstChildElement(); File_Item; File_Item=File_Item->NextSiblingElement())
{
//Id
if (!strcmp(File_Item->Value(), "Id"))
ReferenceFile.Infos["UniqueID"].From_UTF8(File_Item->GetText());
//Type
if (!strcmp(File_Item->Value(), "Type"))
{
if (!strcmp(File_Item->GetText(), "application/x-smpte-mxf;asdcpKind=Picture"))
ReferenceFile.StreamKind=Stream_Video;
else if (!strcmp(File_Item->GetText(), "application/x-smpte-mxf;asdcpKind=Sound"))
ReferenceFile.StreamKind=Stream_Audio;
else if (!strcmp(File_Item->GetText(), "text/xml;asdcpKind=CPL"))
{
HasCpl=IsCPL=true;
}
else
ReferenceFile.StreamKind=Stream_Other;
}
//Id
if (!strcmp(File_Item->Value(), "OriginalFileName")
|| (ReferenceFile.FileNames.empty() && !strcmp(File_Item->Value(), "AnnotationText"))) // Annotation contains file name (buggy IMF file)
{
if (PreviousFileNameIsAnnotationText)
ReferenceFile.FileNames.clear(); // Annotation is something else, no need of it
if (!strcmp(File_Item->Value(), "AnnotationText"))
PreviousFileNameIsAnnotationText=true;
ReferenceFile.FileNames.push_back(Ztring().From_UTF8(File_Item->GetText()));
string Text=File_Item->GetText();
if (Text.size()>=8
&& (Text.find("_cpl.xml")==Text.size()-8)
|| (Text.find("CPL_")==0 && Text.find(".xml")==Text.size()-4))
{
HasCpl=IsCPL=true;
ReferenceFile.StreamKind=Stream_Max;
}
}
}
if (IsCPL && CPL_FileName.empty())
for (size_t Pos=0; Pos<ReferenceFile.FileNames.size(); Pos++)
{
CPL_FileName=ReferenceFile.FileNames[Pos]; //Using only the first CPL file meet
break;
}
ReferenceFile.StreamID=ReferenceFiles->References.size()+1;
ReferenceFiles->References.push_back(ReferenceFile);
}
}
}
}
Element_Offset=File_Size;
//Getting links between files
if (!CPL_FileName.empty() && !Config->File_IsReferenced_Get())
{
FileName Directory(File_Name);
if (CPL_FileName.find(__T("file://"))==0 && CPL_FileName.find(__T("file:///"))==string::npos)
CPL_FileName.erase(0, 7); //TODO: better handling of relative and absolute file naes
MediaInfo_Internal MI;
MI.Option(__T("File_KeepInfo"), __T("1"));
Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T(""));
Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T(""));
MI.Option(__T("ParseSpeed"), __T("0"));
MI.Option(__T("Demux"), Ztring());
MI.Option(__T("File_IsReferenced"), __T("1"));
size_t MiOpenResult=MI.Open(Directory.Path_Get()+PathSeparator+CPL_FileName);
MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value
MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value
if (MiOpenResult
&& ((IsDcp && MI.Get(Stream_General, 0, General_Format)==__T("DCP CPL"))
|| (IsImf && MI.Get(Stream_General, 0, General_Format)==__T("IMF CPL"))))
{
DcpCpl_MergeFromPkl(((File_DcpCpl*)MI.Info)->ReferenceFiles, ReferenceFiles);
ReferenceFiles->References=((File_DcpCpl*)MI.Info)->ReferenceFiles->References;
}
}
ReferenceFiles->FilesForStorage=true;
//All should be OK...
return true;
}
示例11: Reject
//.........这里部分代码省略.........
for (XMLElement* AssetList_Item=AssetMap_Item->FirstChildElement(); AssetList_Item; AssetList_Item=AssetList_Item->NextSiblingElement())
{
//Asset
if (!strcmp(AssetList_Item->Value(), (NameSpace+"Asset").c_str()))
{
File__ReferenceFilesHelper::reference ReferenceFile;
bool IsCPL=false;
for (XMLElement* Asset_Item=AssetList_Item->FirstChildElement(); Asset_Item; Asset_Item=Asset_Item->NextSiblingElement())
{
//Id
if (!strcmp(Asset_Item->Value(), (NameSpace+"Id").c_str()))
ReferenceFile.Infos["UniqueID"].From_UTF8(Asset_Item->GetText());
//ChunkList
if (!strcmp(Asset_Item->Value(), (NameSpace+"ChunkList").c_str()))
{
for (XMLElement* ChunkList_Item=Asset_Item->FirstChildElement(); ChunkList_Item; ChunkList_Item=ChunkList_Item->NextSiblingElement())
{
//Chunk
if (!strcmp(ChunkList_Item->Value(), (NameSpace+"Chunk").c_str()))
{
for (XMLElement* Chunk_Item=ChunkList_Item->FirstChildElement(); Chunk_Item; Chunk_Item=Chunk_Item->NextSiblingElement())
{
//Path
if (!strcmp(Chunk_Item->Value(), (NameSpace+"Path").c_str()))
{
ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Chunk_Item->GetText()));
string Text=Chunk_Item->GetText();
if (Text.size()>=8
&& (Text.find("_cpl.xml")==Text.size()-8)
|| (Text.find("CPL_")==0 && Text.find(".xml")==Text.size()-4))
IsCPL=true;
}
}
}
}
}
}
if (IsCPL)
{
for (size_t Pos=0; Pos<ReferenceFile.FileNames.size(); Pos++)
{
if (CPL_FileName.empty())
CPL_FileName=ReferenceFile.FileNames[Pos]; //Using only the first CPL file meet
}
}
ReferenceFile.StreamID=ReferenceFiles->References.size()+1;
ReferenceFiles->References.push_back(ReferenceFile);
}
}
}
//Creator
if (!strcmp(AssetMap_Item->Value(), (NameSpace+"Creator").c_str()))
Fill(Stream_General, 0, General_Encoded_Library, AssetMap_Item->GetText());
//IssueDate
if (!strcmp(AssetMap_Item->Value(), (NameSpace+"IssueDate").c_str()))
Fill(Stream_General, 0, General_Encoded_Date, AssetMap_Item->GetText());
//Issuer
if (!strcmp(AssetMap_Item->Value(), (NameSpace+"Issuer").c_str()))
Fill(Stream_General, 0, General_EncodedBy, AssetMap_Item->GetText());
}
Element_Offset=File_Size;
//Getting links between files
if (!CPL_FileName.empty() && !Config->File_IsReferenced_Get())
{
FileName Directory(File_Name);
if (CPL_FileName.find(__T("file://"))==0 && CPL_FileName.find(__T("file:///"))==string::npos)
CPL_FileName.erase(0, 7); //TODO: better handling of relative and absolute file naes
MediaInfo_Internal MI;
MI.Option(__T("File_KeepInfo"), __T("1"));
Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T(""));
Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T(""));
MI.Option(__T("ParseSpeed"), __T("0"));
MI.Option(__T("Demux"), Ztring());
MI.Option(__T("File_IsReferenced"), __T("1"));
size_t MiOpenResult=MI.Open(Directory.Path_Get()+PathSeparator+CPL_FileName);
MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value
MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value
if (MiOpenResult
&& ((IsDcp && MI.Get(Stream_General, 0, General_Format)==__T("DCP CPL"))
|| (IsImf && MI.Get(Stream_General, 0, General_Format)==__T("IMF CPL"))))
{
DcpCpl_MergeFromPkl(((File_DcpCpl*)MI.Info)->ReferenceFiles, ReferenceFiles);
ReferenceFiles->References=((File_DcpCpl*)MI.Info)->ReferenceFiles->References;
}
}
ReferenceFiles->FilesForStorage=true;
//All should be OK...
return true;
}
示例12: Reject
//.........这里部分代码省略.........
if (!strcmp(ResourceList_Item->Value(), "Resource"))
{
Ztring Resource_Id;
File__ReferenceFilesHelper::reference::completeduration Resource;
for (XMLElement* Resource_Item=ResourceList_Item->FirstChildElement(); Resource_Item; Resource_Item=Resource_Item->NextSiblingElement())
{
//EditRate
if (!strcmp(Resource_Item->Value(), "EditRate"))
{
const char* EditRate=Resource_Item->GetText();
Resource.IgnoreFramesRate=atof(EditRate);
const char* EditRate2=strchr(EditRate, ' ');
if (EditRate2!=NULL)
{
float64 EditRate2f=atof(EditRate2);
if (EditRate2f)
Resource.IgnoreFramesRate/=EditRate2f;
}
}
//EntryPoint
if (!strcmp(Resource_Item->Value(), "EntryPoint"))
Resource.IgnoreFramesBefore=atoi(Resource_Item->GetText());
//Id
if (!strcmp(File_Item->Value(), "Id") && Resource_Id.empty())
Resource_Id.From_UTF8(File_Item->GetText());
//SourceDuration
if (!strcmp(Resource_Item->Value(), "SourceDuration"))
Resource.IgnoreFramesAfterDuration=atoi(Resource_Item->GetText());
//TrackFileId
if (!strcmp(Resource_Item->Value(), "TrackFileId"))
Resource.FileName.From_UTF8(Resource_Item->GetText());
}
if (Resource.FileName.empty())
Resource.FileName=Resource_Id;
ReferenceFile.CompleteDuration.push_back(Resource);
}
}
}
}
if (ReferenceFile.CompleteDuration.empty())
{
File__ReferenceFilesHelper::reference::completeduration Resource;
Resource.FileName=Asset_Id;
ReferenceFile.CompleteDuration.push_back(Resource);
}
ReferenceFile.StreamID=ReferenceFiles->References.size()+1;
ReferenceFiles->References.push_back(ReferenceFile);
}
}
}
}
}
}
}
}
Element_Offset=File_Size;
//Getting files names
if (!Config->File_IsReferenced_Get())
{
FileName Directory(File_Name);
ZtringList List;
if (IsImf)
List=Dir::GetAllFileNames(Directory.Path_Get()+PathSeparator+__T("PKL_*.xml"), Dir::Include_Files);
if (IsDcp || List.empty())
List=Dir::GetAllFileNames(Directory.Path_Get()+PathSeparator+__T("*_pkl.xml"), Dir::Include_Files);
for (size_t Pos=0; Pos<List.size(); Pos++)
{
MediaInfo_Internal MI;
MI.Option(__T("File_KeepInfo"), __T("1"));
Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T(""));
Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T(""));
MI.Option(__T("ParseSpeed"), __T("0"));
MI.Option(__T("Demux"), Ztring());
MI.Option(__T("File_IsReferenced"), __T("1"));
size_t MiOpenResult=MI.Open(List[Pos]);
MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value
MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value
if (MiOpenResult
&& ((IsDcp && MI.Get(Stream_General, 0, General_Format)==__T("DCP PKL"))
|| (IsImf && MI.Get(Stream_General, 0, General_Format)==__T("IMF PKL"))))
{
DcpCpl_MergeFromPkl(ReferenceFiles, ((File_DcpCpl*)MI.Info)->ReferenceFiles);
}
}
}
ReferenceFiles->FilesForStorage=true;
//All should be OK...
return true;
}
示例13: switch
size_t File_Lxf::Read_Buffer_Seek (size_t Method, int64u Value, int64u)
{
//Parsing
switch (Method)
{
case 0 : Open_Buffer_Unsynch(); GoTo(Value); return 1;
case 1 : Open_Buffer_Unsynch(); GoTo(File_Size*Value/10000); return 1;
case 2 : //Timestamp
{
//Init
if (!Duration_Detected)
{
MediaInfo_Internal MI;
MI.Option(_T("File_KeepInfo"), _T("1"));
Ztring ParseSpeed_Save=MI.Option(_T("ParseSpeed_Get"), _T(""));
Ztring Demux_Save=MI.Option(_T("Demux_Get"), _T(""));
MI.Option(_T("ParseSpeed"), _T("0"));
MI.Option(_T("Demux"), Ztring());
size_t MiOpenResult=MI.Open(File_Name);
MI.Option(_T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value
MI.Option(_T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value
if (!MiOpenResult || MI.Get(Stream_General, 0, General_Format)!=_T("LXF"))
return 0;
for (time_offsets::iterator TimeOffset=((File_Lxf*)MI.Info)->TimeOffsets.begin(); TimeOffset!=((File_Lxf*)MI.Info)->TimeOffsets.end(); TimeOffset++)
TimeOffsets[TimeOffset->first]=TimeOffset->second;
int64u Duration=float64_int64s(Ztring(MI.Get(Stream_General, 0, _T("Duration"))).To_float64()*720);
TimeOffsets[File_Size]=stream_header(Duration, Duration, 0, (int8u)-1);
SeekRequest_Divider=2;
Duration_Detected=true;
}
if (Value!=(int64u)-1)
{
Value=float64_int64s((float64)Value*720/1000000); //Convert in LXF unit (1/720000)
time_offsets::iterator End=TimeOffsets.end();
End--;
if (Value>=End->second.TimeStamp_End)
return 2; //Higher than total size
SeekRequest=Value;
}
//Looking if we already have the timestamp
int64u SeekRequest_Mini=SeekRequest; if (SeekRequest_Mini>1000000) SeekRequest_Mini-=720; //-1ms
int64u SeekRequest_Maxi=SeekRequest+720; //+1ms
for (time_offsets::iterator TimeOffset=TimeOffsets.begin(); TimeOffset!=TimeOffsets.end(); TimeOffset++)
{
if (TimeOffset->second.TimeStamp_Begin<=SeekRequest_Maxi && TimeOffset->second.TimeStamp_End>=SeekRequest_Mini) //If it is found in a frame we know
{
//Looking for the corresponding I-Frame
while (TimeOffset->second.PictureType&0x2 && TimeOffset!=TimeOffsets.begin()) //Not an I-Frame (and not fisrt frame)
{
time_offsets::iterator Previous=TimeOffset;
Previous--;
if (Previous->second.TimeStamp_End!=TimeOffset->second.TimeStamp_Begin) //Testing if the previous frame is not known.
{
SeekRequest=TimeOffset->second.TimeStamp_Begin-(720+1); //1ms+1, so we are sure to not synch on the current frame again
Open_Buffer_Unsynch();
GoTo((Previous->first+TimeOffset->first)/2);
return 1; //Looking for previous frame
}
TimeOffset=Previous;
}
//We got the right I-Frame
if (Value==0)
{
for (size_t Pos=0; Pos<Videos.size(); Pos++)
if (Videos[Pos].Parser)
Videos[Pos].Parser->Unsynch_Frame_Count=0;
}
Open_Buffer_Unsynch();
GoTo(TimeOffset->first);
SeekRequest=(int64u)-1;
return 1;
}
if (TimeOffset->second.TimeStamp_Begin>SeekRequest_Maxi) //Testing if too far
{
time_offsets::iterator Previous=TimeOffset; Previous--;
int64u ReferenceOffset;
if (File_Offset+Buffer_Offset==TimeOffset->first && TimeOffset->second.TimeStamp_Begin>SeekRequest) //If current frame is already too far
ReferenceOffset=File_Offset+Buffer_Offset;
else
ReferenceOffset=TimeOffset->first;
if (SeekRequest_Divider==0)
{
SeekRequest=Previous->second.TimeStamp_Begin-(720+1); //1ms+1, so we are sure to not synch on the current frame again
ReferenceOffset=Previous->first;
Previous--;
SeekRequest_Divider=2;
}
Open_Buffer_Unsynch();
GoTo(Previous->first+(ReferenceOffset-Previous->first)/SeekRequest_Divider);
SeekRequest_Divider*=2;
return 1;
}
}
}
return 0;
default : return (size_t)-1;
//.........这里部分代码省略.........
示例14: PBCore_Transform__Common_Begin
//---------------------------------------------------------------------------
void PBCore_Transform__Common_Begin(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
{
//essenceTrackIdentifier
if (!MI.Get(StreamKind, StreamPos, __T("ID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("ID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>ID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
else if (!MI.Get(StreamKind, StreamPos, __T("UniqueID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("UniqueID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>UniqueID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
else if (!MI.Get(StreamKind, StreamPos, __T("StreamKindID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("StreamKindID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>StreamKindID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
//essenceTrackStandard
if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_Standard).empty()) //Video only, but must be placed here
ToReturn+=__T("\t\t\t<essenceTrackStandard>")+MI.Get(Stream_Video, StreamPos, Video_Standard)+__T("</essenceTrackStandard>\n");
//essenceTrackLanguage
if (!MI.Get(StreamKind, StreamPos, __T("Language")).empty())
ToReturn+=__T("\t\t\t<essenceTrackLanguage>")+MediaInfoLib::Config.Iso639_2_Get(MI.Get(StreamKind, StreamPos, __T("Language")))+__T("</essenceTrackLanguage>\n");
//essenceTrackEncoding
if (!MI.Get(StreamKind, StreamPos, __T("Format")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackEncoding>");
ToReturn+=MI.Get(StreamKind, StreamPos, __T("Format"));
if (!MI.Get(StreamKind, StreamPos, __T("Format_Profile")).empty()) ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("Format_Profile"));
if (!MI.Get(StreamKind, StreamPos, __T("CodecID")).empty()) ToReturn+=__T(" (")+MI.Get(StreamKind, StreamPos, __T("CodecID"))+__T(')');
ToReturn+=__T("</essenceTrackEncoding>\n");
}
//essenceTrackDataRate
if (!MI.Get(StreamKind, StreamPos, __T("BitRate")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackDataRate>");
ToReturn+=MI.Get(StreamKind, StreamPos, __T("BitRate"));
if (!MI.Get(StreamKind, StreamPos, __T("BitRate_Mode")).empty())
ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("BitRate_Mode"));
ToReturn+=__T("</essenceTrackDataRate>\n");
}
//essenceTrackDuration
if (!MI.Get(StreamKind, StreamPos, __T("Duration")).empty())
ToReturn+=__T("\t\t\t<essenceTrackDuration>")+MI.Get(StreamKind, StreamPos, __T("Duration"))+__T("</essenceTrackDuration>\n");
//essenceTrackBitDepth
if (!MI.Get(StreamKind, StreamPos, __T("Resolution")).empty())
ToReturn+=__T("\t\t\t<essenceTrackBitDepth version=\"PBCoreXSD_Ver_1.2_D1\">")+MI.Get(StreamKind, StreamPos, __T("Resolution"))+__T("</essenceTrackBitDepth>\n");
}
示例15: PBCore_Transform
//---------------------------------------------------------------------------
void PBCore_Transform(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
{
//Menu: only if TimeCode
if (StreamKind==Stream_Menu && MI.Get(Stream_Menu, StreamPos, Menu_Format)!=__T("TimeCode"))
return;
//essenceTrackType
Ztring essenceTrackType;
switch (StreamKind)
{
case Stream_Video:
essenceTrackType=__T("Video");
break;
case Stream_Audio:
essenceTrackType=__T("Audio");
break;
case Stream_Text:
{
Ztring Format=MI.Get(Stream_Text, StreamPos, Text_Format);
if (Format==__T("EIA-608") || Format==__T("EIA-708"))
essenceTrackType=__T("CC");
else
essenceTrackType=__T("Text");
}
break;
case Stream_Menu:
if (MI.Get(Stream_Menu, StreamPos, Menu_Format)==__T("TimeCode"))
{
essenceTrackType=__T("TimeCode");
break;
}
else
return; //Not supported
default: return; //Not supported
}
ToReturn+=__T("\t\t<pbcoreEssenceTrack>\n");
ToReturn+=__T("\t\t\t<essenceTrackType>")+essenceTrackType+__T("</essenceTrackType>\n");
//essenceTrackIdentifier
if (!MI.Get(StreamKind, StreamPos, __T("ID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("ID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>ID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
else if (!MI.Get(StreamKind, StreamPos, __T("UniqueID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("UniqueID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>UniqueID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
else if (!MI.Get(StreamKind, StreamPos, __T("StreamKindID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("StreamKindID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>StreamKindID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
//essenceTrackStandard
if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_Standard).empty())
ToReturn+=__T("\t\t\t<essenceTrackStandard>")+MI.Get(Stream_Video, StreamPos, Video_Standard)+__T("</essenceTrackStandard>\n");
//essenceTrackEncoding
if (!MI.Get(StreamKind, StreamPos, __T("Format")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackEncoding>");
ToReturn+=MI.Get(StreamKind, StreamPos, __T("Format"));
if (!MI.Get(StreamKind, StreamPos, __T("Format_Profile")).empty()) ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("Format_Profile"));
if (!MI.Get(StreamKind, StreamPos, __T("CodecID")).empty()) ToReturn+=__T(" (")+MI.Get(StreamKind, StreamPos, __T("CodecID"))+__T(')');
ToReturn+=__T("</essenceTrackEncoding>\n");
}
//essenceTrackDataRate
if (!MI.Get(StreamKind, StreamPos, __T("BitRate")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackDataRate>");
ToReturn+=MI.Get(StreamKind, StreamPos, __T("BitRate"));
if (!MI.Get(StreamKind, StreamPos, __T("BitRate_Mode")).empty())
ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("BitRate_Mode"));
ToReturn+=__T("</essenceTrackDataRate>\n");
}
//essenceTrackFrameRate
if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_FrameRate).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackFrameRate>");
ToReturn+=MI.Get(Stream_Video, StreamPos, Video_FrameRate);
if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode).empty())
ToReturn+=__T(' ')+MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode);
ToReturn+=__T("</essenceTrackFrameRate>\n");
}
//essenceTrackSamplingRate
if (StreamKind==Stream_Audio && !MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate).empty())
ToReturn+=__T("\t\t\t<essenceTrackSamplingRate>")+MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate)+__T("</essenceTrackSamplingRate>\n");
//essenceTrackBitDepth
if (!MI.Get(StreamKind, StreamPos, __T("BitDepth")).empty())
ToReturn+=__T("\t\t\t<essenceTrackBitDepth version=\"PBCoreXSD_Ver_1.2_D1\">")+MI.Get(StreamKind, StreamPos, __T("BitDepth"))+__T("</essenceTrackBitDepth>\n");
//.........这里部分代码省略.........