Compare commits

..

51 Commits

Author SHA1 Message Date
matthewjheaney
35ded77a23 libwebm: change version to 1.0.0.21
Change-Id: Ic8ef4e8f02a3dc5b07939f0b09903d31dc4a403f
2011-03-28 13:04:26 -04:00
matthewjheaney
1f33611caa libwebm: bad assert in Cluster::GetEntry
Change-Id: I5bcee1f496260416b438a1c2632dd24e8b26eee4
2011-03-22 14:18:14 -04:00
matthewjheaney
70f9644a8d libwebm: restored Cluster::GetLast
Change-Id: I73564fb508e23004392b5aaab1f1ad7cdedc8bb1
2011-03-19 10:34:12 -04:00
matthewjheaney
f2bd78ef6b libwebm: changed semantics of LoadCuePoint retval
Change-Id: Iabbc82b24bde27c06b44b9f9f45e64215b9164c5
2011-03-19 09:54:41 -04:00
matthewjheaney
2083c72300 libwebm: removed LoadBlockEntries
Change-Id: I1d65c07d91de568573f48e9fddf83b4c5672871d
2011-03-18 21:43:06 -04:00
matthewjheaney
f5ec272e54 libwebm: removed Cluster::Load (non-incremental)
Change-Id: I1f2ad153e0c643d04fa1fe1ec85410bbef1954ef
2011-03-18 11:18:46 -04:00
matthewjheaney
b324e52139 libwebm: handle truncated segment
Change-Id: Iddd15a207bce4a2c26f72e5e35f736c1b3f700d7
2011-03-16 15:08:06 -04:00
matthewjheaney
4137f9c999 libwebm: v1.0.0.20
Change-Id: I8a93517762c0edecd59a38e2f4fc99566c7b2de5
2011-03-15 14:27:53 -04:00
matthewjheaney
ba4096f120 libwebm: fixed bug in LoadBlockEntries
Change-Id: I4a0870030803bcbb5502800ae5627f716d417440
2011-03-10 15:12:16 -05:00
matthewjheaney
365a39b5ec libwebm: set version to v1.0.0.19
Change-Id: I5e88dce1c52bc18bdab2063111830b5fbd0faafe
2011-03-09 11:04:21 -05:00
matthewjheaney
601f7903a3 libwebm: block group must parse ref times too
Change-Id: Iadf7674dfaf311e04f2eea35fc396e2eaab18163
2011-03-08 21:51:13 -05:00
matthewjheaney
16b2cdaf57 libwebm: changed to version v1.0.0.18
Change-Id: I9f0f0c25fca48cfe18fd16c332bf21265bfef204
2011-03-08 13:13:07 -05:00
matthewjheaney
ca1e6b7323 libwebm: defend against truncated stream
Change-Id: I3fb983f9601ac133752fbbdb8bb8b179b18d14fb
2011-03-08 12:25:26 -05:00
matthewjheaney
c226b79e61 libwebm: safer way to handle truncated cluster
Change-Id: Ifa9df95fedee14846835c16942a80735e7f3c0ed
2011-03-07 23:44:47 -05:00
matthewjheaney
dc8bdb3389 libwebm: handle EOF in ParseNext
Change-Id: I1d93fca0c6ad259e76b79bdba8bb0debdd96bd94
2011-03-07 22:40:00 -05:00
matthewjheaney
31b2d8689c libwebm: parse unkown cluster size
Change-Id: I74f7f552185aafaa4466556644e95c3a25063a08
2011-03-07 21:11:57 -05:00
matthewjheaney
227d62aadf libwebm: changed type from size_t to long
Change-Id: I5a684628119877a2f89116b760a1c7e41716748d
2011-03-02 19:05:28 -05:00
matthewjheaney
85beb00fe3 libwebm: changed idx from size_t to long
Change-Id: I7ea9637ab3c55d7535fe9f2fe11fe88f4d47e474
2011-03-02 18:21:21 -05:00
matthewjheaney
eb4bd69098 libwebm: do not lazy-load cue points
Change-Id: I07646f1942d1f473f051ff8ab0aa07b2f4381d4c
2011-02-26 16:59:42 -05:00
matthewjheaney
cf36dc2848 libwebm: added Cues::GetCount
Change-Id: I5b2bca8fd7229318783d9b97c50a4e20ce2ba640
2011-02-26 11:50:23 -05:00
matthewjheaney
b0465e167e libwebm: audio track channel count defaults to 1
Change-Id: Id12bec611bd34f299235a278738f3b55cf5a36c5
2011-02-23 13:15:37 -05:00
matthewjheaney
a1aa16692a libwebm: added support for incremental cluster parsing
Change-Id: Idb1bd292a01b7c9971967760ad016691ac628c29
2011-02-22 11:51:23 -05:00
matthewjheaney
f971a94349 changed version to 1.0.0.17
Change-Id: I213e1279a25d8b7830e635434723b4770d31662c
2011-02-14 15:31:38 -05:00
matthewjheaney
5ac9764a95 libwebm: liberalized parsing of next cluster
Change-Id: I166ecfb5a76d475b77c3e418c4ae91195ff58d32
2011-02-13 19:00:31 -05:00
matthewjheaney
d82f86a40a libwebm: handle underflow from IMkvReader::Read
Change-Id: I8bb0ed53b7bfdde6c0ed24665591f95d7cf43083
2011-02-10 20:42:52 -05:00
matthewjheaney
a1736157be libwebm: handle unknown cluster size in Segment::Load too
Change-Id: I7ed5feb7fe29cd413c8de35274138605725c5b38
2011-02-10 14:41:54 -05:00
matthewjheaney
2c835bcc28 libwebm: handle (as error) cluster with unknown size
Change-Id: I8342d50d0482d77cb895ae659568016eb48ed2be
2011-02-10 13:32:40 -05:00
matthewjheaney
d931a6ecc6 libwebm: set version to 1.0.0.16
Change-Id: Id8f9d8a5d1aa50545c403eb9da04f62347b4604f
2011-02-01 18:49:47 -08:00
matthewjheaney
7a8b013f16 libwebm: handle unknown file length
Change-Id: I6ad22ce302e40a4ec882b4f9ac59d5ca7f6489d7
2011-02-01 16:29:02 -08:00
matthewjheaney
a977a2b536 libwebm: changed version to 1.0.0.15
Change-Id: I70c6b22d75defcb11fecbbcd8763659cca7f77e0
2011-01-28 16:56:27 -05:00
matthewjheaney
5e72a2dfc2 libwebm: changed signature of CuePoint::GetTime
Change-Id: Ia80da8af5607c7067e848bafd453842cfe8cfcca
2011-01-28 00:52:13 -05:00
matthewjheaney
056b0d96a8 libwebm: changed version to 1.0.0.14
Change-Id: Id8147672e7fb761b2a69ff0d1ec05705e34eefc1
2011-01-26 19:08:43 -05:00
matthewjheaney
dbc58d0510 libwebm: make unserialize operations endian-neutral
Change-Id: I0c754ea8192020886dac14e3a0bd6a74c3165a92
2011-01-26 18:50:07 -05:00
matthewjheaney
a131a01446 libwebm: incrementally load block entries
Change-Id: I566df5979e7638b6a5411a3338bbb0cf7d9ad111
2011-01-25 23:01:51 -05:00
Hwasoo Lee
b8cb358204 fixed build error in sample
Change-Id: Id6ac66f5e625952918857c3e13e655452c32abc8
2011-01-25 11:31:20 -05:00
matthewjheaney
5b06b22b31 libwebm: removed warning in x64 mode
Change-Id: I391ad625babdede58c8025b332ee2c949e930454
2011-01-24 22:45:10 -05:00
matthewjheaney
598de03ef3 libwebm: version 1.0.0.13
Change-Id: I6417dfd731604461939a780d0fb411b888ae1d32
2011-01-24 22:40:19 -05:00
matthewjheaney
94f2d589fc libwebm: tolerate errors in SeekHead element
Change-Id: I380f43dd495dc5107f5df37f9d05ff67da4f8424
2011-01-24 20:50:12 -05:00
matthewjheaney
786357a59d version 1.0.0.12
Supports incremental (partial) loading
Supports incremental parsing of Cues element

Change-Id: I38ef8dc56b970a7401aa4561197bf93e2df979da
2011-01-22 13:48:09 -05:00
matthewjheaney
6e723319e8 added support for incremental (partial) loading
Change-Id: Ic411e6214fdfc3e23a7e3f621f9fb8be0d650d50
2011-01-21 20:04:58 -05:00
matthewjheaney
9911f61616 incrementally parse cue points
Change-Id: I83699208eabb2433b25f634927b7c0be8623c3a2
2011-01-19 21:22:37 -05:00
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
matthewjheaney
6623441ee8 changed version to 1.0.0.10
Change-Id: Ib5acbe084dce95b1bb520731015ff345390acad8
2010-12-16 15:13:41 -05:00
matthewjheaney
3ba8df9a64 return invisible flag setting
Change-Id: I1953b0a590813302054245b8ceb5430aa1d9d09b
2010-12-14 15:05:35 -05:00
3 changed files with 3953 additions and 450 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();
};
@@ -80,6 +81,7 @@ public:
long long GetTime(const Cluster*) const; //absolute, and scaled (ns)
bool IsKey() const;
void SetKey(bool);
bool IsInvisible() const;
int GetFrameCount() const; //to index frames: [0, count)
@@ -91,26 +93,15 @@ public:
long Read(IMkvReader*, unsigned char*) const;
};
#if 0
long long GetOffset() const;
long GetSize() const;
long Read(IMkvReader*, unsigned char*) const;
#else
const Frame& GetFrame(int frame_index) const;
#endif
private:
long long m_track; //Track::Number()
short m_timecode; //relative to cluster
unsigned char m_flags;
#if 0
long long m_frameOff;
long m_frameSize;
#else
Frame* m_frames;
int m_frame_count;
#endif
};
@@ -205,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;
@@ -247,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
@@ -273,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;
@@ -295,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;
@@ -318,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;
@@ -329,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;
@@ -345,9 +362,18 @@ 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,
long long element_start,
long long element_size);
SegmentInfo(Segment*, long long start, long long size);
~SegmentInfo();
long long GetTimeCodeScale() const;
long long GetDuration() const; //scaled
const char* GetMuxingAppAsUTF8() const;
@@ -362,22 +388,68 @@ private:
char* m_pTitleAsUTF8;
};
class SeekHead
{
SeekHead(const SeekHead&);
SeekHead& operator=(const SeekHead&);
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;
SeekHead(
Segment*,
long long start,
long long size,
long long element_start,
long long element_size);
~SeekHead();
struct Entry
{
long long id;
long long pos;
};
int GetCount() const;
const Entry* GetEntry(int idx) const;
private:
Entry* m_entries;
int m_count;
static void ParseEntry(
IMkvReader*,
long long pos,
long long size,
Entry*&);
};
class Cues;
class CuePoint
{
friend class Cues;
CuePoint(size_t, long long);
CuePoint(long, long long);
~CuePoint();
CuePoint(const 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
long long GetTime(Segment*) const; //absolute and scaled (ns units)
long long GetTime(const Segment*) const; //absolute and scaled (ns units)
struct TrackPosition
{
@@ -394,7 +466,7 @@ public:
const TrackPosition* Find(const Track*) const;
private:
const size_t m_index;
const long m_index;
long long m_timecode;
TrackPosition* m_track_positions;
size_t m_track_positions_count;
@@ -406,7 +478,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&);
@@ -416,6 +493,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,
@@ -439,14 +518,18 @@ public:
const CuePoint*,
const CuePoint::TrackPosition*) const;
bool LoadCuePoint() const;
long GetCount() const; //loaded only
//long GetTotal() const; //loaded + preloaded
bool DoneParsing() const;
private:
void Init() const;
bool LoadCuePoint() const;
void PreloadCuePoint(size_t&, long long) const;
void PreloadCuePoint(long&, long long) const;
mutable CuePoint** m_cue_points;
mutable size_t m_count;
mutable size_t m_preload_count;
mutable long m_count;
mutable long m_preload_count;
mutable long long m_pos;
};
@@ -454,6 +537,8 @@ private:
class Cluster
{
friend class Segment;
Cluster(const Cluster&);
Cluster& operator=(const Cluster&);
@@ -461,7 +546,11 @@ public:
Segment* const m_pSegment;
public:
static Cluster* Parse(Segment*, long, long long off);
static Cluster* Create(
Segment*,
long index, //index in segment
long long off); //offset relative to segment
//long long element_size);
Cluster(); //EndOfStream
~Cluster();
@@ -480,28 +569,59 @@ public:
const BlockEntry* GetEntry(
const CuePoint&,
const CuePoint::TrackPosition&) const;
const BlockEntry* GetMaxKey(const VideoTrack*) const;
//const BlockEntry* GetMaxKey(const VideoTrack*) const;
static bool HasBlockEntries(const Segment*, long long);
// static bool HasBlockEntries(const Segment*, long long);
static long HasBlockEntries(
const Segment*,
long long idoff,
long long& pos,
long& size);
long GetEntryCount() const;
//void Load() const;
long Load(long long& pos, long& size) const;
//void LoadBlockEntries() const;
long Parse(long long& pos, long& size) const;
long GetEntry(long index, const mkvparser::BlockEntry*&) const;
protected:
Cluster(Segment*, long, long long off);
Cluster(
Segment*,
long index,
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;
long long GetPosition() const; //offset relative to segment
long GetIndex() const;
long long GetElementSize() const;
//long long GetPayloadSize() const;
//long long Unparsed() const;
private:
long m_index;
mutable long long m_pos;
//mutable long long m_size;
mutable long long m_element_size;
mutable long long m_timecode;
mutable BlockEntry** m_entries;
mutable long m_entries_size;
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;
long ParseSimpleBlock(long long, long long&, long&) const;
long ParseBlockGroup(long long, long long&, long&) const;
void CreateBlock(long long id, long long pos, long long size) const;
void CreateBlockGroup(long long, long long, BlockEntry**&) const;
void CreateSimpleBlock(long long, long long, BlockEntry**&) const;
};
@@ -530,18 +650,28 @@ public:
long Load(); //loads headers and all clusters
//for incremental loading
long long Unparsed() const;
//long long Unparsed() const;
bool DoneParsing() const;
long long ParseHeaders(); //stops when first cluster is found
//long FindNextCluster(long long& pos, long& size) const;
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);
#if 0
//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;
bool AddCluster(long long cluster_pos, long long new_pos);
#endif
Tracks* GetTracks() const;
const SeekHead* GetSeekHead() const;
const Tracks* GetTracks() const;
const SegmentInfo* GetInfo() const;
const Cues* GetCues() const;
@@ -555,9 +685,19 @@ public:
const Cluster* FindCluster(long long time_nanoseconds) const;
//const BlockEntry* Seek(long long time_nanoseconds, const Track*) const;
const Cluster* FindOrPreloadCluster(long long pos);
long ParseCues(
long long cues_off, //offset relative to start of segment
long long& parse_pos,
long& parse_len);
private:
long long m_pos; //absolute file posn; what has been consumed so far
Cluster* m_pUnknownSize;
SeekHead* m_pSeekHead;
SegmentInfo* m_pInfo;
Tracks* m_pTracks;
Cues* m_pCues;
@@ -566,12 +706,16 @@ private:
long m_clusterPreloadCount; //number of entries for which m_index < 0
long m_clusterSize; //array size
long DoLoadCluster(long long&, long&);
long DoLoadClusterUnknownSize(long long&, long&);
long DoParseNext(const Cluster*&, long long&, long&);
void AppendCluster(Cluster*);
void PreloadCluster(Cluster*, ptrdiff_t);
void ParseSeekHead(long long pos, long long size);
void ParseSeekEntry(long long pos, long long size);
void ParseCues(long long);
//void ParseSeekHead(long long pos, long long size);
//void ParseSeekEntry(long long pos, long long size);
//void ParseCues(long long);
const BlockEntry* GetBlock(
const CuePoint&,

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);
@@ -132,7 +142,7 @@ int main(int argc, char* argv[])
// size of segment payload
printf("\t\tSize(Segment)\t\t: %lld\n", pSegment->m_size);
mkvparser::Tracks* const pTracks = pSegment->GetTracks();
const mkvparser::Tracks* pTracks = pSegment->GetTracks();
unsigned long i = 0;
const unsigned long j = pTracks->GetTracksCount();
@@ -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);