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 Caption Distribution Packet files
10 //
11 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 
13 //---------------------------------------------------------------------------
14 #ifndef MediaInfo_File_CdpH
15 #define MediaInfo_File_CdpH
16 //---------------------------------------------------------------------------
17 
18 //---------------------------------------------------------------------------
19 #include "MediaInfo/File__Analyze.h"
20 #if defined(MEDIAINFO_EIA608_YES)
21     #include "MediaInfo/Text/File_Eia608.h"
22 #endif
23 #if defined(MEDIAINFO_EIA708_YES)
24     #include "MediaInfo/Text/File_Eia708.h"
25 #endif
26 //---------------------------------------------------------------------------
27 
28 namespace MediaInfoLib
29 {
30 
31 //***************************************************************************
32 // Class File_Cdp
33 //***************************************************************************
34 
35 class File_Cdp : public File__Analyze
36 {
37 public :
38     //In
39     bool    WithAppleHeader;
40     float64 AspectRatio;
41 
42     //Constructor/Destructor
43     File_Cdp();
44     ~File_Cdp();
45 
46 private :
47     //Streams management
48     void Streams_Accept();
49     void Streams_Update();
50     void Streams_Update_PerStream(size_t Pos);
51     void Streams_Finish();
52 
53     //Synchro
54     void Read_Buffer_Unsynched();
55 
56     //Buffer - Global
57     void Read_Buffer_Continue();
58 
59     //Buffer - Synchro
60     bool Synchronize();
61     bool Synched_Test();
62 
63     //Buffer - Per element
64     void Header_Parse();
65     void Data_Parse();
66 
67     //Elements
68     void cdp_header();
69     void time_code_section();
70     void ccdata_section();
71     void ccsvcinfo_section();
72     void cdp_footer();
73     void future_section();
74 
75     //Stream
76     struct stream
77     {
78         File__Analyze*  Parser;
79         size_t          StreamPos;
80         bool            IsFilled;
81 
streamstream82         stream()
83         {
84             Parser=NULL;
85             StreamPos=(size_t)-1;
86             IsFilled=false;
87         }
88 
~streamstream89         ~stream()
90         {
91             delete Parser; //Parser=NULL;
92         }
93     };
94     std::vector<stream*> Streams;
95     size_t               Streams_Count;
96 
97     //Temp
98     int8u cdp_frame_rate;
99     int8u cdp_length;
100 
101     //Helpers
102     void  CreateStream(int8u Parser_Pos);
103 
104     //Tests
105     int8u cdp_length_Min;
106     int8u cdp_length_Max;
107 };
108 
109 } //NameSpace
110 
111 #endif
112