/[tivodecode]/t2sami/trunk/TScan.h
ViewVC logotype

Contents of /t2sami/trunk/TScan.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 243 - (show annotations) (download)
Tue Aug 28 05:01:16 2007 UTC (14 years, 11 months ago) by jeremyd2019
File MIME type: text/plain
File size: 4128 byte(s)
change to allow reading and writing to stdin/stdout, based loosely on a patch by mikel111, but make it consitent with tivodecode (and other unix apps) in that an input or output file of '-' means stdin or stdout respectively

1 // TScan.h
2 //
3 //********************************************************************
4 //
5 // Copyright (c) 2005-2007 James Memmott <jmemmott@braeman.com>
6 //
7 // This software is provided 'as-is', without any express or implied warranty.
8 // In no event will the author be held liable for any damages arising from the
9 // use of this software.
10 //
11 // Permission is granted to anyone to use this software for any purpose, including
12 // commercial applications, and to alter it and redistribute it freely, subject to
13 // the following restrictions:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the disclaimer.
17 //
18 // 2. The origin of this software must not be misrepresented; you must not claim
19 // that you wrote the original software. If you use this software in a product,
20 // an acknowledgment in the product documentation would be appreciated but is
21 // not required.
22 //
23 // 3. Altered source versions must be plainly marked as such, and must not be
24 // misrepresented as being the original software.
25 //
26 //********************************************************************
27 //
28
29 #include <boost/cstdint.hpp>
30 #include <boost/function.hpp>
31
32 #ifndef TSCAN_H
33 #define TSCAN_H
34
35 #if _MSC_VER > 1000
36 #pragma once
37 #endif // _MSC_VER > 1000
38
39 #include "PS.h"
40 #include "CC.h"
41
42 #define SEQUENCE_EXTENSION 0
43 #define GROUP_EXTENSION 1
44 #define PICTURE_EXTENSION 2
45
46 #define SEQUENCE_EXTENSION_ID 1
47 #define SEQUENCE_DISPLAY_EXTENSION_ID 2
48 #define QUANT_MATRIX_EXTENSION_ID 3
49 #define SEQUENCE_SCALABLE_EXTENSION_ID 5
50 #define PICTURE_DISPLAY_EXTENSION_ID 7
51 #define PICTURE_CODING_EXTENSION_ID 8
52 #define PICTURE_SPATIAL_SCALABLE_EXTENSION_ID 9
53 #define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID 10
54
55 #define DATA_PARTITIONING 0
56 #define SPATIAL_SCALABILITY 1
57 #define SNR_SCALABILITY 2
58 #define TEMPORAL_SCALABILITY 3
59
60 #define FMT_SAMI 0
61 #define FMT_SRT 1
62
63 class CTivoScan{
64 friend class CClosedCaption;
65
66 // Attributes
67
68 CPs m_cStream;
69 boost::int64_t s_pks;
70 boost::int64_t s_sp;
71 boost::int64_t s_vp;
72 boost::int64_t s_ap;
73 boost::int64_t s_op;
74 boost::int64_t s_psm;
75 int n_pks;
76 int n_sp;
77 int n_ap;
78 int n_vp;
79 int n_psm;
80 int n_op;
81
82 CClosedCaption m_Cc;
83 int m_lastGOPHour;
84 int m_lastGOPMinute;
85 int m_lastGOPSecond;
86 int m_lastGOPFrame;
87 double m_lastPTS;
88 double m_lastDTS;
89 int m_nLastSync;
90 int m_nCaptionCount;
91 std::string m_csCurrentCaption;
92 int m_SampleDiff;
93 bool m_validSampleDiff;
94
95 bool m_readok;
96
97 int m_nVerticalSize;
98 int m_nMbWidth;
99 bool m_bSequenceScalableExtension;
100 int m_nScalableMode;
101 int m_nPictureCodingType;
102 bool m_bQuiet;
103 bool m_bAddSpaces;
104
105 public:
106 FILE * m_nFile;
107 int m_nSyncBias;
108 bool m_bUseCutoffDuration;
109 int m_nCutoffDuration;
110 std::string m_csFontWeight;
111 std::string m_csFontSize;
112 std::string m_csFontFamily;
113 int m_nCaptionFormat;
114 int m_nCcChannel;
115 bool m_bDoHtmlEncode;
116 bool m_bShowSummary;
117 std::string m_szOutputCaptionFile;
118
119 boost::function1<void, int> m_cbPercentChange;
120
121 public:
122 CTivoScan();
123 virtual ~CTivoScan();
124 void setQuiet( bool bQuiet ) { m_bQuiet = bQuiet; }
125 void setChannel( int nChannel ) { m_nCcChannel = nChannel; }
126
127 void ProcessAudioPES();
128 int ProcessSequenceHeader();
129 int ProcessGroupStart();
130 int ProcessExtensionAndUserdata( int etype );
131 int ProcessSequenceDisplayExtension();
132 int ProcessSequenceScalableExtension();
133 int ProcessExtensiondata( int etype );
134 int ASTCDecode( int dif );
135 int ProcessUserdata();
136 int ProcessPictureHeader();
137 int ProcessPictureCodingExtension();
138 int ProcessPictureData();
139 int ProcessSequenceExtension();
140 void ProcessVideoPES();
141 bool ProcessPS( const char * lpFileName, const std::string & szOutputName );
142 int getAudioOffset() { return m_validSampleDiff ? m_SampleDiff : 0; }
143 void setAddSpaces( bool bAddSpaces ) { m_bAddSpaces = bAddSpaces; }
144
145 std::string getCaptionFileName() { return m_szOutputCaptionFile; }
146
147 void CloseFile();
148 void WriteString( const std::string & szString );
149
150 };
151
152 #endif

cvs@jdrake.com
ViewVC Help
Powered by ViewVC 1.1.13