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 //
9 // Information about MPEG Video files
10 //
11 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 
13 //---------------------------------------------------------------------------
14 #ifndef MediaInfo_Vc1H
15 #define MediaInfo_Vc1H
16 //---------------------------------------------------------------------------
17 
18 //---------------------------------------------------------------------------
19 #include "MediaInfo/File__Analyze.h"
20 //---------------------------------------------------------------------------
21 
22 namespace MediaInfoLib
23 {
24 
25 //***************************************************************************
26 // Class File_Vc1
27 //***************************************************************************
28 
29 class File_Vc1 : public File__Analyze
30 {
31 public :
32     //In
33     int64u Frame_Count_Valid;
34     bool   FrameIsAlwaysComplete;
35     bool   From_WMV3;
36     bool   Only_0D;
37 
38     //Constructor/Destructor
39     File_Vc1();
40     ~File_Vc1();
41 
42 private :
43     //Streams management
44     void Streams_Accept();
45     void Streams_Fill();
46     void Streams_Finish();
47 
48     //Buffer - File header
49     bool FileHeader_Begin();
50 
51     //Buffer - Synchro
Synchronize()52     bool Synchronize() {return Synchronize_0x000001();}
53     bool Synched_Test();
54     void Synched_Init();
55 
56     //Buffer - Demux
57     #if MEDIAINFO_DEMUX
58     bool Demux_UnpacketizeContainer_Test();
59     #endif //MEDIAINFO_DEMUX
60 
61     //Buffer - Global
62     void Read_Buffer_Unsynched();
63 
64     //Buffer - Per element
65     void Header_Parse();
66     bool Header_Parser_QuickSearch();
67     bool Header_Parser_Fill_Size();
68     void Data_Parse();
69 
70     //Elements
71     void EndOfSequence();
72     void Slice();
73     void Field();
74     void FrameHeader();
75     void EntryPointHeader();
76     void SequenceHeader();
77     void UserDefinedSlice();
78     void UserDefinedField();
79     void UserDefinedFrameHeader();
80     void UserDefinedEntryPointHeader();
81     void UserDefinedSequenceHeader();
82 
83     //Count
84     size_t Interlaced_Top;
85     size_t Interlaced_Bottom;
86     std::vector<size_t> PictureFormat_Count;
87 
88     //From SequenceHeader
89     std::vector<int32u> hrd_buffers;
90     int16u coded_width;
91     int16u coded_height;
92     int16u framerateexp;
93     int8u  frameratecode_enr;
94     int8u  frameratecode_dr;
95     int8u  profile;
96     int8u  level;
97     int8u  colordiff_format;
98     int8u  AspectRatio;
99     int8u  AspectRatioX;
100     int8u  AspectRatioY;
101     int8u  hrd_num_leaky_buckets;
102     int8u  max_b_frames;
103     bool   interlace;
104     bool   tfcntrflag;
105     bool   framerate_present;
106     bool   framerate_form;
107     bool   hrd_param_flag;
108     bool   finterpflag;
109     bool   rangered;
110     bool   psf;
111     bool   pulldown;
112     bool   panscan_flag;
113 
114     std::vector<stream_time> Streams;
115 
116     //Temporal reference
117     struct temporalreference
118     {
119         bool   top_field_first;
120         bool   repeat_first_field;
121     };
122     std::map<int16u, temporalreference> TemporalReference; //int32u is the reference
123     std::vector<temporalreference>      TemporalReference_Waiting; //First must be I and P-frames, other B-frames
124     int16u TemporalReference_Offset;
125 
126     //Temp
127     size_t Width;
128     size_t Height;
129     size_t RatioValue;
130     size_t BitRate;
131     int8u  start_code;
132     bool   EntryPoint_Parsed;
133     float64 FrameRate;
134     size_t RefFramesCount;
135 
136     //Error controls
137     std::vector<int8u> Frame_ShouldBe;
138 
139     #if MEDIAINFO_DEMUX
140         int8u* InitData_Buffer;
141         size_t InitData_Buffer_Size;
142     #endif //MEDIAINFO_DEMUX
143 
144 };
145 
146 } //NameSpace
147 
148 #endif
149