OSDN Git Service

295b3b1a7b58df416eb391edc9ce34d4e415e5da
[tsremuxcpp/developing01.git] / src / Mkv.h
1 #ifndef TSREMUXCPP_MKV_H_
2 #define TSREMUXCPP_MKV_H_
3
4 #include "Utils.h"
5 #include "define_temporary.h"
6 #include "define_backgroundworker.h"
7
8 namespace TsRemux {
9
10 enum LacingType {
11     NoLacing = 0,
12     XiphLacing,
13     FixedSizeLacing,
14     EbmLacing
15 };
16
17 class EbmlElement {
18  public:
19   static EbmlElement* ParseEbml(Stream fs);
20   Int64 Id;
21   Int64 Size;
22   Stream DataStream;
23   EbmlElement* Children;
24   static char VintLength(char vint);
25   static Int64 VintToInt64(Stream fs);
26  protected:
27   Int64 id;
28   Int64 size;
29   Int64 pos;
30   Stream fs;
31   Int64 Position;
32   EbmlElement(Int64 id, Int64 size, Int64 pos, Stream& fs);
33  private:
34 /*  static const Int64 vsint_subtr[] = {
35     0x3fLL, 0x1ffffLL, 0xfffffLL, 0x7ffffffLL, 0x3ffffffffLL,
36     0x1ffffffffffLL, 0xffffffffffffffLL, 0x7fffffffffffffLL };*/
37 };
38
39 struct TrackInfo {
40  public:
41   TrackInfo(ushort pid, std::string codec, pByte data, EbmlElement& info);
42   ushort pid;
43   std::string codec;
44   char data[];
45   EbmlElement info;
46 };
47
48 class MkvPesFile {
49  public:
50   MkvPesFile(BackgroundWorker& bw);
51   DTCP_Descriptor DtcpInfo;
52   boost::shared_array<PesPacket> GetNextPesPackets(void);
53   void Seek(Int32 pcr);
54  protected:
55   void GetInitialValues(void);
56  private:
57   SortedList<Int64, EbmlElement> Clusters;
58   signed int CuurentIndex;
59   Dictionary<ushort, TrackInfo> TrackList;
60   unsigned long long GetClusterClock(EbmlElement cluster);
61   PesPacket BuildAc3Pes(Int64 timestamp, char data[], ushort pid);
62   PesPacket BuildMpeg2Pes(Int64 timestamp, char data[], ushort pid);
63   PesPacket BuildAvcPes(Int64 timestamp, char data[], ushort pid);
64   PesPacket BuildVc1Pes(Int64 timestamp, char data[], ushort pid);
65   void GetTimeStamps(void);
66 };
67 }
68 #endif
69