1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Note : the buffer must be given in ONE call
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
// Pre-compilation
#include "MediaInfo/PreComp.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/Setup.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#if defined(MEDIAINFO_CMML_YES)
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/Text/File_Cmml.h"
using namespace std;
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Buffer - Per element
//***************************************************************************
//---------------------------------------------------------------------------
void File_Cmml::Header_Parse()
{
//Filling
Header_Fill_Code(0, "Cmml");
Header_Fill_Size(Element_Size);
}
//---------------------------------------------------------------------------
void File_Cmml::Data_Parse()
{
//Parsing
if (Status[IsAccepted])
Configuration();
else
Identification();
}
//***************************************************************************
// Elements
//***************************************************************************
//---------------------------------------------------------------------------
void File_Cmml::Identification()
{
Element_Name("Identification");
//Parsing
int16u VersionMajor, VersionMinor;
Skip_Local(8, "Signature");
Get_L2 (VersionMajor, "version major");
Get_L2 (VersionMinor, "version minor");
Skip_L8( "granule rate numerator");
Skip_L8( "granule rate denominator");
Skip_L1( "granule shift");
FILLING_BEGIN();
Accept("CMML");
Stream_Prepare(Stream_Text);
Fill(Stream_Text, 0, Text_Format, "CMML");
Fill(Stream_Text, 0, Text_Codec, "CMML");
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Cmml::Configuration()
{
Element_Name("Configuration");
//Parsing
Ztring Data;
Get_UTF8(Element_Size, Data, "Data");
FILLING_BEGIN();
Ztring Value;
Value=Data.SubString(__T("<head>"), __T("</head>"));
if (!Value.empty())
Fill(Stream_Text, 0, Text_Title, Value.SubString(__T("<title>"), __T("</title>")));
if (Data.find(__T("<clip"))!=string::npos)
Finish("CMML");
FILLING_END();
}
//***************************************************************************
// C++
//***************************************************************************
} //NameSpace
#endif //MEDIAINFO_CMML_YES
|