1 |
// PS.h
|
2 |
//
|
3 |
//********************************************************************
|
4 |
//
|
5 |
// Copyright (c) 2005 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 |
#ifndef PS_H
|
30 |
#define PS_H
|
31 |
|
32 |
#if _MSC_VER > 1000
|
33 |
#pragma once
|
34 |
#endif // _MSC_VER > 1000
|
35 |
|
36 |
#include <boost/cstdint.hpp>
|
37 |
#include "Bit.h"
|
38 |
#include <string>
|
39 |
#include "happyfile.h"
|
40 |
#define PS_BUFFER_LENGTH 2097152
|
41 |
|
42 |
// forward declare class
|
43 |
class CTivoScan;
|
44 |
|
45 |
struct qData {
|
46 |
int nData;
|
47 |
byte *pbData;
|
48 |
};
|
49 |
|
50 |
class CPs{
|
51 |
|
52 |
friend class CTivoScan;
|
53 |
|
54 |
// Attributes
|
55 |
public:
|
56 |
|
57 |
happy_file * m_nFile;
|
58 |
boost::uint64_t m_dwFileLength;
|
59 |
boost::uint64_t m_dwBufferBase;
|
60 |
byte *buf;
|
61 |
size_t buf_len;
|
62 |
size_t pos;
|
63 |
CBit b;
|
64 |
|
65 |
private:
|
66 |
|
67 |
CTivoScan *m_pParent;
|
68 |
|
69 |
public:
|
70 |
CPs();
|
71 |
virtual ~CPs();
|
72 |
|
73 |
bool CleanUp(void);
|
74 |
void fill_buffer(size_t st);
|
75 |
bool check_buffer( size_t need );
|
76 |
int next_code(bool *valid );
|
77 |
bool read_code(int *code );
|
78 |
size_t skip2code();
|
79 |
bool end_mb(int st_bit );
|
80 |
void skip_info(int n_bytes);
|
81 |
int ret_value(int n_bytes);
|
82 |
int ret_bit_value(int st_bit,int end_bit,bool act);
|
83 |
int get_bit_value( int *st_bit, int *dif, int nbits );
|
84 |
void end_PS();
|
85 |
bool zero();
|
86 |
void go_back(int step);
|
87 |
double get_SCR();
|
88 |
double get_PES_stamp();
|
89 |
bool ret_bit(int pz);
|
90 |
|
91 |
bool Initialize( std::string szInputFile );
|
92 |
int PercentDone(void);
|
93 |
|
94 |
};
|
95 |
|
96 |
#endif
|