Compare commits

..

8 Commits

Author SHA1 Message Date
matthewjheaney
b0f96983d2 changed version to 1.0.0.11
Change-Id: I22e85c56a3be07dba0959520a40b341b807f377c
2011-01-14 18:21:35 -05:00
matthewjheaney
6d7732575a added comment to fix VideoTrack::Seek
Change-Id: I2a8b3e4ca92bdfd2d77c84ab970379d22a06e451
2011-01-14 18:17:16 -05:00
matthewjheaney
8081c58b9b LoadCluster: ensure avail before geting uint len
Change-Id: I421501fcd9fdc017eee5307834911fbd18b510b0
2011-01-13 23:30:47 -05:00
matthewjheaney
00aa1804e9 Segment::ParseHeaders return wrong result when underflow
Change-Id: Iabdec9c2f062ec2fc6c9edeec208c4efc07c8307
2011-01-13 22:53:54 -05:00
matthewjheaney
bb8dfbe026 Segment::ParseNext is implemented
Change-Id: I31100afd4c16c48b366b7a29bec597909f9e2bbc
2011-01-13 15:11:33 -05:00
Hwasoo Lee
b81751642e initialized members using initialize list of EBMLHeader
Change-Id: I5bb46132141d7381dd23e0a3b87a3b6c0e8b7f4b
2011-01-13 15:00:16 -05:00
Hwasoo Lee
3b0f1b6d2b fixed memory leaks from utf8towcs()
Change-Id: I4d35b67da464c073d86f465801f64b15e69a8de2
2011-01-06 15:23:28 -05:00
Frank Galligan
d1aff34626 Added EBML element start and size to Segment Info, Tracks, Track,
Cluster, Cues, and CuePoint. The information was needed for some
tools bieng worked on. Element start is byte offset of the EMBL ID's
first byte.

Change-Id: I64e0a48932630e0a5269418f4979487d6d7bce60
2011-01-05 13:57:29 -05:00
3 changed files with 669 additions and 74 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -56,6 +56,7 @@ struct EBMLHeader
long long m_docTypeReadVersion;
long long Parse(IMkvReader*, long long&);
void Init();
};
@@ -195,6 +196,8 @@ class Track
public:
Segment* const m_pSegment;
const long long m_element_start;
const long long m_element_size;
virtual ~Track();
long long GetType() const;
@@ -237,7 +240,11 @@ public:
virtual long Seek(long long time_ns, const BlockEntry*&) const = 0;
protected:
Track(Segment*, const Info&);
Track(
Segment*,
const Info&,
long long element_start,
long long element_size);
const Info m_info;
class EOSBlock : public BlockEntry
@@ -263,7 +270,11 @@ class VideoTrack : public Track
VideoTrack& operator=(const VideoTrack&);
public:
VideoTrack(Segment*, const Info&);
VideoTrack(
Segment*,
const Info&,
long long element_start,
long long element_size);
long long GetWidth() const;
long long GetHeight() const;
double GetFrameRate() const;
@@ -285,7 +296,11 @@ class AudioTrack : public Track
AudioTrack& operator=(const AudioTrack&);
public:
AudioTrack(Segment*, const Info&);
AudioTrack(
Segment*,
const Info&,
long long element_start,
long long element_size);
double GetSamplingRate() const;
long long GetChannels() const;
long long GetBitDepth() const;
@@ -308,8 +323,15 @@ public:
Segment* const m_pSegment;
const long long m_start;
const long long m_size;
const long long m_element_start;
const long long m_element_size;
Tracks(Segment*, long long start, long long size);
Tracks(
Segment*,
long long start,
long long size,
long long element_start,
long long element_size);
virtual ~Tracks();
const Track* GetTrackByNumber(unsigned long tn) const;
@@ -319,7 +341,12 @@ private:
Track** m_trackEntries;
Track** m_trackEntriesEnd;
void ParseTrackEntry(long long, long long, Track*&);
void ParseTrackEntry(
long long,
long long,
Track*&,
long long element_start,
long long element_size);
public:
unsigned long GetTracksCount() const;
@@ -335,8 +362,15 @@ public:
Segment* const m_pSegment;
const long long m_start;
const long long m_size;
const long long m_element_start;
const long long m_element_size;
SegmentInfo(Segment*, long long start, long long size);
SegmentInfo(
Segment*,
long long start,
long long size,
long long element_start,
long long element_size);
~SegmentInfo();
long long GetTimeCodeScale() const;
long long GetDuration() const; //scaled
@@ -364,6 +398,9 @@ class CuePoint
CuePoint& operator=(const CuePoint&);
public:
long long m_element_start;
long long m_element_size;
void Load(IMkvReader*);
long long GetTimeCode() const; //absolute but unscaled
@@ -396,7 +433,12 @@ class Cues
{
friend class Segment;
Cues(Segment*, long long start, long long size);
Cues(
Segment*,
long long start,
long long size,
long long element_start,
long long element_size);
~Cues();
Cues(const Cues&);
@@ -406,6 +448,8 @@ public:
Segment* const m_pSegment;
const long long m_start;
const long long m_size;
const long long m_element_start;
const long long m_element_size;
bool Find( //lower bound of time_ns
long long time_ns,
@@ -451,7 +495,12 @@ public:
Segment* const m_pSegment;
public:
static Cluster* Parse(Segment*, long, long long off);
static Cluster* Parse(
Segment*,
long,
long long off,
long long element_start,
long long element_size);
Cluster(); //EndOfStream
~Cluster();
@@ -473,22 +522,29 @@ public:
const BlockEntry* GetMaxKey(const VideoTrack*) const;
static bool HasBlockEntries(const Segment*, long long);
void Load() const;
protected:
Cluster(Segment*, long, long long off);
Cluster(
Segment*,
long,
long long off,
long long element_start,
long long element_size);
public:
//TODO: these should all be private, with public selector functions
long m_index;
mutable long long m_pos;
mutable long long m_size;
const long long m_element_start;
const long long m_element_size;
private:
mutable long long m_timecode;
mutable BlockEntry** m_entries;
mutable long m_entries_count;
void Load() const;
void LoadBlockEntries() const;
void ParseBlockGroup(long long, long long, size_t) const;
void ParseSimpleBlock(long long, long long, size_t) const;
@@ -526,6 +582,12 @@ public:
long LoadCluster(long long& pos, long& size); //load one cluster
long LoadCluster();
long ParseNext(
const Cluster* pCurr,
const Cluster*& pNext,
long long& pos,
long& size);
//This pair parses one cluster, but only changes the state of the
//segment object when the cluster is actually added to the index.
long ParseCluster(long long& cluster_pos, long long& new_pos) const;

View File

@@ -109,22 +109,32 @@ int main(int argc, char* argv[])
printf("\t\tDuration\t\t: %lld\n", duration_ns);
const double duration_sec = double(duration_ns) / 1000000000;
printf("\t\tDuration(secs)\t\t: %7.3f\n", duration_sec);
printf("\t\tDuration(secs)\t\t: %7.3lf\n", duration_sec);
if (pTitle == NULL)
printf("\t\tTrack Name\t\t: NULL\n");
else
{
printf("\t\tTrack Name\t\t: %ls\n", pTitle);
delete [] pTitle;
}
if (pMuxingApp == NULL)
printf("\t\tMuxing App\t\t: NULL\n");
else
{
printf("\t\tMuxing App\t\t: %ls\n", pMuxingApp);
delete [] pMuxingApp;
}
if (pWritingApp == NULL)
printf("\t\tWriting App\t\t: NULL\n");
else
{
printf("\t\tWriting App\t\t: %ls\n", pWritingApp);
delete [] pWritingApp;
}
// pos of segment payload
printf("\t\tPosition(Segment)\t: %lld\n", pSegment->m_start);
@@ -153,14 +163,17 @@ int main(int argc, char* argv[])
const unsigned long long trackUid = pTrack->GetUid();
const wchar_t* const pTrackName = utf8towcs(pTrack->GetNameAsUTF8());
printf("\t\tTrack Type\t\t: %ld\n", trackType);
printf("\t\tTrack Number\t\t: %ld\n", trackNumber);
printf("\t\tTrack Type\t\t: %lld\n", trackType);
printf("\t\tTrack Number\t\t: %lld\n", trackNumber);
printf("\t\tTrack Uid\t\t: %lld\n", trackUid);
if (pTrackName == NULL)
printf("\t\tTrack Name\t\t: NULL\n");
else
{
printf("\t\tTrack Name\t\t: %ls \n", pTrackName);
delete [] pTrackName;
}
const char* const pCodecId = pTrack->GetCodecId();
@@ -175,7 +188,10 @@ int main(int argc, char* argv[])
if (pCodecName == NULL)
printf("\t\tCodec Name\t\t: NULL\n");
else
{
printf("\t\tCodec Name\t\t: %ls\n", pCodecName);
delete [] pCodecName;
}
if (trackType == VIDEO_TRACK)
{
@@ -252,7 +268,7 @@ int main(int argc, char* argv[])
const Block::Frame& theFrame = pBlock->GetFrame(i);
const long size = theFrame.len;
const long long offset = theFrame.pos;
printf("\t\t\t %15ld,%15lx\n", size, offset);
printf("\t\t\t %15ld,%15llx\n", size, offset);
}
pBlockEntry = pCluster->GetNext(pBlockEntry);