summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9cell.h
blob: 486f14a7c0443d2a9adcf2c8361bbab45511dfb2 (plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/***************************************************************************
*   Copyright (C) 2005 by Jean-Michel Petit                               *
*   jm_petit@laposte.net                                                  *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
***************************************************************************/
#ifndef K9CELL_H
#define K9CELL_H

#include "k9common.h"
#include "k9dvdtitle.h"


enum streamType_t {stAudio,stVideo,stSubpicture,stOther};
/**
@author Jean-Michel Petit
*/
class k9CellList;
class k9Cell;
class k9DVDTitleset;
class k9Vobu : public TQObject {
    Q_OBJECT
  
public:
    k9Vobu(k9Cell * parent,uint32_t _oldSector);
    ~k9Vobu();
    uint32_t newSector;
    uint32_t oldSector;
    uint32_t size;
    int firstAudio[8];
    int firstSubp[32];
    int firstVideo;
    bool empty;
    k9Cell *parent;
    long vobPos;
    int vobNum;
    uchar frameType;
    uint32_t  firstRef,secondRef,thirdRef;
    bool firstRefOk,secondRefOk,thirdRefOk;
};

class k9VobuList : public TQPtrList <k9Vobu> {
public:
    k9Vobu *findVobu(uint32_t sector);
private:
    k9Vobu * findVobu(uint32_t sector, uint32_t start, uint32_t end);
protected:
    int compareItems ( TQPtrCollection::Item item1, TQPtrCollection::Item item2 ) ;
};

class k9Cell : public TQObject {
    Q_OBJECT
  
public:
    k9Cell(TQObject *parent = 0, const char *name = 0);
    ~k9Cell();
    k9Vobu * addVobu(uint32_t _sector);
    void addNewVobus(char *_buffer,uint32_t _len,uint32_t _position,int _vobNum,long _vobPos);
    static int isNavPack (uchar *ptr);
    static streamType_t identifyStream( uchar *buffer,int * packetType );
    static int getStreamID(int type);
    k9Vobu * findVobu(uint32_t _oldSector);
    uint32_t getnewSize();
    void addTitle(k9DVDTitle *_title);
    k9DVDTitleset * getTitleset();
    bool getforceFactor();
    float getFactor();
public:
    k9VobuList vobus;
    int vts;
    int pgc;
    int vob;
    uint32_t startSector;
    uint32_t lastSector;
    //TO REMOVE    uint32_t ;
    //TO REMOVE    uint32_t ;
    //TO REMOVE    uint32_t newSize;
    uchar angleBlock;
    //TO REMOVE    int nbVideoNew,nbVideoOld;
    int id;
    bool selected;
    bool copied;
    TQValueList<int> audio;
    TQValueList<int> subpicture;
    k9CellList *cellList;
private:
    int numVobu;
    void addRefStream(k9Vobu *_vobu,uchar *_buffer,uint32_t _position);
    TQPtrList <k9DVDTitle> m_titles;
};



class k9CellList : public TQPtrList <k9Cell> {
private:
    uint32_t m_position;
    k9Cell * findCell(uint32_t sector);
    k9Cell * findCell(uint32_t sector, uint32_t start, uint32_t end);

public:
    k9CellList() {
        m_position=0;
    };
    k9Cell *addCell(int _vts, int _pgc,int _vob);
    k9Vobu *findVobu(uint32_t sector);

    void setPosition(const uint32_t& _value) {
        m_position = _value;
    }

    uint32_t getPosition() const {
        return m_position;
    }

};


#endif