~ubuntu-branches/ubuntu/wily/mkvtoolnix/wily

« back to all changes in this revision

Viewing changes to lib/libmatroska/matroska/FileKax.h

  • Committer: Package Import Robot
  • Author(s): Christian Marillat
  • Date: 2015-04-26 10:36:27 UTC
  • mfrom: (1.1.29) (4.2.45 sid)
  • Revision ID: package-import@ubuntu.com-20150426103627-k53p8hrai2ynikaa
Tags: 7.8.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
** modify it under the terms of the GNU Lesser General Public
12
12
** License as published by the Free Software Foundation; either
13
13
** version 2.1 of the License, or (at your option) any later version.
14
 
** 
 
14
**
15
15
** This library is distributed in the hope that it will be useful,
16
16
** but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
18
** Lesser General Public License for more details.
19
 
** 
 
19
**
20
20
** You should have received a copy of the GNU Lesser General Public
21
21
** License along with this library; if not, write to the Free Software
22
22
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
28
28
**********************************************************************/
29
29
 
30
30
/*!
31
 
        \file
32
 
        \version \$Id: FileKax.h,v 1.5 2004/04/14 23:26:17 robux4 Exp $
33
 
        \author Steve Lhomme     <robux4 @ users.sf.net>
 
31
  \file
 
32
  \version \$Id: FileKax.h,v 1.5 2004/04/14 23:26:17 robux4 Exp $
 
33
  \author Steve Lhomme     <robux4 @ users.sf.net>
34
34
*/
35
35
#ifndef LIBMATROSKA_FILE_H
36
36
#define LIBMATROSKA_FILE_H
60
60
*/
61
61
class MATROSKA_DLL_API FileMatroska {
62
62
    public:
63
 
                FileMatroska(IOCallback & output);
64
 
                ~FileMatroska();
 
63
    FileMatroska(IOCallback & output);
 
64
    ~FileMatroska();
65
65
#ifdef OLD
66
 
        filepos_t RenderHead(const std::string & aEncoderApp);
67
 
        uint32 ReadHead();
68
 
        uint32 ReadTracks();
69
 
        uint32 ReadCodec();
70
 
        void Close(const uint32 aTimeLength);
71
 
 
72
 
        inline void type_SetInfo(const std::string & aStr) {myMainHeader.type_SetInfo(aStr);}
73
 
        inline void type_SetAds(const std::string & aStr) {myMainHeader.type_SetAds(aStr);}
74
 
        inline void type_SetSize(const std::string & aStr) {myMainHeader.type_SetSize(aStr);}
75
 
        inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);}
76
 
 
77
 
        inline uint8 GetTrackNumber() const { return myTracks.size(); }
78
 
 
79
 
        void track_SetName(Track * aTrack, const std::string & aName);
80
 
        void track_SetLaced(Track * aTrack, bool bLaced = true);
81
 
 
82
 
        Track * CreateTrack(const track_type aType);
83
 
        inline Track * GetTrack(const uint8 aTrackNb) const
84
 
        {
85
 
            if (aTrackNb > myTracks.size())
86
 
                return NULL;
87
 
            else
88
 
                return myTracks[aTrackNb-1];
89
 
        }
90
 
 
91
 
        void Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) const;
92
 
        
93
 
        void Track_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aTrackInfo);
94
 
        void Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aTrackInfo) const;
95
 
 
96
 
        void Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aTrackInfo);
97
 
        void Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aTrackInfo) const;
98
 
 
99
 
        void SelectReadingTrack(Track * aTrack, bool select = true);
100
 
 
101
 
        /*!
102
 
            \return wether the frame has been added or not
103
 
        */
104
 
        bool AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
105
 
                     bool aKeyFrame = true, bool aBFrame = false);
106
 
 
107
 
        /*!
108
 
            \return wether the frame has been read or not
109
 
        */
110
 
        bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
111
 
                     bool & aKeyFrame, bool & aBFrame);
112
 
 
113
 
        /*
114
 
            Render the pending cluster to file
115
 
        */
116
 
        void Flush();
117
 
 
118
 
        void SetMaxClusterSize(const uint32 value);
119
 
        void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;}
 
66
  filepos_t RenderHead(const std::string & aEncoderApp);
 
67
  uint32 ReadHead();
 
68
  uint32 ReadTracks();
 
69
  uint32 ReadCodec();
 
70
  void Close(const uint32 aTimeLength);
 
71
 
 
72
  inline void type_SetInfo(const std::string & aStr) {myMainHeader.type_SetInfo(aStr);}
 
73
  inline void type_SetAds(const std::string & aStr) {myMainHeader.type_SetAds(aStr);}
 
74
  inline void type_SetSize(const std::string & aStr) {myMainHeader.type_SetSize(aStr);}
 
75
  inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);}
 
76
 
 
77
  inline uint8 GetTrackNumber() const { return myTracks.size(); }
 
78
 
 
79
  void track_SetName(Track * aTrack, const std::string & aName);
 
80
  void track_SetLaced(Track * aTrack, bool bLaced = true);
 
81
 
 
82
  Track * CreateTrack(const track_type aType);
 
83
  inline Track * GetTrack(const uint8 aTrackNb) const
 
84
  {
 
85
      if (aTrackNb > myTracks.size())
 
86
    return NULL;
 
87
      else
 
88
    return myTracks[aTrackNb-1];
 
89
  }
 
90
 
 
91
  void Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) const;
 
92
 
 
93
  void Track_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aTrackInfo);
 
94
  void Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aTrackInfo) const;
 
95
 
 
96
  void Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aTrackInfo);
 
97
  void Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aTrackInfo) const;
 
98
 
 
99
  void SelectReadingTrack(Track * aTrack, bool select = true);
 
100
 
 
101
  /*!
 
102
      \return wether the frame has been added or not
 
103
  */
 
104
  bool AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
 
105
         bool aKeyFrame = true, bool aBFrame = false);
 
106
 
 
107
  /*!
 
108
      \return wether the frame has been read or not
 
109
  */
 
110
  bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
 
111
         bool & aKeyFrame, bool & aBFrame);
 
112
 
 
113
  /*
 
114
      Render the pending cluster to file
 
115
  */
 
116
  void Flush();
 
117
 
 
118
  void SetMaxClusterSize(const uint32 value);
 
119
  void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;}
120
120
 
121
121
    protected:
122
 
        MainHeader myMainHeader;
123
 
 
124
 
        std::vector<Track *> myTracks;
125
 
        std::vector<uint8> mySelectedTracks;
126
 
 
127
 
//      Track *findTrack(Track * aTrack) const;
128
 
 
129
 
        Cluster  myCurrWriteCluster; /// \todo merge with the write one ?
130
 
        uint32   myReadBlockNumber;
131
 
        Cluster  myCurrReadCluster;
132
 
        binary * myCurrReadBlock;      ///< The buffer containing the current read block
133
 
        uint32   myCurrReadBlockSize;  ///< The size of the buffer containing the current read block
134
 
        uint8    myCurrReadBlockTrack; ///< The track number of the current track to read
135
 
 
136
 
        uint32 myMaxClusterSize;
137
 
        uint32 myMinClusterSize;
138
 
 
139
 
        StreamInfo myStreamInfo;
140
 
 
141
 
        CodecHeader myCodecHeader;
142
 
 
143
 
        inline bool IsMyTrack(const Track * aTrack) const;
144
 
        inline bool IsReadingTrack(const uint8 aTrackNum) const;
 
122
  MainHeader myMainHeader;
 
123
 
 
124
  std::vector<Track *> myTracks;
 
125
  std::vector<uint8> mySelectedTracks;
 
126
 
 
127
//  Track *findTrack(Track * aTrack) const;
 
128
 
 
129
  Cluster  myCurrWriteCluster; /// \todo merge with the write one ?
 
130
  uint32   myReadBlockNumber;
 
131
  Cluster  myCurrReadCluster;
 
132
  binary * myCurrReadBlock;      ///< The buffer containing the current read block
 
133
  uint32   myCurrReadBlockSize;  ///< The size of the buffer containing the current read block
 
134
  uint8    myCurrReadBlockTrack; ///< The track number of the current track to read
 
135
 
 
136
  uint32 myMaxClusterSize;
 
137
  uint32 myMinClusterSize;
 
138
 
 
139
  StreamInfo myStreamInfo;
 
140
 
 
141
  CodecHeader myCodecHeader;
 
142
 
 
143
  inline bool IsMyTrack(const Track * aTrack) const;
 
144
  inline bool IsReadingTrack(const uint8 aTrackNum) const;
145
145
#endif // OLD
146
 
        IOCallback & myFile;
 
146
  IOCallback & myFile;
147
147
 
148
148
};
149
149