initialized AudioTrack and fixed indentation in Linux

Change-Id: I7ca148256f695b053318e962b06e34034b6c7cd4
This commit is contained in:
Hwasoo Lee
2010-06-11 16:30:13 -04:00
parent 6198e1ddfb
commit 8ccdd10ad8

View File

@@ -799,7 +799,6 @@ Segment::Segment(
m_pInfo(NULL), m_pInfo(NULL),
m_pTracks(NULL), m_pTracks(NULL),
m_clusterCount(0) m_clusterCount(0)
//m_clusterNumber(0)
{ {
} }
@@ -1160,8 +1159,8 @@ long Segment::Load()
m_clusterCount = 0; m_clusterCount = 0;
long long* fileposition_of_clusters = NULL; long long* fileposition_of_clusters = NULL;
long long size_of_cluster_pos = 0; long long size_of_cluster_pos = 0;
while (index < stop) while (index < stop)
{ {
@@ -1200,31 +1199,31 @@ long Segment::Load()
index += len; //consume length of size of element index += len; //consume length of size of element
if (id == 0x0F43B675) // Cluster ID if (id == 0x0F43B675) // Cluster ID
{ {
assert(fileposition_of_clusters); assert(fileposition_of_clusters);
if (m_clusterCount > size_of_cluster_pos) if (m_clusterCount > size_of_cluster_pos)
{ {
size_of_cluster_pos *= 2; size_of_cluster_pos *= 2;
long long* const temp = new long long[size_of_cluster_pos]; long long* const temp = new long long[size_of_cluster_pos];
memset(temp, 0, size_of_cluster_pos); memset(temp, 0, size_of_cluster_pos);
memcpy(temp, fileposition_of_clusters, size_of_cluster_pos); memcpy(temp, fileposition_of_clusters, size_of_cluster_pos);
delete [] fileposition_of_clusters; delete [] fileposition_of_clusters;
fileposition_of_clusters = temp; fileposition_of_clusters = temp;
} }
fileposition_of_clusters[m_clusterCount] = idpos; fileposition_of_clusters[m_clusterCount] = idpos;
++m_clusterCount; ++m_clusterCount;
} }
else if (id == 0x0549A966) //Segment Info ID else if (id == 0x0549A966) //Segment Info ID
{ {
assert(m_pInfo == NULL); assert(m_pInfo == NULL);
m_pInfo = new SegmentInfo(this, index, size); m_pInfo = new SegmentInfo(this, index, size);
assert(m_pInfo); assert(m_pInfo);
assert(m_clusterCount == 0); assert(m_clusterCount == 0);
const long long duration = m_pInfo->GetDuration(); const long long duration = m_pInfo->GetDuration();
size_of_cluster_pos = duration / 1000000000 + 1; size_of_cluster_pos = duration / 1000000000 + 1;
fileposition_of_clusters = new long long[size_of_cluster_pos]; fileposition_of_clusters = new long long[size_of_cluster_pos];
memset(fileposition_of_clusters, 0, size_of_cluster_pos); memset(fileposition_of_clusters, 0, size_of_cluster_pos);
} }
index += size; index += size;
} }
@@ -1232,14 +1231,12 @@ long Segment::Load()
if (m_clusterCount == 0) if (m_clusterCount == 0)
return -1L; return -1L;
m_clusters = new Cluster*[m_clusterCount]; m_clusters = new Cluster*[m_clusterCount];
for (int i = 0; i < m_clusterCount; ++i) for (int i = 0; i < m_clusterCount; ++i)
{ m_clusters[i] = Cluster::Parse(this, i, fileposition_of_clusters[i]);
m_clusters[i] = Cluster::Parse(this, i, fileposition_of_clusters[i]);
}
delete [] fileposition_of_clusters; delete [] fileposition_of_clusters;
while (m_pos < stop) while (m_pos < stop)
{ {
@@ -1270,7 +1267,7 @@ long Segment::Load()
return static_cast<long>(result); return static_cast<long>(result);
if ((pos + len) > stop) if ((pos + len) > stop)
return E_FILE_FORMAT_INVALID; return E_FILE_FORMAT_INVALID;
const long long size = ReadUInt(m_pReader, pos, len); const long long size = ReadUInt(m_pReader, pos, len);
@@ -1680,7 +1677,6 @@ SegmentInfo::SegmentInfo(Segment* pSegment, long long start, long long size_) :
else if (Match(pReader, pos, 0x3BA9, m_pTitleAsUTF8)) //[7B][A9] else if (Match(pReader, pos, 0x3BA9, m_pTitleAsUTF8)) //[7B][A9]
assert(m_pTitleAsUTF8); assert(m_pTitleAsUTF8);
else else
{ {
long len; long len;
@@ -2092,7 +2088,6 @@ bool VideoTrack::VetEntry(const BlockEntry* pBlockEntry) const
} }
long long VideoTrack::GetWidth() const long long VideoTrack::GetWidth() const
{ {
return m_width; return m_width;
@@ -2112,7 +2107,10 @@ double VideoTrack::GetFrameRate() const
AudioTrack::AudioTrack(Segment* pSegment, const Info& i) : AudioTrack::AudioTrack(Segment* pSegment, const Info& i) :
Track(pSegment, i) Track(pSegment, i),
m_rate(0.0),
m_channels(0),
m_bitDepth(-1)
{ {
assert(i.type == 2); assert(i.type == 2);
assert(i.number > 0); assert(i.number > 0);
@@ -2265,6 +2263,7 @@ Tracks::Tracks(Segment* pSegment, long long start, long long size_) :
} }
} }
unsigned long Tracks::GetTracksCount() const unsigned long Tracks::GetTracksCount() const
{ {
const ptrdiff_t result = m_trackEntriesEnd - m_trackEntries; const ptrdiff_t result = m_trackEntriesEnd - m_trackEntries;
@@ -2302,25 +2301,18 @@ void Tracks::ParseTrackEntry(
#endif #endif
if (Match(pReader, pos, 0x57, i.number)) if (Match(pReader, pos, 0x57, i.number))
assert(i.number > 0); assert(i.number > 0);
else if (Match(pReader, pos, 0x33C5, i.uid)) else if (Match(pReader, pos, 0x33C5, i.uid))
; ;
else if (Match(pReader, pos, 0x03, i.type)) else if (Match(pReader, pos, 0x03, i.type))
; ;
else if (Match(pReader, pos, 0x136E, i.nameAsUTF8)) else if (Match(pReader, pos, 0x136E, i.nameAsUTF8))
assert(i.nameAsUTF8); assert(i.nameAsUTF8);
else if (Match(pReader, pos, 0x06, i.codecId)) else if (Match(pReader, pos, 0x06, i.codecId))
; ;
else if (Match(pReader, pos, 0x23A2, i.codecPrivate, i.codecPrivateSize)) else if (Match(pReader, pos, 0x23A2, i.codecPrivate, i.codecPrivateSize))
; ;
else if (Match(pReader, pos, 0x058688, i.codecNameAsUTF8)) else if (Match(pReader, pos, 0x058688, i.codecNameAsUTF8))
assert(i.codecNameAsUTF8); assert(i.codecNameAsUTF8);
else else
{ {
long len; long len;
@@ -2462,7 +2454,7 @@ void Cluster::Load()
long long pos = -m_start; long long pos = -m_start;
long len; long len;
const long long id_ = ReadUInt(pReader, pos, len); const long long id_ = ReadUInt(pReader, pos, len);
assert(id_ >= 0); assert(id_ >= 0);