MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / FileHeader_Begin

Method FileHeader_Begin

Source/MediaInfo/Multiple/File_Hls.cpp:59–205  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

57
58//---------------------------------------------------------------------------
59bool File_Hls::FileHeader_Begin()
60{
61 //Element_Size
62 if (File_Size>1024*1024 || File_Size<10)
63 {
64 Reject("HLS");
65 return false; //HLS files are not big
66 }
67
68 if (Buffer_Size<File_Size)
69 return false; //Wait for complete file
70
71 Ztring Document; Document.From_UTF8((char*)Buffer, Buffer_Size);
72 ZtringList Lines;
73 size_t LinesSeparator_Pos=Document.find_first_of(__T("\r\n"));
74 if (LinesSeparator_Pos>File_Size-1)
75 {
76 Reject("HLS");
77 return false;
78 }
79 Ztring LinesSeparator;
80 if (Document[LinesSeparator_Pos]==__T('\r') && LinesSeparator_Pos+1<Document.size() && Document[LinesSeparator_Pos+1]==__T('\n'))
81 LinesSeparator=__T("\r\n");
82 else if (Document[LinesSeparator_Pos]==__T('\r'))
83 LinesSeparator=__T("\r");
84 else if (Document[LinesSeparator_Pos]==__T('\n'))
85 LinesSeparator=__T("\n");
86 else
87 {
88 Reject("HLS");
89 return false;
90 }
91 Lines.Separator_Set(0, LinesSeparator);
92 Lines.Write(Document);
93
94 if (Lines(0)!=__T("#EXTM3U"))
95 {
96 Reject("HLS");
97 return false;
98 }
99
100 Accept("HLS");
101 Fill(Stream_General, 0, General_Format, "HLS");
102
103 ReferenceFiles_Accept(this, Config);
104
105 #if defined(MEDIAINFO_REFERENCES_YES)
106 if (!IsSub)
107 ReferenceFiles->ContainerHasNoId=true;
108
109 sequence* Sequence=new sequence;
110
111 bool IsGroup=false;
112 Ztring PreviousFile;
113 for (size_t Line=0; Line<Lines.size(); Line++)
114 {
115 if (!Lines[Line].empty())
116 {

Callers

nothing calls this directly

Calls 11

Encryption_Key_GetMethod · 0.80
Encryption_Key_SetMethod · 0.80
AddFileNameMethod · 0.80
Sequences_SizeMethod · 0.80
AddSequenceMethod · 0.80
OpenMethod · 0.65
sizeMethod · 0.45
WriteMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected