本文整理汇总了C++中MediaInfo_Internal::Option方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaInfo_Internal::Option方法的具体用法?C++ MediaInfo_Internal::Option怎么用?C++ MediaInfo_Internal::Option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaInfo_Internal
的用法示例。
在下文中一共展示了MediaInfo_Internal::Option方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileHeader_Begin
//.........这里部分代码省略.........
if (!strcmp(ResItemName, "EditRate"))
{
Resource->EditRate=atof(ResText);
const char* EditRate2=strchr(ResText, ' ');
if (EditRate2!=NULL)
{
float64 EditRate2f=atof(EditRate2);
if (EditRate2f)
Resource->EditRate/=EditRate2f;
}
}
//EntryPoint
if (!strcmp(ResItemName, "EntryPoint"))
{
Resource->IgnoreEditsBefore=atoi(ResText);
if (Resource->IgnoreEditsAfter!=(int64u)-1)
Resource->IgnoreEditsAfter+=Resource->IgnoreEditsBefore;
}
//Id
if (!strcmp(ResItemName, "Id") && Resource_Id.empty())
Resource_Id.From_UTF8(ResText);
//SourceDuration
if (!strcmp(ResItemName, "SourceDuration"))
Resource->IgnoreEditsAfter=Resource->IgnoreEditsBefore+atoi(ResText);
//TrackFileId
if (!strcmp(ResItemName, "TrackFileId"))
Resource->FileNames.push_back(Ztring().From_UTF8(ResText));
}
if (Resource->FileNames.empty())
Resource->FileNames.push_back(Resource_Id);
Sequence->AddResource(Resource);
}
}
}
}
if (Sequence->Resources.empty())
{
resource* Resource=new resource;
Resource->FileNames.push_back(Asset_Id);
Sequence->AddResource(Resource);
}
Sequence->StreamID=ReferenceFiles->Sequences_Size()+1;
ReferenceFiles->AddSequence(Sequence);
}
}
}
}
}
}
}
}
Element_Offset=File_Size;
//Getting files names
FileName Directory(File_Name);
Ztring DirPath = Directory.Path_Get();
if (!DirPath.empty())
DirPath += PathSeparator;
Ztring Assetmap_FileName=DirPath+__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;
}
示例2: FileHeader_Begin
//.........这里部分代码省略.........
{
//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;
}
示例3: FileHeader_Begin
//.........这里部分代码省略.........
{
//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;
}
示例4: FileHeader_Begin
//---------------------------------------------------------------------------
bool File_DcpPkl::FileHeader_Begin()
{
XMLDocument document;
if (!FileHeader_Begin_XML(document))
return false;
XMLElement* PackingList=document.FirstChildElement("PackingList");
if (!PackingList)
{
Reject("DcpPkl");
return false;
}
const char* Attribute=PackingList->Attribute("xmlns");
if (!Attribute)
{
Reject("DcpPkl");
return false;
}
if (strcmp(Attribute, "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#")
&& strcmp(Attribute, "http://www.smpte-ra.org/schemas/429-8/2007/PKL"))
{
Reject("DcpPkl");
return false;
}
Accept("DcpPkl");
Fill(Stream_General, 0, General_Format, "DCP PKL");
Config->File_ID_OnlyRoot_Set(false);
//Parsing main elements
for (XMLElement* PackingList_Item=PackingList->FirstChildElement(); PackingList_Item; PackingList_Item=PackingList_Item->NextSiblingElement())
{
//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"))
{
stream Stream;
for (XMLElement* File_Item=AssetList_Item->FirstChildElement(); File_Item; File_Item=File_Item->NextSiblingElement())
{
//AnnotationText
if (!strcmp(File_Item->Value(), "AnnotationText"))
Stream.AnnotationText=File_Item->GetText();
//Id
if (!strcmp(File_Item->Value(), "Id"))
Stream.Id=File_Item->GetText();
//OriginalFileName
if (!strcmp(File_Item->Value(), "OriginalFileName"))
Stream.OriginalFileName=File_Item->GetText();
//Type
if (!strcmp(File_Item->Value(), "Type"))
{
if (!strcmp(File_Item->GetText(), "application/x-smpte-mxf;asdcpKind=Picture"))
Stream.StreamKind=Stream_Video;
else if (!strcmp(File_Item->GetText(), "application/x-smpte-mxf;asdcpKind=Sound"))
Stream.StreamKind=Stream_Audio;
else if (!strcmp(File_Item->GetText(), "text/xml") || !strcmp(File_Item->GetText(), "text/xml;asdcpKind=CPL"))
Stream.StreamKind=(stream_t)(Stream_Max+1); // Means CPL
else
Stream.StreamKind=Stream_Other;
}
}
Streams.push_back(Stream);
}
}
}
}
Element_Offset=File_Size;
//Merging with Assetmap
if (!Config->File_IsReferenced_Get())
{
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(""));
//.........这里部分代码省略.........
示例5: FileHeader_Begin
//.........这里部分代码省略.........
//Chunk
if (!strcmp(ChunkList_Item->Value(), (NameSpace+"Chunk").c_str()))
{
File_DcpPkl::stream::chunk Chunk;
for (XMLElement* Chunk_Item=ChunkList_Item->FirstChildElement(); Chunk_Item; Chunk_Item=Chunk_Item->NextSiblingElement())
{
//Path
if (!strcmp(Chunk_Item->Value(), (NameSpace+"Path").c_str()))
Chunk.Path=Chunk_Item->GetText();
}
Stream.ChunkList.push_back(Chunk);
}
}
}
//Id
if (!strcmp(Asset_Item->Value(), (NameSpace+"Id").c_str()))
Stream.Id=Asset_Item->GetText();
//PackingList
if (!strcmp(Asset_Item->Value(), (NameSpace+"PackingList").c_str()))
{
PKL_Pos=Streams.size();
Stream.StreamKind=(stream_t)(Stream_Max+2); // Means PKL
}
}
Streams.push_back(Stream);
}
}
}
//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;
//Merging with PKL
if (PKL_Pos<Streams.size() && Streams[PKL_Pos].ChunkList.size()==1)
{
FileName Directory(File_Name);
Ztring PKL_FileName; PKL_FileName.From_UTF8(Streams[PKL_Pos].ChunkList[0].Path);
if (PKL_FileName.find(__T("file://"))==0 && PKL_FileName.find(__T("file:///"))==string::npos)
PKL_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+PKL_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 PKL")
|| MI.Get(Stream_General, 0, General_Format)==__T("IMF PKL")))
{
MergeFromPkl(((File_DcpPkl*)MI.Info)->Streams);
for (size_t Pos=0; Pos<MI.Count_Get(Stream_Other); ++Pos)
{
Stream_Prepare(Stream_Other);
Merge(*MI.Info, Stream_Other, Pos, StreamPos_Last);
}
}
}
//Creating the playlist
if (!Config->File_IsReferenced_Get())
{
ReferenceFiles=new File__ReferenceFilesHelper(this, Config);
for (File_DcpPkl::streams::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream)
if (Stream->StreamKind==(stream_t)(Stream_Max+1) && Stream->ChunkList.size()==1) // Means CPL
{
sequence* Sequence=new sequence;
Sequence->FileNames.push_back(Ztring().From_UTF8(Stream->ChunkList[0].Path));
Sequence->StreamID=ReferenceFiles->Sequences_Size()+1;
ReferenceFiles->AddSequence(Sequence);
}
ReferenceFiles->FilesForStorage=true;
}
//All should be OK...
return true;
}
示例6: FileHeader_Begin
//.........这里部分代码省略.........
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;
}
示例7: FileHeader_Begin
//.........这里部分代码省略.........
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;
}
示例8: Read_Buffer_Seek
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;
//.........这里部分代码省略.........