1 /* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2 *
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the License.html file in the root of the source tree.
5 */
6
7 //---------------------------------------------------------------------------
8 // Pre-compilation
9 #include "MediaInfo/PreComp.h"
10 #ifdef __BORLANDC__
11 #pragma hdrstop
12 #endif
13 //---------------------------------------------------------------------------
14
15 //---------------------------------------------------------------------------
16 #include "MediaInfo/Setup.h"
17 //---------------------------------------------------------------------------
18
19 //---------------------------------------------------------------------------
20 #if defined(MEDIAINFO_GZIP_YES)
21 //---------------------------------------------------------------------------
22
23 //---------------------------------------------------------------------------
24 #include "MediaInfo/Archive/File_Gzip.h"
25 //---------------------------------------------------------------------------
26
27 namespace MediaInfoLib
28 {
29
30 //***************************************************************************
31 // Static stuff
32 //***************************************************************************
33
34 //---------------------------------------------------------------------------
FileHeader_Begin()35 bool File_Gzip::FileHeader_Begin()
36 {
37 //Element_Size
38 if (Buffer_Size<2)
39 return false; //Must wait for more data
40
41 if (Buffer[0]!=0x1F
42 || Buffer[1]!=0x8B)
43 {
44 Reject("Gzip");
45 return false;
46 }
47
48 //All should be OK...
49 return true;
50 }
51
52 //***************************************************************************
53 // Buffer - Global
54 //***************************************************************************
55
56 //---------------------------------------------------------------------------
Read_Buffer_Continue()57 void File_Gzip::Read_Buffer_Continue()
58 {
59 //Parsing
60 int8u CM;
61 Skip_B2( "IDentification");
62 Get_B1 (CM, "Compression Method");
63 Skip_B1( "FLaGs");
64 Skip_B4( "Modified TIME");
65 Skip_XX(File_Size-10, "Data");
66
67 FILLING_BEGIN();
68 //Filling
69 Accept("Gzip");
70
71 Fill(Stream_General, 0, General_Format, "GZip");
72 Fill(Stream_General, 0, General_Format_Profile, "deflate");
73
74 Finish("Gzip");
75 FILLING_END();
76 }
77
78 //***************************************************************************
79 // C++
80 //***************************************************************************
81
82 } //NameSpace
83
84 #endif //MEDIAINFO_GZIP_YES
85