[matroska] r965 - trunk/DvdMenuXtractor
[email protected] Sun, 12 Dec 2004 16:04:46 +0300 (MSK)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2004-12-12 16:04:46 +0300 (Sun, 12 Dec 2004)
New Revision: 965
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
trunk/DvdMenuXtractor/VobParser.cpp
trunk/DvdMenuXtractor/VobParser.h
Log:
timecode file for video
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-12-12 11:10:46 UTC (rev 964)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-12-12 13:04:46 UTC (rev 965)
@@ -573,7 +573,7 @@
if (!demuxer.AddDemuxer(VIDEO_STREAM, _muxer))
delete _muxer;
- int _stream;
+ size_t _stream;
// decide which audio streams to process
if (_audioTracks.GetCount())
@@ -629,7 +629,7 @@
{
// get the possible IDs for this track for this Cell/PGC
IdArray _IDs = IfoFile->GetSubsId(_stream, title, language);
- for (int _IDidx=0; _IDidx < _IDs.GetCount(); _IDidx++)
+ for (size_t _IDidx=0; _IDidx < _IDs.GetCount(); _IDidx++)
{
wxString _langName;
Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp 2004-12-12 11:10:46 UTC (rev 964)
+++ trunk/DvdMenuXtractor/VobParser.cpp 2004-12-12 13:04:46 UTC (rev 965)
@@ -661,7 +661,7 @@
ParsePESHeaderData();
m_demuxer.ProcessStream(VIDEO_STREAM, &m_buff[m_index],
- length - 3 - pes_header_data_content.PES_header_data_len, (int32_t)pktinfo.pts/90, (int32_t)pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, (int32_t)pktinfo.dts/90, (int32_t)pktinfo.pts/90));
+ length - 3 - pes_header_data_content.PES_header_data_len, pktinfo.pts/90, pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, pktinfo.dts/90, pktinfo.pts/90));
}
void VobParser::ParseAudioPacket(uint8_t StreamID)
@@ -671,7 +671,7 @@
ParsePESHeaderData();
m_demuxer.ProcessStream(StreamID, &m_buff[m_index],
- length - 3 - pes_header_data_content.PES_header_data_len, (int32_t)pktinfo.pts/90, (int32_t)pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, (int32_t)pktinfo.dts/90, (int32_t)pktinfo.pts/90));
+ length - 3 - pes_header_data_content.PES_header_data_len, pktinfo.pts/90, pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, pktinfo.dts/90, pktinfo.pts/90));
}
// ----------------------------------------------------------------------------
@@ -690,7 +690,7 @@
DebugLog("Subtitles streamID = 0x%X\n", substreamID);
// .sub files the VobSub way (includes the whole packet)
- m_demuxer.ProcessStream(substreamID, m_buff, DVD_VIDEO_LB_LEN, (int32_t)pktinfo.pts/90, (int32_t)pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, (int32_t)pktinfo.dts/90, (int32_t)pktinfo.pts/90));
+ m_demuxer.ProcessStream(substreamID, m_buff, DVD_VIDEO_LB_LEN, pktinfo.pts/90, pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, pktinfo.dts/90, pktinfo.pts/90));
}
else if(substreamID >= SUBSTREAM_AC3_LOW && substreamID < SUBSTREAM_AC3_HIGH)
{
@@ -702,7 +702,7 @@
SkipNBytes(2);
uint16_t ac3DataLen = length - (m_index - dataStartIndex);
- m_demuxer.ProcessStream(substreamID, &m_buff[m_index], ac3DataLen, (int32_t)pktinfo.pts/90, (int32_t)pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, (int32_t)pktinfo.dts/90, (int32_t)pktinfo.pts/90));
+ m_demuxer.ProcessStream(substreamID, &m_buff[m_index], ac3DataLen, pktinfo.pts/90, pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, pktinfo.dts/90, pktinfo.pts/90));
}
else if(substreamID >= SUBSTREAM_DTS_LOW && substreamID < SUBSTREAM_DTS_HIGH)
{
@@ -713,7 +713,7 @@
SkipNBytes(2);
uint16_t ac3DataLen = length - (m_index - dataStartIndex);
- m_demuxer.ProcessStream(substreamID, &m_buff[m_index], ac3DataLen, (int32_t)pktinfo.pts/90, (int32_t)pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, (int32_t)pktinfo.dts/90, (int32_t)pktinfo.pts/90));
+ m_demuxer.ProcessStream(substreamID, &m_buff[m_index], ac3DataLen, pktinfo.pts/90, pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, pktinfo.dts/90, pktinfo.pts/90));
}
else if(substreamID >= SUBSTREAM_PCM_LOW && substreamID < SUBSTREAM_PCM_HIGH)
{
@@ -722,7 +722,7 @@
SkipNBytes(6);
uint16_t ac3DataLen = length - (m_index - dataStartIndex);
- m_demuxer.ProcessStream(substreamID, &m_buff[m_index], ac3DataLen, (int32_t)pktinfo.pts/90, (int32_t)pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, (int32_t)pktinfo.dts/90, (int32_t)pktinfo.pts/90));
+ m_demuxer.ProcessStream(substreamID, &m_buff[m_index], ac3DataLen, pktinfo.pts/90, pktinfo.dts/90, wxString::Format("DTS %d PTS %d - %d %d\n", (int32_t)m_startdts/90, (int32_t)m_startpts/90, pktinfo.dts/90, pktinfo.pts/90));
}
else
{
@@ -782,7 +782,7 @@
// ----------------------------------------------------------------------------
-void SubDemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void SubDemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
if (!m_TimecodeFile)
{
@@ -842,7 +842,7 @@
fprintf(m_TimecodeFile, "timestamp: %s%02d:%02d:%02d:%03d, filepos: %09x\n", sign?"-":"", delay,minute,second,millisecond,filepos);
}
-void BtnDemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void BtnDemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
m_TimecodeFile = GetTimecodeFile();
if (start_time > m_last_end_timecode)
@@ -854,7 +854,7 @@
m_last_end_timecode = end_time;
}
-void DTSDemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void DTSDemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
m_TimecodeFile = GetTimecodeFile();
int32_t delay = start_time - end_time;
@@ -869,7 +869,7 @@
fprintf(m_TimecodeFile, "timestamp: %s%02d:%02d:%02d:%03d, filepos: %09x\n", sign?"-":"", delay,minute,second,millisecond,filepos);
}
-void LPCMDemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void LPCMDemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
m_TimecodeFile = GetTimecodeFile();
int32_t delay = start_time - end_time;
@@ -884,7 +884,7 @@
fprintf(m_TimecodeFile, "timestamp: %s%02d:%02d:%02d:%03d, filepos: %09x\n", sign?"-":"", delay,minute,second,millisecond,filepos);
}
-void MPADemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void MPADemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
m_TimecodeFile = GetTimecodeFile();
int32_t delay = start_time - end_time;
@@ -899,7 +899,7 @@
fprintf(m_TimecodeFile, "timestamp: %s%02d:%02d:%02d:%03d, filepos: %09x\n", sign?"-":"", delay,minute,second,millisecond,filepos);
}
-void AC3DemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void AC3DemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
m_TimecodeFile = GetTimecodeFile();
int32_t delay = start_time - end_time;
@@ -914,25 +914,24 @@
fprintf(m_TimecodeFile, "timestamp: %s%02d:%02d:%02d:%03d, filepos: %09x\n", sign?"-":"", delay,minute,second,millisecond,filepos);
}
-void VideoDemuxWriter::WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug)
+void VideoDemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug)
{
- m_TimecodeFile = GetTimecodeFile();
- int32_t delay = start_time - end_time;
- bool sign = delay < 0;
- delay = sign?-delay:delay;
- int millisecond = delay % 1000;
- delay /= 1000;
- int second = delay % 60;
- delay /= 60;
- int minute = delay % 60;
- delay /= 60;
- fprintf(m_TimecodeFile, "timestamp: %s%02d:%02d:%02d:%03d, filepos: %09x\n", sign?"-":"", delay,minute,second,millisecond,filepos);
}
// ============================================================================
void VideoDemuxWriter::SetBoundary(uint32_t start_timecode, uint32_t duration, uint16_t vob_id, uint16_t cell_id)
{
+ m_TimecodeFile = GetTimecodeFile();
+
+ if (m_end_timecode != 0)
+ fprintf(m_TimecodeFile, "%lf\n", (m_end_timecode - m_start_timecode) / 1000.0);
+
+ m_start_timecode = start_timecode;
+ m_end_timecode = start_timecode + duration;
+ m_last_end_timecode = start_timecode;
+
+ fprintf(m_TimecodeFile, "\n# VOB %d Cell %d\n", vob_id, cell_id);
}
void AC3DemuxWriter::SetBoundary(uint32_t start_timecode, uint32_t duration, uint16_t vob_id, uint16_t cell_id)
@@ -975,13 +974,17 @@
m_end_timecode = start_timecode + duration;
m_last_end_timecode = start_timecode;
- if (start_timecode == 0) // new VOB
- {
- m_offset_timecode = m_start_timecode;
- }
fprintf(m_TimecodeFile, "\n# VOB %d Cell %d\n", vob_id, cell_id);
}
+VideoDemuxWriter::~VideoDemuxWriter()
+{
+ m_TimecodeFile = GetTimecodeFile();
+
+ if (m_end_timecode != 0)
+ fprintf(m_TimecodeFile, "%lf\n", (m_end_timecode - m_start_timecode) / 1000.0);
+}
+
BtnDemuxWriter::~BtnDemuxWriter()
{
m_TimecodeFile = GetTimecodeFile();
Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h 2004-12-12 11:10:46 UTC (rev 964)
+++ trunk/DvdMenuXtractor/VobParser.h 2004-12-12 13:04:46 UTC (rev 965)
@@ -176,7 +176,7 @@
{
public:
virtual ~Demuxer() {}
- virtual void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug) = 0;
+ virtual void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug) = 0;
virtual void SetBoundary(uint32_t start_timecode, uint32_t duration, uint16_t vob_id, uint16_t cell_id) = 0;
};
@@ -204,7 +204,7 @@
fclose(m_TimecodeFile);
}
- void Write(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void Write(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
if(!m_file)
{
@@ -239,7 +239,7 @@
FILE* m_TimecodeFile;
double m_fps;
- virtual void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug) = 0;
+ virtual void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug) = 0;
};
// ----------------------------------------------------------------------------
@@ -247,11 +247,21 @@
class VideoDemuxWriter : public Demuxer, public Writer
{
public:
- VideoDemuxWriter(const char* filenamePrefix, double fps) : Writer(filenamePrefix,"m2v", fps) {}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug) { Write(buff, size, start_time, end_time, debug); }
+ VideoDemuxWriter(const char* filenamePrefix, double fps)
+ :Writer(filenamePrefix,"m2v", fps)
+ ,m_end_timecode(0)
+ ,m_last_start_timecode(0)
+ ,m_last_end_timecode(0)
+ {}
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug) { Write(buff, size, start_time, end_time, debug); }
void SetBoundary(uint32_t start_timecode, uint32_t duration, uint16_t vob_id, uint16_t cell_id);
+ ~VideoDemuxWriter();
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
+ uint32_t m_start_timecode;
+ uint32_t m_end_timecode;
+ uint32_t m_last_start_timecode;
+ uint32_t m_last_end_timecode;
};
// ----------------------------------------------------------------------------
@@ -261,7 +271,7 @@
public:
AC3DemuxWriter(const char* filenamePrefix, const uint8_t streamID) :
Writer(filenamePrefix,"ac3", 0.0), m_streamID(streamID) {}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
Write(buff,size, start_time, end_time, debug);
}
@@ -269,7 +279,7 @@
private:
uint8_t m_streamID;
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
};
// ----------------------------------------------------------------------------
@@ -279,7 +289,7 @@
public:
DTSDemuxWriter(const char* filenamePrefix, const uint8_t streamID) :
Writer(filenamePrefix,"dts",0.0), m_streamID(streamID) {}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
Write(buff,size, start_time, end_time, debug);
}
@@ -287,7 +297,7 @@
private:
uint8_t m_streamID;
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
};
// ----------------------------------------------------------------------------
@@ -297,7 +307,7 @@
public:
LPCMDemuxWriter(const char* filenamePrefix, const uint8_t streamID) :
Writer(filenamePrefix,"pcm",0.0), m_streamID(streamID) {}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
Write(buff,size, start_time, end_time, debug);
}
@@ -305,7 +315,7 @@
private:
uint8_t m_streamID;
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
};
// ----------------------------------------------------------------------------
@@ -315,7 +325,7 @@
public:
MPADemuxWriter(const char* filenamePrefix, const uint8_t streamID) :
Writer(filenamePrefix,"mpa",0.0), m_streamID(streamID) {}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
Write(buff,size, start_time, end_time, debug);
}
@@ -323,7 +333,7 @@
private:
uint8_t m_streamID;
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
};
// ----------------------------------------------------------------------------
@@ -339,13 +349,13 @@
,m_palette(palette)
,m_language(language)
{}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
Write(buff,size, start_time, end_time, debug);
}
void SetBoundary(uint32_t start_timecode, uint32_t duration, uint16_t vob_id, uint16_t cell_id);
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
private:
uint16_t m_width;
uint16_t m_height;
@@ -361,22 +371,20 @@
public:
BtnDemuxWriter(const char* filenamePrefix)
:Writer(filenamePrefix, "btn",0.0)
- ,m_offset_timecode(0)
,m_end_timecode(0)
,m_last_start_timecode(0)
,m_last_end_timecode(0)
{}
- void ProcessStream(uint8_t* buff, uint32_t size, int32_t start_time, int32_t end_time, wxString & debug)
+ void ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, wxString & debug)
{
Write(buff,size, start_time, end_time, debug);
}
void SetBoundary(uint32_t start_timecode, uint32_t duration, uint16_t vob_id, uint16_t cell_id);
~BtnDemuxWriter();
protected:
- void WriteTimecodeInfo(int32_t start_time, int32_t end_time, uint64_t filepos, wxString & debug);
+ void WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, wxString & debug);
uint32_t m_start_timecode;
uint32_t m_end_timecode;
- uint32_t m_offset_timecode;
uint32_t m_last_start_timecode;
uint32_t m_last_end_timecode;
};