OSDN Git Service

add define in header files
authorMartini <cocot@users.sourceforge.jp>
Mon, 16 Feb 2009 12:55:39 +0000 (21:55 +0900)
committerMartini <cocot@users.sourceforge.jp>
Mon, 16 Feb 2009 12:55:39 +0000 (21:55 +0900)
src/BlueMux.h
src/Form1.cc
src/Form1.h
src/Mkv.cc
src/Mkv.h
src/TsToPes.cc
src/TsToPes.h
src/Utils.h
src/main.o [deleted file]

index 8aeecb0..84e0d2f 100644 (file)
@@ -1,9 +1,99 @@
 #ifndef TSREMUXCPP_BLUEMUX_H_
 #define TSREMUXCPP_BLUEMUX_H_
+
+#include <string>
+#include <list>
+
+#include "Utils.h"
+#include "TsToPes.h"
+#include "define_temporary.h"
+#include "define_stream.h"
+#include "define_backgroundworker.h"
+
 namespace TsRemux
 {
+struct EpElement {
+ public:
+  signed long long pts_;
+  unsigned long spn_;
+  EpElement(signed long long pts, unsigned long spn);
+};
+
+class BlueMux {
+ public:
+  BlueMux(std::string filename, TsFileType fileType,
+    std::list<StreamInfo> StreamsToKeep, bool fAsync,
+    bool fProcessAudio, bool fMlpToAc3);
+  unsigned int CurrentPacketNumber;
+  EpElement EpData[];
+  StreamInfo Psi;
+  void MuxPacket(PesPacket pp);
+  void PcrChanged(signed long long pcr);
+  void Close(void);
+
+ private:
+  void CreatePsi(void);
+  PesPacket CheckAndFixDiscontinuities(PesPacket pp);
+  void MuxPesPacketToTs(PesPacket pp, bool riority);
+  void MuxTsPacket(PesPacket pp);
+  void MuxAc3ToTs(PesPacket pp, ElementaryStreamTypes type);
+  void MuxMlpToTs(PesPacket pp, ElementaryStreamTypes type);
+  void MuxDtsToTs(PesPacket pp, ElementaryStreamTypes type);
+  void MuxSingleAc3ToTs(char payload[], signed int offset,
+    signed int len, signed long long pts,
+    ElementaryStreamTypes type, unsigned short pid);
+  void MuxSingleDtsToTs(char payload[], signed int offset,
+    signed int len, signed long long pts,
+    ElementaryStreamTypes type, unsigned short pid);
+  ElementaryStreamTypes GetStreamType(unsigned short pid);
+  TsFileType fileType;
+  std::list<StreamInfo> StreamToKeep;
+  TsIo tsiow;
+  std::list<TsPacket> buffer;
+  signed long long currentPcr;
+  signed long long lastPcr;
+  signed long long lastDelta;
+  signed long long pcrOffset;
+  signed long long currentPts;
+  signed long long lastPts;
+  signed long long ptsDelta;
+  signed long long ptsOffset;
+  signed long long ptsCount;
+  Dictionary<unsigned short, unsigned short> pidMappings;
+  char header[];
+  Dictionary<unsigned short, char> Continuities;
+  char supHeader[];
+  FileStream fsw;
+  char VideoType;
+  PesPacket lastPacket;
+  char sitCount;
+  unsigned int packetCount;
+  std::list<EpElement> epData;
+  std::list<StreamInfo> pmtStreams;
+  Dictionary<unsigned short, unsigned long long> lastPtsList;
+  Dictionary<unsigned short, std::list<char> > soundFrames;
+  bool processAudio;
+  bool MlpToAc3; 
+};
 
+class Coodinator {
+ public:
+  Coodinator(void);
+  void StartMuxing(std::string outPath, BackgroundWorker worker, TsFileType outType, std::list<unsigned short> pidsToKeep, time_t ts, time_t te, bool useAsync, PesFile input);
+  void StartMuxing(std::string outPath, BackgroundWorker worker, TsFileType outType, std::list<unsigned short> pidsToKeep, time_t ts, time_t te, bool useAsync, bool processAudio, bool MlpToAc3, PesFile input, PesFile secondry, time_t offset, time_t chapterLen);
+  void UpdatePcr(signed long long pcr);
+  void UpdatePts(signed long long pts, unsigned short pid);
+  signed long long endTime;
+  BackgroundWorker bw;
+  bool done;
+  signed long long seconds;
+  bool subtitles;
+  signed long long startOffset;
 
+ private:
+  PesFile inFile;
+  BlueMux outFile;
+};
 }
 #endif
 
index 6f2e37e..2ee4367 100644 (file)
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <string.h>
+#include <string>
 #include "Form1.h"
 
 namespace TsRemux {
@@ -87,9 +87,16 @@ int TsRemux::Exec(void)
     } else {
         printf("unrecognized output type\n");
     }
+
+    say(argv_[2]);
     return 0;
 }
 
+void TsRemux::say(char* txt)
+{
+    printf("%s\n", txt);
+}
+
 void TsRemux::Init(void)
 {
 }
index 18c4163..08ba7a0 100644 (file)
@@ -1,12 +1,17 @@
 #ifndef TSREMUXCPP_FORM1_H_
 #define TSREMUXCPP_FORM1_H_
 
+#include <string>
+#include <time.h>
+
 namespace TsRemux {
 
 class ExecCondition {
  public:
   ExecCondition(void);
   ~ExecCondition(void);
+  void tl_MouseLeave();
+  void tl_MouseEnter();
   char* input_file_text_;
   bool use_async_io_;
   bool bypass_audio_processing_;
@@ -26,10 +31,63 @@ class TsRemux {
 
  private:
   TsRemux(void);
+  void say(char* txt);
   void Init(void);
+  void DisableNumerics(void);
+  void DisableSup(void);
+  void EnableSup(void);
+  void EnableNumerics(void);
+  void OpenFile(std::string filename);
+  void OpenInputFileDialog_FileOK();
+  void AsyncOpenFile(std::string filename);
+  void InputFileBrowseButton_Click();
+  void EnableCbxMlp(void);
+  void ElementaryStreamListBox_ItemCheck();
+  void Quit_Click();
+  void RemuxButton_Click();
+  void backgroundWorker1_DoWork();
+  void backgroundWorker1_ProgressChanged();
+  void backgroundWorker1_RunWorkerCompleted();
+  void RemuxButton_MouseEnter();
+  void RemuxButton_MouseLeave();
+  void TsRemux_DragDrop();
+  void TsRemux_DragEnter();
+  void TrimStartNumericHours_ValueChanged();
+  void TrimStartNumericMinutes_ValueChanged();
+  void TrimStartNumericSeconds_ValueChanged();
+  void TrimEndNumericHours_ValueChanged();
+  void TrimEndNumericMinutes_ValueChanged();
+  void TrimEndNumericSeconds_ValueChanged();
+  void CheckTrimStart(void);
+  void CheckSupStart(void);
+  void CheckChapterLen(void);
+  void CheckTrimEnd(void);
+  void ElementaryContextMenu_Opening();
+  void AddStream_Click();
+  void RemoveStream_Click();
+  void DemuxElementary_Click();
+  void DemuxPes_Click();
+  void DemuxSup_Click();
+  void SaveElementaryStream_FileOK();
+  void RemoveSup(void);
+  void OpenSupFileDialog_FileOK();
+  bool PidExist(unsigned short pid);
+  void SupOffsetNumericSeconds_ValueChanged();
+  void SupOffsetNumericMinutes_ValueChanged();
+  void SupOffsetNumericHours_ValueChanged();
+  void TsFormatRadioButton_CheckedChenged();
+  void M2tsFormatRadioButton_CheckedChanged();
+  void backgroundWorker2_Dowork();
+  void backgroundWorker2_ProgressChanged();
+  void backgroundWorker2_RunWorkerCompleted();
   int argc_;
   char **argv_;
   ExecCondition exec_condition_;
+  time_t trim_start_;
+  time_t sup_start_;
+  time_t chapter_len_;
+  time_t trim_end_;
+  bool sup_selected_;
 };
 
 }  //namespace
index 9eb0ab7..10d7b18 100644 (file)
@@ -2,6 +2,9 @@
 
 namespace TsRemux
 {
+  static const signed long long vsint_subtr[] = {
+    0x3fLL, 0x1ffffLL, 0xfffffLL, 0x7ffffffLL, 0x3ffffffffLL,
+    0x1ffffffffffLL, 0xffffffffffffffLL, 0x7fffffffffffffLL };
 
 
 }
index 24a2223..74a9e6f 100644 (file)
--- a/src/Mkv.h
+++ b/src/Mkv.h
@@ -1,9 +1,71 @@
 #ifndef TSREMUXCPP_MKV_H_
 #define TSREMUXCPP_MKV_H_
-namespace TsRemux
-{
 
+#include <string>
+#include "Utils.h"
+#include "define_temporary.h"
+#include "define_stream.h"
+#include "define_backgroundworker.h"
 
+namespace TsRemux {
+
+enum LacingType {
+    NoLacing = 0,
+    XiphLacing,
+    FixedSizeLacing,
+    EbmLacing
+};
+
+class EbmlElement {
+ public:
+  static EbmlElement ParseEbml(Stream fs);
+  signed long long Id;
+  signed long long Size;
+  Stream DataStream;
+  EbmlElement* Children;
+  static char VintLength(char vint);
+  static signed long long VintToInt64(Stream fs);
+ protected:
+  signed long long id;
+  signed long long size;
+  signed long long pos;
+  Stream fs;
+  signed long long Position;
+  EbmlElement(signed long long id, signed long long size, signed long long pos, Stream fs);
+ private:
+/*  static const signed long long vsint_subtr[] = {
+    0x3fLL, 0x1ffffLL, 0xfffffLL, 0x7ffffffLL, 0x3ffffffffLL,
+    0x1ffffffffffLL, 0xffffffffffffffLL, 0x7fffffffffffffLL };*/
+};
+
+struct TrackInfo {
+ public:
+  TrackInfo(unsigned short pid, std::string codec, char data[], EbmlElement info);
+  unsigned short pid;
+  std::string codec;
+  char data[];
+  EbmlElement info;
+};
+
+class MkvPesFile {
+ public:
+  MkvPesFile(BackgroundWorker bw);
+  DTCP_Descriptor DtcpInfo;
+  PesPacket* GetNextPesPackets(void);
+  void Seek(signed long pcr);
+ protected:
+  void GetInitialValues(void);
+ private:
+  SortedList<signed long long, EbmlElement> Clusters;
+  signed int CuurentIndex;
+  Dictionary<unsigned short, TrackInfo> TrackList;
+  unsigned long long GetClusterClock(EbmlElement cluster);
+  PesPacket BuildAc3Pes(signed long long timestamp, char data[], unsigned short pid);
+  PesPacket BuildMpeg2Pes(signed long long timestamp, char data[], unsigned short pid);
+  PesPacket BuildAvcPes(signed long long timestamp, char data[], unsigned short pid);
+  PesPacket BuildVc1Pes(signed long long timestamp, char data[], unsigned short pid);
+  void GetTimeStamps(void);
+};
 }
 #endif
 
index b642b35..446af5f 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace TsRemux
 {
+  static const char PesTemplate[] = { 0x00, 0x00, 0x01, 0xbd};
 
 
 }
index 36ee842..bedb5bd 100644 (file)
@@ -1,9 +1,123 @@
 #ifndef TSREMUXCPP_TSTOPES_H_
 #define TSREMUXCPP_TSTOPES_H_
-namespace TsRemux
-{
 
+#include <string>
+#include <list>
+#include "Utils.h"
+#include "define_temporary.h"
+#include "define_stream.h"
+#include "define_backgroundworker.h"
+#include "define_iasyncresult.h"
+#include "define_pcrchanged.h"
+#include "define_ptschanged.h"
 
+namespace TsRemux {
+class TsIo {
+ public:
+  TsIo(FileStream read, FileStream write);
+  TsIo(FileStream read, FileStream write, signed int buffersize);
+  void init(FileStream read, FileStream write, signed int buffersize);
+  int Read(char target[], int offset, int count);
+  void Write(char target[], int offset, int count);
+  void Flush(void);
+  void Clear(void);
+ protected:
+ private:
+  FileStream fsr;
+  FileStream fsw;
+  char ReadBuffer1[];
+  char ReadBuffer2[];
+  char ReadBuffer[];
+  char WriteBuffer1[];
+  char WriteBuffer2[];
+  char WriteBuffer[];
+  signed long long readIndex;
+  signed long long readSize;
+  signed long long writeIndex;
+  IAsyncResult asyncRead;
+  IAsyncResult asyncWrite;
+};
+class PesFile {
+ public:
+  void SetPcrDelegate(PcrChanged pcr);
+  signed long long StartPcr;
+  signed long long EndPcr;
+  void SetPtsDelegate(PtsChanged pts);
+  StreamInfo GetStreamInfo(unsigned short pid);
+  void CloseFile(void);
+  void Clear(void);
+  TsFileType FileType;
+  StreamInfo StreamInfos[];
+  time_t VideoLength;
+  PesPacket* GetNextPesPackets(void);
+  void Seek(signed long long pcr);
+  DTCP_Descriptor DtcpInfo;
+ protected:
+  PesFile(BackgroundWorker openWorker);
+  void ReportProgress(signed int percent);
+  void GetInitialValues(void);
+  FileStream fs;
+  TsIo tsior;
+  TsFileType fileTpe;
+  signed long long startPcr;
+  signed long long endPcr;
+  StreamInfo sis[];
+  PcrChanged pcrDelegate;
+  PtsChanged ptsDelegate;
+  BackgroundWorker openWorker;
+  signed int lastPercent;
+ private:
+  void ParseElementaryStreams(void);
+  void ParseStream(StreamInfo si, char payload[]);
+  static PesFile OpenFile(std::string path, bool useAsync, BackgroundWorker openWorker);
+};
+
+class EvoPesFile {
+ public:
+  EvoPesFile(BackgroundWorker bw);
+  DTCP_Descriptor DtcpInfo;
+  PesPacket* GetNextPesPackets(void);
+  void Seek(signed long pcr);
+ protected:
+  void GetInitialValues(void);
+ private:
+  Dictionary<unsigned short, std::list<char> > soundFrames;
+  signed long long GetCurrentPcrFromFile(void);
+  void GetTimeStamps(void);
+  char GetVC1SubstreamId(char buff[], signed int offset);
+  signed long long lastPcr;
+};
+
+class SupPesFile {
+ public:
+  SupPesFile(BackgroundWorker bw);
+  DTCP_Descriptor DtcpInfo;
+  PesPacket* GetNextPesPackets(void);
+  void Seek(signed long pcr);
+ protected:
+  void GetInitialValues(void);
+ private:
+  signed long long GetCurrentPcrFromFile(void);
+  void GetTimeStamps(void);
+};
+
+class TsPesFile {
+ public:
+  TsPesFile(BackgroundWorker bw);
+  DTCP_Descriptor DtcpInfo;
+  PesPacket* GetNextPesPackets(void);
+  void Seek(signed long pcr);
+ protected:
+  void GetInitialValues(void);
+ private:
+  signed long long GetCurrentPcrFromFile(void);
+  void GetTimeStamps(void);
+  signed int stride;
+  char tsPack[];
+  Dictionary<unsigned short, PesPacket> PesPackets;
+  DTCP_Descriptor dt;
+  unsigned short pcrPID;
+};
 }
 #endif
 
index afff775..7946844 100644 (file)
 #ifndef TSREMUXCPP_UTILS_H_
 #define TSREMUXCPP_UTILS_H_
 
-namespace TsRemux
-{
-    enum TsFileType
-    {
-        UNKNOWN = 0,
-        TS,
-        M2TS,
-        EVOB,
-        ELEMENTARY,
-        PES_ELEMENTARY,
-        SUP_ELEMENTARY,
-        BLU_RAY,
-        MKV
-    };
-
-    enum DtcpCci
-    {
-        CopyFree = 0,
-        NoMoreCopies,
-        CopyOnce,
-        CopyNever
-    };
+namespace TsRemux {
+enum TsFileType {
+    UNKNOWN = 0,
+    TS,
+    M2TS,
+    EVOB,
+    ELEMENTARY,
+    PES_ELEMENTARY,
+    SUP_ELEMENTARY,
+    BLU_RAY,
+    MKV
+};
+
+enum DtcpCci {
+    CopyFree = 0,
+    NoMoreCopies,
+    CopyOnce,
+    CopyNever
+};
  
-    enum ElementaryStreamType
-    {
-        INVALID = 0,
-        VIDEO_STREAM_MPEG1 = 0x01,
-        VIDEO_STREAM_MPEG2 = 0x02,
-        AUDIO_STREAM_MPEG1 = 0x03, // all layers including mp3
-        AUDIO_STREAM_MPEG2 = 0x04,
-        VIDEO_STREAM_H264 = 0x1b,
-        AUDIO_STREAM_LPCM = 0x80,
-        AUDIO_STREAM_AC3 = 0x81,
-        AUDIO_STREAM_DTS = 0x82,
-        AUDIO_STREAM_AC3_TRUE_HD = 0x83,
-        AUDIO_STREAM_AC3_PLUS = 0x84,
-        AUDIO_STREAM_DTS_HD = 0x85,
-        AUDIO_STREAM_DTS_HD_MASTER_AUDIO = 0x86,
-        PRESENTATION_GRAPHICS_STREAM = 0x90,
-        INTERACTIVE_GRAPHICS_STREAM = 0x91,
-        SUBTITLE_STREAM = 0x92,
-        SECONDARY_AUDIO_AC3_PLUS = 0xa1,
-        SECONDARY_AUDIO_DTS_HD = 0xa2,
-        VIDEO_STREAM_VC1 = 0xea
-    };
-
-    enum VideoFormat
-    {
-        VF_Reserved = 0,
-        i480,
-        i576,
-        p480,
-        i1080,
-        p720,
-        p1080,
-        p576
-    };
-
-    enum FrameRate
-    {
-        FR_Reserved = 0,
-        f23_976,
-        f24,
-        f25,
-        f29_97,
-        f50 = 6,
-        f59_94
-    };
-
-    enum AspectRatio
-    {
-        AR_Reserved = 0,
-        a4_3 = 2,
-        a16_9
-    };
-
-    enum AudioPresentationType
-    {
-        AP_Reserved = 0,
-        mono,
-        stereo = 3,
-        multi = 6,
-        combo = 12
-    };
-
-    enum SamplingFrequency
-    {
-        SF_Reserved = 0,
-        kHz48,
-        kHz96 = 4,
-        kHz192,
-        kHz48_192 = 12,
-        kHz48_96 = 14
-    };
+enum ElementaryStreamTypes {
+    INVALID = 0,
+    VIDEO_STREAM_MPEG1 = 0x01,
+    VIDEO_STREAM_MPEG2 = 0x02,
+    AUDIO_STREAM_MPEG1 = 0x03, // all layers including mp3
+    AUDIO_STREAM_MPEG2 = 0x04,
+    VIDEO_STREAM_H264 = 0x1b,
+    AUDIO_STREAM_LPCM = 0x80,
+    AUDIO_STREAM_AC3 = 0x81,
+    AUDIO_STREAM_DTS = 0x82,
+    AUDIO_STREAM_AC3_TRUE_HD = 0x83,
+    AUDIO_STREAM_AC3_PLUS = 0x84,
+    AUDIO_STREAM_DTS_HD = 0x85,
+    AUDIO_STREAM_DTS_HD_MASTER_AUDIO = 0x86,
+    PRESENTATION_GRAPHICS_STREAM = 0x90,
+    INTERACTIVE_GRAPHICS_STREAM = 0x91,
+    SUBTITLE_STREAM = 0x92,
+    SECONDARY_AUDIO_AC3_PLUS = 0xa1,
+    SECONDARY_AUDIO_DTS_HD = 0xa2,
+    VIDEO_STREAM_VC1 = 0xea
+};
+
+enum VideoFormat {
+    VF_Reserved = 0,
+    i480,
+    i576,
+    p480,
+    i1080,
+    p720,
+    p1080,
+    p576
+};
+
+enum FrameRate {
+    FR_Reserved = 0,
+    f23_976,
+    f24,
+    f25,
+    f29_97,
+    f50 = 6,
+    f59_94
+};
+
+enum AspectRatio {
+    AR_Reserved = 0,
+    a4_3 = 2,
+    a16_9
+};
+
+enum AudioPresentationType {
+    AP_Reserved = 0,
+    mono,
+    stereo = 3,
+    multi = 6,
+    combo = 12
+};
+
+enum SamplingFrequency {
+    SF_Reserved = 0,
+    kHz48,
+    kHz96 = 4,
+    kHz192,
+    kHz48_192 = 12,
+    kHz48_96 = 14
+};
+
+class BluRayOutPut {
+};
+
+class Descriptor {
+};
+
+class DTCP_Descriptor : Descriptor {
+};
+
+class Constants {
+};
+
+class ProgramInfo {
+};
+
+class TsPacket {
+};
+
+class PcrPacket : TsPacket {
+};
+
+class TsTable : TsPacket {
+};
+
+class PatPacket : TsTable {
+};
+
+class SitPacket : TsTable {
+};
+
+class PmPachet : TsTable {
+};
+
+class PesPacket {
+};
+
+class PesHeader {
+};
+
+class StreamInfo {
+};
+
+class VC1SequenceInfo {
+};
+
+class H264Info {
+};
+
+enum Ac3SyntaxType {
+};
+
+class ElementaryParse {
+};
+
+class AC3Info {
+};
+
+class DtsInfo {
+};
+
+class MlpInfo {
+};
 
+class Mpeg2Info {
+};
 }
 #endif
 
diff --git a/src/main.o b/src/main.o
deleted file mode 100644 (file)
index b07e632..0000000
Binary files a/src/main.o and /dev/null differ