Compare commits
1 Commits
sandbox/ma
...
libwebm-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
041a5c5811 |
@@ -13,8 +13,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_muxer", "sample_muxe
|
|||||||
{7B1F12CA-0724-430B-B61A-1D357C912CBA} = {7B1F12CA-0724-430B-B61A-1D357C912CBA}
|
{7B1F12CA-0724-430B-B61A-1D357C912CBA} = {7B1F12CA-0724-430B-B61A-1D357C912CBA}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libwebvtt", "libwebvtt.vcproj", "{9545310B-A6E6-4B42-BB00-655D66B6E3D5}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
@@ -33,10 +31,6 @@ Global
|
|||||||
{B407561F-1F5E-4798-B9C2-81AB09CFBC16}.Debug|Win32.Build.0 = Debug|Win32
|
{B407561F-1F5E-4798-B9C2-81AB09CFBC16}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{B407561F-1F5E-4798-B9C2-81AB09CFBC16}.Release|Win32.ActiveCfg = Release|Win32
|
{B407561F-1F5E-4798-B9C2-81AB09CFBC16}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{B407561F-1F5E-4798-B9C2-81AB09CFBC16}.Release|Win32.Build.0 = Release|Win32
|
{B407561F-1F5E-4798-B9C2-81AB09CFBC16}.Release|Win32.Build.0 = Release|Win32
|
||||||
{9545310B-A6E6-4B42-BB00-655D66B6E3D5}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{9545310B-A6E6-4B42-BB00-655D66B6E3D5}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{9545310B-A6E6-4B42-BB00-655D66B6E3D5}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{9545310B-A6E6-4B42-BB00-655D66B6E3D5}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="4"
|
WarningLevel="4"
|
||||||
DebugInformationFormat="1"
|
DebugInformationFormat="1"
|
||||||
|
DisableSpecificWarnings="4996"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
|||||||
157
libwebvtt.vcproj
157
libwebvtt.vcproj
@@ -1,157 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="libwebvtt_2008"
|
|
||||||
ProjectGUID="{9545310B-A6E6-4B42-BB00-655D66B6E3D5}"
|
|
||||||
RootNamespace="libwebvtt"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
TargetFrameworkVersion="196613"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)..\lib\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(SolutionDir)..\obj\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
|
||||||
MinimalRebuild="false"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="4"
|
|
||||||
DebugInformationFormat="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
CharacterSet="1"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
EnableIntrinsicFunctions="true"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\webvttparser.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\webvttparser.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
@@ -830,7 +830,7 @@ bool Tracks::AddTrack(Track* track, int32 number) {
|
|||||||
if (number < 0)
|
if (number < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int32 track_num = number;
|
uint32 track_num = number;
|
||||||
|
|
||||||
// Check to make sure a track does not already have |track_num|.
|
// Check to make sure a track does not already have |track_num|.
|
||||||
for (uint32 i = 0; i < track_entries_size_; ++i) {
|
for (uint32 i = 0; i < track_entries_size_; ++i) {
|
||||||
|
|||||||
2282
mkvparser.cpp
2282
mkvparser.cpp
File diff suppressed because it is too large
Load Diff
103
mkvparser.hpp
103
mkvparser.hpp
@@ -30,23 +30,26 @@ protected:
|
|||||||
|
|
||||||
long long GetUIntLength(IMkvReader*, long long, long&);
|
long long GetUIntLength(IMkvReader*, long long, long&);
|
||||||
long long ReadUInt(IMkvReader*, long long, long&);
|
long long ReadUInt(IMkvReader*, long long, long&);
|
||||||
long long SyncReadUInt(IMkvReader*, long long pos, long long stop, long&);
|
|
||||||
long long UnserializeUInt(IMkvReader*, long long pos, long long size);
|
long long UnserializeUInt(IMkvReader*, long long pos, long long size);
|
||||||
float Unserialize4Float(IMkvReader*, long long);
|
|
||||||
double Unserialize8Double(IMkvReader*, long long);
|
|
||||||
|
|
||||||
#if 0
|
long UnserializeFloat(IMkvReader*, long long pos, long long size, double&);
|
||||||
short Unserialize2SInt(IMkvReader*, long long);
|
|
||||||
signed char Unserialize1SInt(IMkvReader*, long long);
|
|
||||||
#else
|
|
||||||
long UnserializeInt(IMkvReader*, long long pos, long len, long long& result);
|
long UnserializeInt(IMkvReader*, long long pos, long len, long long& result);
|
||||||
#endif
|
|
||||||
|
long UnserializeString(
|
||||||
|
IMkvReader*,
|
||||||
|
long long pos,
|
||||||
|
long long size,
|
||||||
|
char*& str);
|
||||||
|
|
||||||
|
long ParseElementHeader(
|
||||||
|
IMkvReader* pReader,
|
||||||
|
long long& pos, //consume id and size fields
|
||||||
|
long long stop, //if you know size of element's parent
|
||||||
|
long long& id,
|
||||||
|
long long& size);
|
||||||
|
|
||||||
bool Match(IMkvReader*, long long&, unsigned long, long long&);
|
bool Match(IMkvReader*, long long&, unsigned long, long long&);
|
||||||
bool Match(IMkvReader*, long long&, unsigned long, char*&);
|
|
||||||
bool Match(IMkvReader*, long long&, unsigned long, unsigned char*&, size_t&);
|
bool Match(IMkvReader*, long long&, unsigned long, unsigned char*&, size_t&);
|
||||||
bool Match(IMkvReader*, long long&, unsigned long, double&);
|
|
||||||
bool Match(IMkvReader*, long long&, unsigned long, short&);
|
|
||||||
|
|
||||||
void GetVersion(int& major, int& minor, int& build, int& revision);
|
void GetVersion(int& major, int& minor, int& build, int& revision);
|
||||||
|
|
||||||
@@ -289,13 +292,15 @@ class Track
|
|||||||
Track& operator=(const Track&);
|
Track& operator=(const Track&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum Type { kVideo = 1, kAudio = 2 };
|
||||||
|
|
||||||
Segment* const m_pSegment;
|
Segment* const m_pSegment;
|
||||||
const long long m_element_start;
|
const long long m_element_start;
|
||||||
const long long m_element_size;
|
const long long m_element_size;
|
||||||
virtual ~Track();
|
virtual ~Track();
|
||||||
|
|
||||||
long long GetType() const;
|
long GetType() const;
|
||||||
long long GetNumber() const;
|
long GetNumber() const;
|
||||||
unsigned long long GetUid() const;
|
unsigned long long GetUid() const;
|
||||||
const char* GetNameAsUTF8() const;
|
const char* GetNameAsUTF8() const;
|
||||||
const char* GetCodecNameAsUTF8() const;
|
const char* GetCodecNameAsUTF8() const;
|
||||||
@@ -311,21 +316,29 @@ public:
|
|||||||
long long size;
|
long long size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Info
|
class Info
|
||||||
{
|
{
|
||||||
long long type;
|
public:
|
||||||
long long number;
|
Info();
|
||||||
|
~Info();
|
||||||
|
int Copy(Info&) const;
|
||||||
|
void Clear();
|
||||||
|
private:
|
||||||
|
Info(const Info&);
|
||||||
|
Info& operator=(const Info&);
|
||||||
|
public:
|
||||||
|
long type;
|
||||||
|
long number;
|
||||||
unsigned long long uid;
|
unsigned long long uid;
|
||||||
char* nameAsUTF8;
|
char* nameAsUTF8;
|
||||||
char* codecId;
|
char* codecId;
|
||||||
|
char* codecNameAsUTF8;
|
||||||
unsigned char* codecPrivate;
|
unsigned char* codecPrivate;
|
||||||
size_t codecPrivateSize;
|
size_t codecPrivateSize;
|
||||||
char* codecNameAsUTF8;
|
|
||||||
bool lacing;
|
bool lacing;
|
||||||
Settings settings;
|
Settings settings;
|
||||||
|
private:
|
||||||
Info();
|
int CopyStr(char* Info::*str, Info&) const;
|
||||||
void Clear();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
long GetFirst(const BlockEntry*&) const;
|
long GetFirst(const BlockEntry*&) const;
|
||||||
@@ -341,10 +354,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
Track(
|
Track(
|
||||||
Segment*,
|
Segment*,
|
||||||
const Info&,
|
|
||||||
long long element_start,
|
long long element_start,
|
||||||
long long element_size);
|
long long element_size);
|
||||||
const Info m_info;
|
|
||||||
|
Info m_info;
|
||||||
|
|
||||||
class EOSBlock : public BlockEntry
|
class EOSBlock : public BlockEntry
|
||||||
{
|
{
|
||||||
@@ -368,12 +381,19 @@ class VideoTrack : public Track
|
|||||||
VideoTrack(const VideoTrack&);
|
VideoTrack(const VideoTrack&);
|
||||||
VideoTrack& operator=(const VideoTrack&);
|
VideoTrack& operator=(const VideoTrack&);
|
||||||
|
|
||||||
public:
|
|
||||||
VideoTrack(
|
VideoTrack(
|
||||||
|
Segment*,
|
||||||
|
long long element_start,
|
||||||
|
long long element_size);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static long Parse(
|
||||||
Segment*,
|
Segment*,
|
||||||
const Info&,
|
const Info&,
|
||||||
long long element_start,
|
long long element_start,
|
||||||
long long element_size);
|
long long element_size,
|
||||||
|
VideoTrack*&);
|
||||||
|
|
||||||
long long GetWidth() const;
|
long long GetWidth() const;
|
||||||
long long GetHeight() const;
|
long long GetHeight() const;
|
||||||
double GetFrameRate() const;
|
double GetFrameRate() const;
|
||||||
@@ -394,12 +414,18 @@ class AudioTrack : public Track
|
|||||||
AudioTrack(const AudioTrack&);
|
AudioTrack(const AudioTrack&);
|
||||||
AudioTrack& operator=(const AudioTrack&);
|
AudioTrack& operator=(const AudioTrack&);
|
||||||
|
|
||||||
public:
|
|
||||||
AudioTrack(
|
AudioTrack(
|
||||||
|
Segment*,
|
||||||
|
long long element_start,
|
||||||
|
long long element_size);
|
||||||
|
public:
|
||||||
|
static long Parse(
|
||||||
Segment*,
|
Segment*,
|
||||||
const Info&,
|
const Info&,
|
||||||
long long element_start,
|
long long element_start,
|
||||||
long long element_size);
|
long long element_size,
|
||||||
|
AudioTrack*&);
|
||||||
|
|
||||||
double GetSamplingRate() const;
|
double GetSamplingRate() const;
|
||||||
long long GetChannels() const;
|
long long GetChannels() const;
|
||||||
long long GetBitDepth() const;
|
long long GetBitDepth() const;
|
||||||
@@ -431,24 +457,27 @@ public:
|
|||||||
long long size,
|
long long size,
|
||||||
long long element_start,
|
long long element_start,
|
||||||
long long element_size);
|
long long element_size);
|
||||||
virtual ~Tracks();
|
|
||||||
|
|
||||||
const Track* GetTrackByNumber(unsigned long tn) const;
|
~Tracks();
|
||||||
|
|
||||||
|
long Parse();
|
||||||
|
|
||||||
|
unsigned long GetTracksCount() const;
|
||||||
|
|
||||||
|
const Track* GetTrackByNumber(long tn) const;
|
||||||
const Track* GetTrackByIndex(unsigned long idx) const;
|
const Track* GetTrackByIndex(unsigned long idx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Track** m_trackEntries;
|
Track** m_trackEntries;
|
||||||
Track** m_trackEntriesEnd;
|
Track** m_trackEntriesEnd;
|
||||||
|
|
||||||
void ParseTrackEntry(
|
long ParseTrackEntry(
|
||||||
long long,
|
long long payload_start,
|
||||||
long long,
|
long long payload_size,
|
||||||
Track*&,
|
|
||||||
long long element_start,
|
long long element_start,
|
||||||
long long element_size);
|
long long element_size,
|
||||||
|
Track*&) const;
|
||||||
|
|
||||||
public:
|
|
||||||
unsigned long GetTracksCount() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -473,6 +502,8 @@ public:
|
|||||||
|
|
||||||
~SegmentInfo();
|
~SegmentInfo();
|
||||||
|
|
||||||
|
long Parse();
|
||||||
|
|
||||||
long long GetTimeCodeScale() const;
|
long long GetTimeCodeScale() const;
|
||||||
long long GetDuration() const; //scaled
|
long long GetDuration() const; //scaled
|
||||||
const char* GetMuxingAppAsUTF8() const;
|
const char* GetMuxingAppAsUTF8() const;
|
||||||
@@ -509,6 +540,8 @@ public:
|
|||||||
|
|
||||||
~SeekHead();
|
~SeekHead();
|
||||||
|
|
||||||
|
long Parse();
|
||||||
|
|
||||||
struct Entry
|
struct Entry
|
||||||
{
|
{
|
||||||
//the SeekHead entry payload
|
//the SeekHead entry payload
|
||||||
|
|||||||
63
sample.cpp
63
sample.cpp
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "mkvreader.hpp"
|
#include "mkvreader.hpp"
|
||||||
#include "mkvparser.hpp"
|
#include "mkvparser.hpp"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// Silences these warnings:
|
// Silences these warnings:
|
||||||
@@ -83,15 +84,18 @@ int main(int argc, char* argv[])
|
|||||||
printf("\t\tDoc Type\t\t: %s\n", ebmlHeader.m_docType);
|
printf("\t\tDoc Type\t\t: %s\n", ebmlHeader.m_docType);
|
||||||
printf("\t\tPos\t\t\t: %lld\n", pos);
|
printf("\t\tPos\t\t\t: %lld\n", pos);
|
||||||
|
|
||||||
mkvparser::Segment* pSegment;
|
typedef mkvparser::Segment seg_t;
|
||||||
|
seg_t* pSegment_;
|
||||||
|
|
||||||
long long ret = mkvparser::Segment::CreateInstance(&reader, pos, pSegment);
|
long long ret = seg_t::CreateInstance(&reader, pos, pSegment_);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
printf("\n Segment::CreateInstance() failed.");
|
printf("\n Segment::CreateInstance() failed.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::auto_ptr<seg_t> pSegment(pSegment_);
|
||||||
|
|
||||||
ret = pSegment->Load();
|
ret = pSegment->Load();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@@ -157,8 +161,6 @@ int main(int argc, char* argv[])
|
|||||||
unsigned long i = 0;
|
unsigned long i = 0;
|
||||||
const unsigned long j = pTracks->GetTracksCount();
|
const unsigned long j = pTracks->GetTracksCount();
|
||||||
|
|
||||||
enum { VIDEO_TRACK = 1, AUDIO_TRACK = 2 };
|
|
||||||
|
|
||||||
printf("\n\t\t\t Track Info\n");
|
printf("\n\t\t\t Track Info\n");
|
||||||
|
|
||||||
while (i != j)
|
while (i != j)
|
||||||
@@ -168,13 +170,13 @@ int main(int argc, char* argv[])
|
|||||||
if (pTrack == NULL)
|
if (pTrack == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const long long trackType = pTrack->GetType();
|
const long trackType = pTrack->GetType();
|
||||||
const long long trackNumber = pTrack->GetNumber();
|
const long trackNumber = pTrack->GetNumber();
|
||||||
const unsigned long long trackUid = pTrack->GetUid();
|
const unsigned long long trackUid = pTrack->GetUid();
|
||||||
const wchar_t* const pTrackName = utf8towcs(pTrack->GetNameAsUTF8());
|
const wchar_t* const pTrackName = utf8towcs(pTrack->GetNameAsUTF8());
|
||||||
|
|
||||||
printf("\t\tTrack Type\t\t: %lld\n", trackType);
|
printf("\t\tTrack Type\t\t: %ld\n", trackType);
|
||||||
printf("\t\tTrack Number\t\t: %lld\n", trackNumber);
|
printf("\t\tTrack Number\t\t: %ld\n", trackNumber);
|
||||||
printf("\t\tTrack Uid\t\t: %lld\n", trackUid);
|
printf("\t\tTrack Uid\t\t: %lld\n", trackUid);
|
||||||
|
|
||||||
if (pTrackName == NULL)
|
if (pTrackName == NULL)
|
||||||
@@ -203,7 +205,7 @@ int main(int argc, char* argv[])
|
|||||||
delete [] pCodecName;
|
delete [] pCodecName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackType == VIDEO_TRACK)
|
if (trackType == mkvparser::Track::kVideo)
|
||||||
{
|
{
|
||||||
const VideoTrack* const pVideoTrack =
|
const VideoTrack* const pVideoTrack =
|
||||||
static_cast<const VideoTrack*>(pTrack);
|
static_cast<const VideoTrack*>(pTrack);
|
||||||
@@ -218,7 +220,7 @@ int main(int argc, char* argv[])
|
|||||||
printf("\t\tVideo Rate\t\t: %f\n",rate);
|
printf("\t\tVideo Rate\t\t: %f\n",rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackType == AUDIO_TRACK)
|
if (trackType == mkvparser::Track::kAudio)
|
||||||
{
|
{
|
||||||
const AudioTrack* const pAudioTrack =
|
const AudioTrack* const pAudioTrack =
|
||||||
static_cast<const AudioTrack*>(pTrack);
|
static_cast<const AudioTrack*>(pTrack);
|
||||||
@@ -242,7 +244,6 @@ int main(int argc, char* argv[])
|
|||||||
if (clusterCount == 0)
|
if (clusterCount == 0)
|
||||||
{
|
{
|
||||||
printf("\t\tSegment has no clusters.\n");
|
printf("\t\tSegment has no clusters.\n");
|
||||||
delete pSegment;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,7 +265,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
printf("\t\tError parsing first block of cluster\n");
|
printf("\t\tError parsing first block of cluster\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
goto done;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((pBlockEntry != NULL) && !pBlockEntry->EOS())
|
while ((pBlockEntry != NULL) && !pBlockEntry->EOS())
|
||||||
@@ -273,21 +274,27 @@ int main(int argc, char* argv[])
|
|||||||
const long long trackNum = pBlock->GetTrackNumber();
|
const long long trackNum = pBlock->GetTrackNumber();
|
||||||
const unsigned long tn = static_cast<unsigned long>(trackNum);
|
const unsigned long tn = static_cast<unsigned long>(trackNum);
|
||||||
const Track* const pTrack = pTracks->GetTrackByNumber(tn);
|
const Track* const pTrack = pTracks->GetTrackByNumber(tn);
|
||||||
const long long trackType = pTrack->GetType();
|
|
||||||
const int frameCount = pBlock->GetFrameCount();
|
|
||||||
const long long time_ns = pBlock->GetTime(pCluster);
|
|
||||||
|
|
||||||
printf("\t\t\tBlock\t\t:%s,%s,%15lld\n",
|
if (pTrack == NULL)
|
||||||
(trackType == VIDEO_TRACK) ? "V" : "A",
|
printf("\t\t\tBlock\t\t:UNKNOWN TRACK TYPE\n");
|
||||||
pBlock->IsKey() ? "I" : "P",
|
else
|
||||||
time_ns);
|
|
||||||
|
|
||||||
for (int i = 0; i < frameCount; ++i)
|
|
||||||
{
|
{
|
||||||
const Block::Frame& theFrame = pBlock->GetFrame(i);
|
const long long trackType = pTrack->GetType();
|
||||||
const long size = theFrame.len;
|
const int frameCount = pBlock->GetFrameCount();
|
||||||
const long long offset = theFrame.pos;
|
const long long time_ns = pBlock->GetTime(pCluster);
|
||||||
printf("\t\t\t %15ld,%15llx\n", size, offset);
|
|
||||||
|
printf("\t\t\tBlock\t\t:%s,%s,%15lld\n",
|
||||||
|
(trackType == mkvparser::Track::kVideo) ? "V" : "A",
|
||||||
|
pBlock->IsKey() ? "I" : "P",
|
||||||
|
time_ns);
|
||||||
|
|
||||||
|
for (int i = 0; i < frameCount; ++i)
|
||||||
|
{
|
||||||
|
const Block::Frame& theFrame = pBlock->GetFrame(i);
|
||||||
|
const long size = theFrame.len;
|
||||||
|
const long long offset = theFrame.pos;
|
||||||
|
printf("\t\t\t %15ld,%15llx\n", size, offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = pCluster->GetNext(pBlockEntry, pBlockEntry);
|
status = pCluster->GetNext(pBlockEntry, pBlockEntry);
|
||||||
@@ -296,15 +303,13 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
printf("\t\t\tError parsing next block of cluster\n");
|
printf("\t\t\tError parsing next block of cluster\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
goto done;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pCluster = pSegment->GetNext(pCluster);
|
pCluster = pSegment->GetNext(pCluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
fflush(stdout);
|
||||||
delete pSegment;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#include "webvttparser.hpp"
|
|
||||||
|
|
||||||
namespace WebvttParser
|
|
||||||
{
|
|
||||||
|
|
||||||
IReader::IReader()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IReader::~IReader()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Parser::Parser(IReader* p) :
|
|
||||||
m_pReader(p)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Parser::~Parser()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
} //end namespace WebvttParser
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
#ifndef WEBVTTPARSER_HPP
|
|
||||||
#define WEBVTTPARSER_HPP
|
|
||||||
|
|
||||||
namespace WebvttParser
|
|
||||||
{
|
|
||||||
|
|
||||||
class IReader
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
IReader();
|
|
||||||
virtual ~IReader();
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual int Read(char& c) = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class Parser
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Parser(const Parser&);
|
|
||||||
Parser& operator=(const Parser&);
|
|
||||||
|
|
||||||
public:
|
|
||||||
Parser(IReader*);
|
|
||||||
~Parser();
|
|
||||||
|
|
||||||
int Parse();
|
|
||||||
|
|
||||||
//need to know kind:
|
|
||||||
// caption, description, metadata, etc
|
|
||||||
// is this a webvtt stream?
|
|
||||||
//
|
|
||||||
//cue identifier
|
|
||||||
//timestamp (or defaults?) + cue settings
|
|
||||||
//payload
|
|
||||||
// preserve each line
|
|
||||||
|
|
||||||
//machine states:
|
|
||||||
// parsing stream id ("webvtt")
|
|
||||||
// parsing file-wide metadata
|
|
||||||
// parsing cue
|
|
||||||
//
|
|
||||||
//within cue:
|
|
||||||
// parsing line
|
|
||||||
// is this a cue identifier or timestamp line?
|
|
||||||
//
|
|
||||||
// parsing cue id
|
|
||||||
// parsing timestamp
|
|
||||||
// parsing lines, looking for end-of-cue
|
|
||||||
|
|
||||||
private:
|
|
||||||
IReader* const m_pReader;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} //end namespace WebvttParser
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user