1
/***************************************************************************
2
ADM_pics.h - description
5
copyright : (C) 2002 by mean
6
email : fixounet@free.fr
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
23
#include "ADM_editor/ADM_Video.h"
24
#include "ADM_audio/aviaudio.hxx"
25
#include "ADM_inputs/ADM_matroska/ADM_ebml.h"
33
uint32_t timeCode; // In fact it is delta between DTS and PTS for audio...
35
//**********************************************
47
uint32_t extraDataLen;
49
uint32_t _nbIndex; // current size of the index
50
uint32_t _indexMax; // Max size of the index
51
uint32_t _sizeInBytes; // Approximate size in bytes of that stream
52
uint32_t _defaultFrameDuration; // in us!
55
#define MKV_MAX_LACES 20 // ?
56
//**********************************************
57
class mkvAudio : public AVDMGenericAudioStream
61
ADM_ebml_file *_parser;
62
ADM_ebml_file *_clusterParser;
65
uint32_t _currentCluster;
67
uint32_t _frameDurationInSample; // Nb Samples per frame
69
uint32_t _currentLace;
71
uint32_t _Laces[MKV_MAX_LACES];
73
uint8_t goToCluster(uint32_t x);
74
uint8_t getPacket(uint8_t *dest, uint32_t *packlen, uint32_t *samples,uint32_t *timecode);
75
uint32_t _curTimeCode;
77
mkvAudio(const char *name,mkvTrak *track,mkvIndex *clust,uint32_t nbClusters);
81
virtual uint32_t read(uint32_t len,uint8_t *buffer);
82
virtual uint8_t goTo(uint32_t newoffset);
83
uint8_t goToTime(uint32_t mstime);
84
virtual uint8_t getPacket(uint8_t *dest, uint32_t *len, uint32_t *samples);
85
// virtual uint8_t goToTime(uint32_t mstime);
86
virtual uint8_t extraData(uint32_t *l,uint8_t **d);
90
#define ADM_MKV_MAX_TRACKS 20
92
class mkvHeader :public vidHeader
96
ADM_ebml_file *_parser;
98
mkvTrak _tracks[ADM_MKV_MAX_TRACKS+1];
101
uint32_t _nbClusters;
102
uint32_t _clustersCeil;
104
uint32_t _nbAudioTrack;
105
uint32_t _currentAudioTrack;
108
uint8_t checkHeader(void *head,uint32_t headlen);
109
uint8_t analyzeTracks(void *head,uint32_t headlen);
110
uint8_t analyzeOneTrack(void *head,uint32_t headlen);
111
uint8_t walk(void *seed);
112
int searchTrackFromTid(uint32_t tid);
114
uint8_t reformatVorbisHeader(mkvTrak *trk);
117
uint8_t addIndexEntry(uint32_t track,uint64_t where, uint32_t size,uint32_t flags,
118
uint32_t timecodeMS);
119
uint8_t videoIndexer(ADM_ebml_file *parser);
120
uint8_t readCue(ADM_ebml_file *parser);
121
uint8_t indexClusters(ADM_ebml_file *parser);
122
uint8_t indexBlock(ADM_ebml_file *parser,uint32_t count,uint32_t timecodeMS);
124
uint8_t changeAudioStream(uint32_t newstream);
125
uint32_t getCurrentAudioStreamNumber(void);
126
uint8_t getAudioStreamsInfo(uint32_t *nbStreams, audioInfo **infos);
130
uint8_t hasPtsDts(void) {return 1;} // Return 1 if the container gives PTS & DTS info
131
uint32_t ptsDtsDelta(uint32_t framenum);
133
virtual void Dump(void);
136
virtual ~mkvHeader( ) ;
138
virtual uint8_t open(char *name);
139
virtual uint8_t close(void) ;
140
//__________________________
142
//__________________________
144
//__________________________
146
//__________________________
148
virtual WAVHeader *getAudioInfo(void ) ;
149
virtual uint8_t getAudioStream(AVDMGenericAudioStream **audio);
153
//__________________________
155
//__________________________
157
virtual uint8_t setFlag(uint32_t frame,uint32_t flags);
158
virtual uint32_t getFlags(uint32_t frame,uint32_t *flags);
159
virtual uint8_t getFrameNoAlloc(uint32_t framenum,ADMCompressedImage *img);
161
uint8_t getExtraHeaderData(uint32_t *len, uint8_t **data);
162
uint8_t isReordered( void );
163
uint8_t reorder( void );