---------------------------------------------------------------------------
| 57 | |
| 58 | //--------------------------------------------------------------------------- |
| 59 | bool 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 | { |
nothing calls this directly
no test coverage detected