Restore original namespaces for mkvmuxer and mkvparser.

Wrapping mkvmuxer and mkvparser in the libwebm namespace is no
longer necessary now that the tree reorganization is complete.
Put mkvmuxer and mkvparser namespaces back in the global
namespace to avoid unnecessary churn in downstream code.

Change-Id: I13a4fe0143d20bb2bb6038078c68636ff2af0c29
This commit is contained in:
Tom Finegan 2016-03-21 12:16:30 -07:00
parent 504e0f2d5b
commit cbe5c40d12
21 changed files with 621 additions and 610 deletions

View File

@ -12,14 +12,13 @@
#include "mkvmuxer/mkvmuxer.h" #include "mkvmuxer/mkvmuxer.h"
namespace libwebm {
namespace mkvparser { namespace mkvparser {
struct Colour; struct Colour;
struct MasteringMetadata; struct MasteringMetadata;
struct PrimaryChromaticity; struct PrimaryChromaticity;
} // namespace mkvparser } // namespace mkvparser
namespace libwebm {
// Utility types and functions for working with the Colour element and its // Utility types and functions for working with the Colour element and its
// children. Copiers return true upon success. Presence functions return true // children. Copiers return true upon success. Presence functions return true
// when the specified element is present. // when the specified element is present.

View File

@ -59,7 +59,7 @@ class Webm2PesTests : public ::testing::Test {
private: private:
const libwebm::TempFileDeleter temp_file_name_; const libwebm::TempFileDeleter temp_file_name_;
const std::string input_file_name_ = const std::string input_file_name_ =
libwebm::test::GetTestFilePath("bbb_480p_vp9_opus_1second.webm"); test::GetTestFilePath("bbb_480p_vp9_opus_1second.webm");
libwebm::VpxPesParser parser_; libwebm::VpxPesParser parser_;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -21,8 +21,6 @@
// For a description of the WebM elements see // For a description of the WebM elements see
// http://www.webmproject.org/code/specs/container/. // http://www.webmproject.org/code/specs/container/.
namespace libwebm {
namespace mkvparser { namespace mkvparser {
class IMkvReader; class IMkvReader;
} // namespace mkvparser } // namespace mkvparser
@ -354,8 +352,10 @@ struct PrimaryChromaticity {
PrimaryChromaticity(float x_val, float y_val) : x(x_val), y(y_val) {} PrimaryChromaticity(float x_val, float y_val) : x(x_val), y(y_val) {}
PrimaryChromaticity() : x(0), y(0) {} PrimaryChromaticity() : x(0), y(0) {}
~PrimaryChromaticity() {} ~PrimaryChromaticity() {}
uint64_t PrimaryChromaticityPayloadSize(MkvId x_id, MkvId y_id) const; uint64_t PrimaryChromaticityPayloadSize(libwebm::MkvId x_id,
bool Write(IMkvWriter* writer, MkvId x_id, MkvId y_id) const; libwebm::MkvId y_id) const;
bool Write(IMkvWriter* writer, libwebm::MkvId x_id,
libwebm::MkvId y_id) const;
float x; float x;
float y; float y;
@ -1681,6 +1681,5 @@ class Segment {
}; };
} // namespace mkvmuxer } // namespace mkvmuxer
} // namespace libwebm
#endif // MKVMUXER_MKVMUXER_H_ #endif // MKVMUXER_MKVMUXER_H_

View File

@ -29,7 +29,6 @@
#pragma warning(disable : 4996) #pragma warning(disable : 4996)
#endif #endif
namespace libwebm {
namespace mkvmuxer { namespace mkvmuxer {
namespace { namespace {
@ -46,18 +45,20 @@ uint64_t WriteBlock(IMkvWriter* writer, const Frame* const frame,
uint64_t block_additions_payload_size = 0; uint64_t block_additions_payload_size = 0;
uint64_t block_additions_elem_size = 0; uint64_t block_additions_elem_size = 0;
if (frame->additional()) { if (frame->additional()) {
block_additional_elem_size = EbmlElementSize( block_additional_elem_size =
kMkvBlockAdditional, frame->additional(), frame->additional_length()); EbmlElementSize(libwebm::kMkvBlockAdditional, frame->additional(),
block_addid_elem_size = EbmlElementSize(kMkvBlockAddID, frame->add_id()); frame->additional_length());
block_addid_elem_size =
EbmlElementSize(libwebm::kMkvBlockAddID, frame->add_id());
block_more_payload_size = block_more_payload_size =
block_addid_elem_size + block_additional_elem_size; block_addid_elem_size + block_additional_elem_size;
block_more_elem_size = block_more_elem_size =
EbmlMasterElementSize(kMkvBlockMore, block_more_payload_size) + EbmlMasterElementSize(libwebm::kMkvBlockMore, block_more_payload_size) +
block_more_payload_size; block_more_payload_size;
block_additions_payload_size = block_more_elem_size; block_additions_payload_size = block_more_elem_size;
block_additions_elem_size = block_additions_elem_size =
EbmlMasterElementSize(kMkvBlockAdditions, EbmlMasterElementSize(libwebm::kMkvBlockAdditions,
block_additions_payload_size) + block_additions_payload_size) +
block_additions_payload_size; block_additions_payload_size;
} }
@ -65,7 +66,7 @@ uint64_t WriteBlock(IMkvWriter* writer, const Frame* const frame,
uint64_t discard_padding_elem_size = 0; uint64_t discard_padding_elem_size = 0;
if (frame->discard_padding() != 0) { if (frame->discard_padding() != 0) {
discard_padding_elem_size = discard_padding_elem_size =
EbmlElementSize(kMkvDiscardPadding, frame->discard_padding()); EbmlElementSize(libwebm::kMkvDiscardPadding, frame->discard_padding());
} }
const uint64_t reference_block_timestamp = const uint64_t reference_block_timestamp =
@ -73,28 +74,30 @@ uint64_t WriteBlock(IMkvWriter* writer, const Frame* const frame,
uint64_t reference_block_elem_size = 0; uint64_t reference_block_elem_size = 0;
if (!frame->is_key()) { if (!frame->is_key()) {
reference_block_elem_size = reference_block_elem_size =
EbmlElementSize(kMkvReferenceBlock, reference_block_timestamp); EbmlElementSize(libwebm::kMkvReferenceBlock, reference_block_timestamp);
} }
const uint64_t duration = frame->duration() / timecode_scale; const uint64_t duration = frame->duration() / timecode_scale;
uint64_t block_duration_elem_size = 0; uint64_t block_duration_elem_size = 0;
if (duration > 0) if (duration > 0)
block_duration_elem_size = EbmlElementSize(kMkvBlockDuration, duration); block_duration_elem_size =
EbmlElementSize(libwebm::kMkvBlockDuration, duration);
const uint64_t block_payload_size = 4 + frame->length(); const uint64_t block_payload_size = 4 + frame->length();
const uint64_t block_elem_size = const uint64_t block_elem_size =
EbmlMasterElementSize(kMkvBlock, block_payload_size) + block_payload_size; EbmlMasterElementSize(libwebm::kMkvBlock, block_payload_size) +
block_payload_size;
const uint64_t block_group_payload_size = const uint64_t block_group_payload_size =
block_elem_size + block_additions_elem_size + block_duration_elem_size + block_elem_size + block_additions_elem_size + block_duration_elem_size +
discard_padding_elem_size + reference_block_elem_size; discard_padding_elem_size + reference_block_elem_size;
if (!WriteEbmlMasterElement(writer, kMkvBlockGroup, if (!WriteEbmlMasterElement(writer, libwebm::kMkvBlockGroup,
block_group_payload_size)) { block_group_payload_size)) {
return 0; return 0;
} }
if (!WriteEbmlMasterElement(writer, kMkvBlock, block_payload_size)) if (!WriteEbmlMasterElement(writer, libwebm::kMkvBlock, block_payload_size))
return 0; return 0;
if (WriteUInt(writer, frame->track_number())) if (WriteUInt(writer, frame->track_number()))
@ -111,44 +114,48 @@ uint64_t WriteBlock(IMkvWriter* writer, const Frame* const frame,
return 0; return 0;
if (frame->additional()) { if (frame->additional()) {
if (!WriteEbmlMasterElement(writer, kMkvBlockAdditions, if (!WriteEbmlMasterElement(writer, libwebm::kMkvBlockAdditions,
block_additions_payload_size)) { block_additions_payload_size)) {
return 0; return 0;
} }
if (!WriteEbmlMasterElement(writer, kMkvBlockMore, block_more_payload_size)) if (!WriteEbmlMasterElement(writer, libwebm::kMkvBlockMore,
block_more_payload_size))
return 0; return 0;
if (!WriteEbmlElement(writer, kMkvBlockAddID, frame->add_id())) if (!WriteEbmlElement(writer, libwebm::kMkvBlockAddID, frame->add_id()))
return 0; return 0;
if (!WriteEbmlElement(writer, kMkvBlockAdditional, frame->additional(), if (!WriteEbmlElement(writer, libwebm::kMkvBlockAdditional,
frame->additional_length())) { frame->additional(), frame->additional_length())) {
return 0; return 0;
} }
} }
if (frame->discard_padding() != 0 && if (frame->discard_padding() != 0 &&
!WriteEbmlElement(writer, kMkvDiscardPadding, frame->discard_padding())) { !WriteEbmlElement(writer, libwebm::kMkvDiscardPadding,
frame->discard_padding())) {
return false; return false;
} }
if (!frame->is_key() && if (!frame->is_key() &&
!WriteEbmlElement(writer, kMkvReferenceBlock, !WriteEbmlElement(writer, libwebm::kMkvReferenceBlock,
reference_block_timestamp)) { reference_block_timestamp)) {
return false; return false;
} }
if (duration > 0 && !WriteEbmlElement(writer, kMkvBlockDuration, duration)) { if (duration > 0 &&
!WriteEbmlElement(writer, libwebm::kMkvBlockDuration, duration)) {
return false; return false;
} }
return EbmlMasterElementSize(kMkvBlockGroup, block_group_payload_size) + return EbmlMasterElementSize(libwebm::kMkvBlockGroup,
block_group_payload_size) +
block_group_payload_size; block_group_payload_size;
} }
uint64_t WriteSimpleBlock(IMkvWriter* writer, const Frame* const frame, uint64_t WriteSimpleBlock(IMkvWriter* writer, const Frame* const frame,
int64_t timecode) { int64_t timecode) {
if (WriteID(writer, kMkvSimpleBlock)) if (WriteID(writer, libwebm::kMkvSimpleBlock))
return 0; return 0;
const int32_t size = static_cast<int32_t>(frame->length()) + 4; const int32_t size = static_cast<int32_t>(frame->length()) + 4;
@ -171,7 +178,7 @@ uint64_t WriteSimpleBlock(IMkvWriter* writer, const Frame* const frame,
if (writer->Write(frame->frame(), static_cast<uint32_t>(frame->length()))) if (writer->Write(frame->frame(), static_cast<uint32_t>(frame->length())))
return 0; return 0;
return GetUIntSize(kMkvSimpleBlock) + GetCodedUIntSize(size) + 4 + return GetUIntSize(libwebm::kMkvSimpleBlock) + GetCodedUIntSize(size) + 4 +
frame->length(); frame->length();
} }
@ -557,7 +564,8 @@ uint64_t WriteVoidElement(IMkvWriter* writer, uint64_t size) {
// Subtract one for the void ID and the coded size. // Subtract one for the void ID and the coded size.
uint64_t void_entry_size = size - 1 - GetCodedUIntSize(size - 1); uint64_t void_entry_size = size - 1 - GetCodedUIntSize(size - 1);
uint64_t void_size = uint64_t void_size =
EbmlMasterElementSize(kMkvVoid, void_entry_size) + void_entry_size; EbmlMasterElementSize(libwebm::kMkvVoid, void_entry_size) +
void_entry_size;
if (void_size != size) if (void_size != size)
return 0; return 0;
@ -566,7 +574,7 @@ uint64_t WriteVoidElement(IMkvWriter* writer, uint64_t size) {
if (payload_position < 0) if (payload_position < 0)
return 0; return 0;
if (WriteID(writer, kMkvVoid)) if (WriteID(writer, libwebm::kMkvVoid))
return 0; return 0;
if (WriteUInt(writer, void_entry_size)) if (WriteUInt(writer, void_entry_size))
@ -630,4 +638,3 @@ uint64_t MakeUID(unsigned int* seed) {
} }
} // namespace mkvmuxer } // namespace mkvmuxer
} // namespace libwebm

View File

@ -10,7 +10,6 @@
#include <stdint.h> #include <stdint.h>
namespace libwebm {
namespace mkvmuxer { namespace mkvmuxer {
class Cluster; class Cluster;
class Frame; class Frame;
@ -80,6 +79,5 @@ void GetVersion(int32_t* major, int32_t* minor, int32_t* build,
uint64_t MakeUID(unsigned int* seed); uint64_t MakeUID(unsigned int* seed);
} // namespace mkvmuxer } // namespace mkvmuxer
} // namespace libwebm
#endif // MKVMUXER_MKVMUXERUTIL_H_ #endif // MKVMUXER_MKVMUXERUTIL_H_

View File

@ -12,7 +12,6 @@
#include <share.h> // for _SH_DENYWR #include <share.h> // for _SH_DENYWR
#endif #endif
namespace libwebm {
namespace mkvmuxer { namespace mkvmuxer {
MkvWriter::MkvWriter() : file_(NULL), writer_owns_file_(true) {} MkvWriter::MkvWriter() : file_(NULL), writer_owns_file_(true) {}
@ -87,4 +86,3 @@ bool MkvWriter::Seekable() const { return true; }
void MkvWriter::ElementStartNotify(uint64_t, int64_t) {} void MkvWriter::ElementStartNotify(uint64_t, int64_t) {}
} // namespace mkvmuxer } // namespace mkvmuxer
} // namespace libwebm

View File

@ -14,7 +14,6 @@
#include "mkvmuxer/mkvmuxer.h" #include "mkvmuxer/mkvmuxer.h"
#include "mkvmuxer/mkvmuxertypes.h" #include "mkvmuxer/mkvmuxertypes.h"
namespace libwebm {
namespace mkvmuxer { namespace mkvmuxer {
// Default implementation of the IMkvWriter interface on Windows. // Default implementation of the IMkvWriter interface on Windows.
@ -48,6 +47,5 @@ class MkvWriter : public IMkvWriter {
}; };
} // namespace mkvmuxer } // namespace mkvmuxer
} // namespace libwebm
#endif // MKVMUXER_MKVWRITER_H_ #endif // MKVMUXER_MKVWRITER_H_

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@
#include <cstddef> #include <cstddef>
namespace libwebm {
namespace mkvparser { namespace mkvparser {
const int E_PARSE_FAILED = -1; const int E_PARSE_FAILED = -1;
@ -1102,9 +1101,8 @@ class Segment {
}; };
} // namespace mkvparser } // namespace mkvparser
} // namespace libwebm
inline long libwebm::mkvparser::Segment::LoadCluster() { inline long mkvparser::Segment::LoadCluster() {
long long pos; long long pos;
long size; long size;

View File

@ -9,7 +9,6 @@
#include <cassert> #include <cassert>
namespace libwebm {
namespace mkvparser { namespace mkvparser {
MkvReader::MkvReader() : m_file(NULL), reader_owns_file_(true) {} MkvReader::MkvReader() : m_file(NULL), reader_owns_file_(true) {}
@ -130,4 +129,3 @@ int MkvReader::Read(long long offset, long len, unsigned char* buffer) {
} }
} // namespace mkvparser } // namespace mkvparser
} // namespace libwebm

View File

@ -12,7 +12,6 @@
#include "mkvparser/mkvparser.h" #include "mkvparser/mkvparser.h"
namespace libwebm {
namespace mkvparser { namespace mkvparser {
class MkvReader : public IMkvReader { class MkvReader : public IMkvReader {
@ -42,6 +41,5 @@ class MkvReader : public IMkvReader {
}; };
} // namespace mkvparser } // namespace mkvparser
} // namespace libwebm
#endif // MKVPARSER_MKVREADER_H_ #endif // MKVPARSER_MKVREADER_H_

View File

@ -44,15 +44,15 @@ const wchar_t* utf8towcs(const char* str) {
return val; return val;
} }
bool InputHasCues(const libwebm::mkvparser::Segment* const segment) { bool InputHasCues(const mkvparser::Segment* const segment) {
const libwebm::mkvparser::Cues* const cues = segment->GetCues(); const mkvparser::Cues* const cues = segment->GetCues();
if (cues == NULL) if (cues == NULL)
return false; return false;
while (!cues->DoneParsing()) while (!cues->DoneParsing())
cues->LoadCuePoint(); cues->LoadCuePoint();
const libwebm::mkvparser::CuePoint* const cue_point = cues->GetFirst(); const mkvparser::CuePoint* const cue_point = cues->GetFirst();
if (cue_point == NULL) if (cue_point == NULL)
return false; return false;
@ -60,11 +60,11 @@ bool InputHasCues(const libwebm::mkvparser::Segment* const segment) {
} }
bool MasteringMetadataValuePresent(double value) { bool MasteringMetadataValuePresent(double value) {
return value != libwebm::mkvparser::MasteringMetadata::kValueNotPresent; return value != mkvparser::MasteringMetadata::kValueNotPresent;
} }
bool ColourValuePresent(long long value) { bool ColourValuePresent(long long value) {
return value != libwebm::mkvparser::Colour::kValueNotPresent; return value != mkvparser::Colour::kValueNotPresent;
} }
} // namespace } // namespace
@ -77,7 +77,7 @@ int main(int argc, char* argv[]) {
return -1; return -1;
} }
libwebm::mkvparser::MkvReader reader; mkvparser::MkvReader reader;
if (reader.Open(argv[1])) { if (reader.Open(argv[1])) {
printf("\n Filename is invalid or error while opening.\n"); printf("\n Filename is invalid or error while opening.\n");
@ -86,12 +86,12 @@ int main(int argc, char* argv[]) {
int maj, min, build, rev; int maj, min, build, rev;
libwebm::mkvparser::GetVersion(maj, min, build, rev); mkvparser::GetVersion(maj, min, build, rev);
printf("\t\t libmkv verison: %d.%d.%d.%d\n", maj, min, build, rev); printf("\t\t libmkv verison: %d.%d.%d.%d\n", maj, min, build, rev);
long long pos = 0; long long pos = 0;
libwebm::mkvparser::EBMLHeader ebmlHeader; mkvparser::EBMLHeader ebmlHeader;
long long ret = ebmlHeader.Parse(&reader, pos); long long ret = ebmlHeader.Parse(&reader, pos);
if (ret < 0) { if (ret < 0) {
@ -106,7 +106,7 @@ 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);
typedef libwebm::mkvparser::Segment seg_t; typedef mkvparser::Segment seg_t;
seg_t* pSegment_; seg_t* pSegment_;
ret = seg_t::CreateInstance(&reader, pos, pSegment_); ret = seg_t::CreateInstance(&reader, pos, pSegment_);
@ -123,8 +123,7 @@ int main(int argc, char* argv[]) {
return -1; return -1;
} }
const libwebm::mkvparser::SegmentInfo* const pSegmentInfo = const mkvparser::SegmentInfo* const pSegmentInfo = pSegment->GetInfo();
pSegment->GetInfo();
if (pSegmentInfo == NULL) { if (pSegmentInfo == NULL) {
printf("\n Segment::GetInfo() failed."); printf("\n Segment::GetInfo() failed.");
return -1; return -1;
@ -177,7 +176,7 @@ int main(int argc, char* argv[]) {
// size of segment payload // size of segment payload
printf("\t\tSize(Segment)\t\t: %lld\n", pSegment->m_size); printf("\t\tSize(Segment)\t\t: %lld\n", pSegment->m_size);
const libwebm::mkvparser::Tracks* pTracks = pSegment->GetTracks(); const mkvparser::Tracks* pTracks = pSegment->GetTracks();
unsigned long track_num = 0; unsigned long track_num = 0;
const unsigned long num_tracks = pTracks->GetTracksCount(); const unsigned long num_tracks = pTracks->GetTracksCount();
@ -185,7 +184,7 @@ int main(int argc, char* argv[]) {
printf("\n\t\t\t Track Info\n"); printf("\n\t\t\t Track Info\n");
while (track_num != num_tracks) { while (track_num != num_tracks) {
const libwebm::mkvparser::Track* const pTrack = const mkvparser::Track* const pTrack =
pTracks->GetTrackByIndex(track_num++); pTracks->GetTrackByIndex(track_num++);
if (pTrack == NULL) if (pTrack == NULL)
@ -224,9 +223,9 @@ int main(int argc, char* argv[]) {
delete[] pCodecName; delete[] pCodecName;
} }
if (trackType == libwebm::mkvparser::Track::kVideo) { if (trackType == mkvparser::Track::kVideo) {
const libwebm::mkvparser::VideoTrack* const pVideoTrack = const mkvparser::VideoTrack* const pVideoTrack =
static_cast<const libwebm::mkvparser::VideoTrack*>(pTrack); static_cast<const mkvparser::VideoTrack*>(pTrack);
const long long width = pVideoTrack->GetWidth(); const long long width = pVideoTrack->GetWidth();
printf("\t\tVideo Width\t\t: %lld\n", width); printf("\t\tVideo Width\t\t: %lld\n", width);
@ -237,7 +236,7 @@ int main(int argc, char* argv[]) {
const double rate = pVideoTrack->GetFrameRate(); const double rate = pVideoTrack->GetFrameRate();
printf("\t\tVideo Rate\t\t: %f\n", rate); printf("\t\tVideo Rate\t\t: %f\n", rate);
const libwebm::mkvparser::Colour* const colour = pVideoTrack->GetColour(); const mkvparser::Colour* const colour = pVideoTrack->GetColour();
if (colour) { if (colour) {
printf("\t\tVideo Colour:\n"); printf("\t\tVideo Colour:\n");
if (ColourValuePresent(colour->matrix_coefficients)) if (ColourValuePresent(colour->matrix_coefficients))
@ -273,7 +272,7 @@ int main(int argc, char* argv[]) {
if (ColourValuePresent(colour->max_fall)) if (ColourValuePresent(colour->max_fall))
printf("\t\t\tMaxFALL: %lld\n", colour->max_fall); printf("\t\t\tMaxFALL: %lld\n", colour->max_fall);
if (colour->mastering_metadata) { if (colour->mastering_metadata) {
const libwebm::mkvparser::MasteringMetadata* const mm = const mkvparser::MasteringMetadata* const mm =
colour->mastering_metadata; colour->mastering_metadata;
printf("\t\t\tMastering Metadata:\n"); printf("\t\t\tMastering Metadata:\n");
if (MasteringMetadataValuePresent(mm->luminance_max)) if (MasteringMetadataValuePresent(mm->luminance_max))
@ -302,9 +301,9 @@ int main(int argc, char* argv[]) {
} }
} }
if (trackType == libwebm::mkvparser::Track::kAudio) { if (trackType == mkvparser::Track::kAudio) {
const libwebm::mkvparser::AudioTrack* const pAudioTrack = const mkvparser::AudioTrack* const pAudioTrack =
static_cast<const libwebm::mkvparser::AudioTrack*>(pTrack); static_cast<const mkvparser::AudioTrack*>(pTrack);
const long long channels = pAudioTrack->GetChannels(); const long long channels = pAudioTrack->GetChannels();
printf("\t\tAudio Channels\t\t: %lld\n", channels); printf("\t\tAudio Channels\t\t: %lld\n", channels);
@ -333,7 +332,7 @@ int main(int argc, char* argv[]) {
return -1; return -1;
} }
const libwebm::mkvparser::Cluster* pCluster = pSegment->GetFirst(); const mkvparser::Cluster* pCluster = pSegment->GetFirst();
while ((pCluster != NULL) && !pCluster->EOS()) { while ((pCluster != NULL) && !pCluster->EOS()) {
const long long timeCode = pCluster->GetTimeCode(); const long long timeCode = pCluster->GetTimeCode();
@ -342,7 +341,7 @@ int main(int argc, char* argv[]) {
const long long time_ns = pCluster->GetTime(); const long long time_ns = pCluster->GetTime();
printf("\t\tCluster Time (ns)\t: %lld\n", time_ns); printf("\t\tCluster Time (ns)\t: %lld\n", time_ns);
const libwebm::mkvparser::BlockEntry* pBlockEntry; const mkvparser::BlockEntry* pBlockEntry;
long status = pCluster->GetFirst(pBlockEntry); long status = pCluster->GetFirst(pBlockEntry);
@ -354,11 +353,10 @@ int main(int argc, char* argv[]) {
} }
while ((pBlockEntry != NULL) && !pBlockEntry->EOS()) { while ((pBlockEntry != NULL) && !pBlockEntry->EOS()) {
const libwebm::mkvparser::Block* const pBlock = pBlockEntry->GetBlock(); const mkvparser::Block* const pBlock = pBlockEntry->GetBlock();
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 libwebm::mkvparser::Track* const pTrack = const mkvparser::Track* const pTrack = pTracks->GetTrackByNumber(tn);
pTracks->GetTrackByNumber(tn);
if (pTrack == NULL) if (pTrack == NULL)
printf("\t\t\tBlock\t\t:UNKNOWN TRACK TYPE\n"); printf("\t\t\tBlock\t\t:UNKNOWN TRACK TYPE\n");
@ -369,12 +367,11 @@ int main(int argc, char* argv[]) {
const long long discard_padding = pBlock->GetDiscardPadding(); const long long discard_padding = pBlock->GetDiscardPadding();
printf("\t\t\tBlock\t\t:%s,%s,%15lld,%lld\n", printf("\t\t\tBlock\t\t:%s,%s,%15lld,%lld\n",
(trackType == libwebm::mkvparser::Track::kVideo) ? "V" : "A", (trackType == mkvparser::Track::kVideo) ? "V" : "A",
pBlock->IsKey() ? "I" : "P", time_ns, discard_padding); pBlock->IsKey() ? "I" : "P", time_ns, discard_padding);
for (int i = 0; i < frameCount; ++i) { for (int i = 0; i < frameCount; ++i) {
const libwebm::mkvparser::Block::Frame& theFrame = const mkvparser::Block::Frame& theFrame = pBlock->GetFrame(i);
pBlock->GetFrame(i);
const long size = theFrame.len; const long size = theFrame.len;
const long long offset = theFrame.pos; const long long offset = theFrame.pos;
printf("\t\t\t %15ld,%15llx\n", size, offset); printf("\t\t\t %15ld,%15llx\n", size, offset);
@ -395,22 +392,21 @@ int main(int argc, char* argv[]) {
if (InputHasCues(pSegment.get())) { if (InputHasCues(pSegment.get())) {
// Walk them. // Walk them.
const libwebm::mkvparser::Cues* const cues = pSegment->GetCues(); const mkvparser::Cues* const cues = pSegment->GetCues();
const libwebm::mkvparser::CuePoint* cue = cues->GetFirst(); const mkvparser::CuePoint* cue = cues->GetFirst();
int cue_point_num = 1; int cue_point_num = 1;
printf("\t\tCues\n"); printf("\t\tCues\n");
do { do {
for (track_num = 0; track_num < num_tracks; ++track_num) { for (track_num = 0; track_num < num_tracks; ++track_num) {
const libwebm::mkvparser::Track* const track = const mkvparser::Track* const track =
pTracks->GetTrackByIndex(track_num); pTracks->GetTrackByIndex(track_num);
const libwebm::mkvparser::CuePoint::TrackPosition* const track_pos = const mkvparser::CuePoint::TrackPosition* const track_pos =
cue->Find(track); cue->Find(track);
if (track_pos != NULL) { if (track_pos != NULL) {
const char track_type = const char track_type =
(track->GetType() == libwebm::mkvparser::Track::kVideo) ? 'V' : (track->GetType() == mkvparser::Track::kVideo) ? 'V' : 'A';
'A';
printf( printf(
"\t\t\tCue Point %4d Track %3lu(%c) Time %14lld " "\t\t\tCue Point %4d Track %3lu(%c) Time %14lld "
"Block %4lld Pos %8llx\n", "Block %4lld Pos %8llx\n",
@ -425,14 +421,14 @@ int main(int argc, char* argv[]) {
} while (cue != NULL); } while (cue != NULL);
} }
const libwebm::mkvparser::Tags* const tags = pSegment->GetTags(); const mkvparser::Tags* const tags = pSegment->GetTags();
if (tags && tags->GetTagCount() > 0) { if (tags && tags->GetTagCount() > 0) {
printf("\t\tTags\n"); printf("\t\tTags\n");
for (int i = 0; i < tags->GetTagCount(); ++i) { for (int i = 0; i < tags->GetTagCount(); ++i) {
const libwebm::mkvparser::Tags::Tag* const tag = tags->GetTag(i); const mkvparser::Tags::Tag* const tag = tags->GetTag(i);
printf("\t\t\tTag\n"); printf("\t\t\tTag\n");
for (int j = 0; j < tag->GetSimpleTagCount(); j++) { for (int j = 0; j < tag->GetSimpleTagCount(); j++) {
const libwebm::mkvparser::Tags::SimpleTag* const simple_tag = const mkvparser::Tags::SimpleTag* const simple_tag =
tag->GetSimpleTag(j); tag->GetSimpleTag(j);
printf("\t\t\t\tSimple Tag \"%s\" Value \"%s\"\n", printf("\t\t\t\tSimple Tag \"%s\" Value \"%s\"\n",
simple_tag->GetTagName(), simple_tag->GetTagString()); simple_tag->GetTagName(), simple_tag->GetTagString());

View File

@ -82,14 +82,14 @@ void Usage() {
struct MetadataFile { struct MetadataFile {
const char* name; const char* name;
libwebm::SampleMuxerMetadata::Kind kind; SampleMuxerMetadata::Kind kind;
}; };
typedef std::list<MetadataFile> metadata_files_t; typedef std::list<MetadataFile> metadata_files_t;
// Cache the WebVTT filenames specified as command-line args. // Cache the WebVTT filenames specified as command-line args.
bool LoadMetadataFiles(const metadata_files_t& files, bool LoadMetadataFiles(const metadata_files_t& files,
libwebm::SampleMuxerMetadata* metadata) { SampleMuxerMetadata* metadata) {
typedef metadata_files_t::const_iterator iter_t; typedef metadata_files_t::const_iterator iter_t;
iter_t i = files.begin(); iter_t i = files.begin();
@ -112,14 +112,14 @@ int ParseArgWebVTT(char* argv[], int* argv_index, int argc_check,
enum { kCount = 5 }; enum { kCount = 5 };
struct Arg { struct Arg {
const char* name; const char* name;
libwebm::SampleMuxerMetadata::Kind kind; SampleMuxerMetadata::Kind kind;
}; };
const Arg args[kCount] = { const Arg args[kCount] = {
{"-webvtt-subtitles", libwebm::SampleMuxerMetadata::kSubtitles}, {"-webvtt-subtitles", SampleMuxerMetadata::kSubtitles},
{"-webvtt-captions", libwebm::SampleMuxerMetadata::kCaptions}, {"-webvtt-captions", SampleMuxerMetadata::kCaptions},
{"-webvtt-descriptions", libwebm::SampleMuxerMetadata::kDescriptions}, {"-webvtt-descriptions", SampleMuxerMetadata::kDescriptions},
{"-webvtt-metadata", libwebm::SampleMuxerMetadata::kMetadata}, {"-webvtt-metadata", SampleMuxerMetadata::kMetadata},
{"-webvtt-chapters", libwebm::SampleMuxerMetadata::kChapters}}; {"-webvtt-chapters", SampleMuxerMetadata::kChapters}};
for (int idx = 0; idx < kCount; ++idx) { for (int idx = 0; idx < kCount; ++idx) {
const Arg& arg = args[idx]; const Arg& arg = args[idx];
@ -248,7 +248,7 @@ int main(int argc, char* argv[]) {
} }
// Get parser header info // Get parser header info
libwebm::mkvparser::MkvReader reader; mkvparser::MkvReader reader;
if (reader.Open(input)) { if (reader.Open(input)) {
printf("\n Filename is invalid or error while opening.\n"); printf("\n Filename is invalid or error while opening.\n");
@ -256,31 +256,28 @@ int main(int argc, char* argv[]) {
} }
long long pos = 0; long long pos = 0;
libwebm::mkvparser::EBMLHeader ebml_header; mkvparser::EBMLHeader ebml_header;
long long ret = ebml_header.Parse(&reader, pos); long long ret = ebml_header.Parse(&reader, pos);
if (ret) { if (ret) {
printf("\n EBMLHeader::Parse() failed."); printf("\n EBMLHeader::Parse() failed.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
libwebm::mkvparser::Segment* parser_segment_; mkvparser::Segment* parser_segment_;
ret = libwebm::mkvparser::Segment::CreateInstance(&reader, pos, ret = mkvparser::Segment::CreateInstance(&reader, pos, parser_segment_);
parser_segment_);
if (ret) { if (ret) {
printf("\n Segment::CreateInstance() failed."); printf("\n Segment::CreateInstance() failed.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const std::auto_ptr<libwebm::mkvparser::Segment> parser_segment( const std::auto_ptr<mkvparser::Segment> parser_segment(parser_segment_);
parser_segment_);
ret = parser_segment->Load(); ret = parser_segment->Load();
if (ret < 0) { if (ret < 0) {
printf("\n Segment::Load() failed."); printf("\n Segment::Load() failed.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const libwebm::mkvparser::SegmentInfo* const segment_info = const mkvparser::SegmentInfo* const segment_info = parser_segment->GetInfo();
parser_segment->GetInfo();
if (segment_info == NULL) { if (segment_info == NULL) {
printf("\n Segment::GetInfo() failed."); printf("\n Segment::GetInfo() failed.");
return EXIT_FAILURE; return EXIT_FAILURE;
@ -288,7 +285,7 @@ int main(int argc, char* argv[]) {
const long long timeCodeScale = segment_info->GetTimeCodeScale(); const long long timeCodeScale = segment_info->GetTimeCodeScale();
// Set muxer header info // Set muxer header info
libwebm::mkvmuxer::MkvWriter writer; mkvmuxer::MkvWriter writer;
const std::string temp_file = libwebm::GetTempFileName(); const std::string temp_file = libwebm::GetTempFileName();
if (!writer.Open(cues_before_clusters ? temp_file.c_str() : output)) { if (!writer.Open(cues_before_clusters ? temp_file.c_str() : output)) {
@ -297,7 +294,7 @@ int main(int argc, char* argv[]) {
} }
// Set Segment element attributes // Set Segment element attributes
libwebm::mkvmuxer::Segment muxer_segment; mkvmuxer::Segment muxer_segment;
if (!muxer_segment.Init(&writer)) { if (!muxer_segment.Init(&writer)) {
printf("\n Could not initialize muxer segment!\n"); printf("\n Could not initialize muxer segment!\n");
@ -307,9 +304,9 @@ int main(int argc, char* argv[]) {
muxer_segment.AccurateClusterDuration(accurate_cluster_duration); muxer_segment.AccurateClusterDuration(accurate_cluster_duration);
if (live_mode) if (live_mode)
muxer_segment.set_mode(libwebm::mkvmuxer::Segment::kLive); muxer_segment.set_mode(mkvmuxer::Segment::kLive);
else else
muxer_segment.set_mode(libwebm::mkvmuxer::Segment::kFile); muxer_segment.set_mode(mkvmuxer::Segment::kFile);
if (chunking) if (chunking)
muxer_segment.SetChunking(true, chunk_name); muxer_segment.SetChunking(true, chunk_name);
@ -321,18 +318,18 @@ int main(int argc, char* argv[]) {
muxer_segment.OutputCues(output_cues); muxer_segment.OutputCues(output_cues);
// Set SegmentInfo element attributes // Set SegmentInfo element attributes
libwebm::mkvmuxer::SegmentInfo* const info = muxer_segment.GetSegmentInfo(); mkvmuxer::SegmentInfo* const info = muxer_segment.GetSegmentInfo();
info->set_timecode_scale(timeCodeScale); info->set_timecode_scale(timeCodeScale);
info->set_writing_app("sample_muxer"); info->set_writing_app("sample_muxer");
const libwebm::mkvparser::Tags* const tags = parser_segment->GetTags(); const mkvparser::Tags* const tags = parser_segment->GetTags();
if (copy_tags && tags) { if (copy_tags && tags) {
for (int i = 0; i < tags->GetTagCount(); i++) { for (int i = 0; i < tags->GetTagCount(); i++) {
const libwebm::mkvparser::Tags::Tag* const tag = tags->GetTag(i); const mkvparser::Tags::Tag* const tag = tags->GetTag(i);
libwebm::mkvmuxer::Tag* muxer_tag = muxer_segment.AddTag(); mkvmuxer::Tag* muxer_tag = muxer_segment.AddTag();
for (int j = 0; j < tag->GetSimpleTagCount(); j++) { for (int j = 0; j < tag->GetSimpleTagCount(); j++) {
const libwebm::mkvparser::Tags::SimpleTag* const simple_tag = const mkvparser::Tags::SimpleTag* const simple_tag =
tag->GetSimpleTag(j); tag->GetSimpleTag(j);
muxer_tag->add_simple_tag(simple_tag->GetTagName(), muxer_tag->add_simple_tag(simple_tag->GetTagName(),
simple_tag->GetTagString()); simple_tag->GetTagString());
@ -341,13 +338,12 @@ int main(int argc, char* argv[]) {
} }
// Set Tracks element attributes // Set Tracks element attributes
const libwebm::mkvparser::Tracks* const parser_tracks = const mkvparser::Tracks* const parser_tracks = parser_segment->GetTracks();
parser_segment->GetTracks();
unsigned long i = 0; unsigned long i = 0;
uint64_t vid_track = 0; // no track added uint64_t vid_track = 0; // no track added
uint64_t aud_track = 0; // no track added uint64_t aud_track = 0; // no track added
using libwebm::mkvparser::Track; using mkvparser::Track;
while (i != parser_tracks->GetTracksCount()) { while (i != parser_tracks->GetTracksCount()) {
int track_num = i++; int track_num = i++;
@ -366,8 +362,8 @@ int main(int argc, char* argv[]) {
if (track_type == Track::kVideo && output_video) { if (track_type == Track::kVideo && output_video) {
// Get the video track from the parser // Get the video track from the parser
const libwebm::mkvparser::VideoTrack* const pVideoTrack = const mkvparser::VideoTrack* const pVideoTrack =
static_cast<const libwebm::mkvparser::VideoTrack*>(parser_track); static_cast<const mkvparser::VideoTrack*>(parser_track);
const long long width = pVideoTrack->GetWidth(); const long long width = pVideoTrack->GetWidth();
const long long height = pVideoTrack->GetHeight(); const long long height = pVideoTrack->GetHeight();
@ -380,8 +376,7 @@ int main(int argc, char* argv[]) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
libwebm::mkvmuxer::VideoTrack* const video = mkvmuxer::VideoTrack* const video = static_cast<mkvmuxer::VideoTrack*>(
static_cast<libwebm::mkvmuxer::VideoTrack*>(
muxer_segment.GetTrackByNumber(vid_track)); muxer_segment.GetTrackByNumber(vid_track));
if (!video) { if (!video) {
printf("\n Could not get video track.\n"); printf("\n Could not get video track.\n");
@ -389,7 +384,7 @@ int main(int argc, char* argv[]) {
} }
if (pVideoTrack->GetColour()) { if (pVideoTrack->GetColour()) {
libwebm::mkvmuxer::Colour muxer_colour; mkvmuxer::Colour muxer_colour;
if (!libwebm::CopyColour(*pVideoTrack->GetColour(), &muxer_colour)) if (!libwebm::CopyColour(*pVideoTrack->GetColour(), &muxer_colour))
return EXIT_FAILURE; return EXIT_FAILURE;
if (!video->SetColour(muxer_colour)) if (!video->SetColour(muxer_colour))
@ -414,8 +409,8 @@ int main(int argc, char* argv[]) {
} }
} else if (track_type == Track::kAudio && output_audio) { } else if (track_type == Track::kAudio && output_audio) {
// Get the audio track from the parser // Get the audio track from the parser
const libwebm::mkvparser::AudioTrack* const pAudioTrack = const mkvparser::AudioTrack* const pAudioTrack =
static_cast<const libwebm::mkvparser::AudioTrack*>(parser_track); static_cast<const mkvparser::AudioTrack*>(parser_track);
const long long channels = pAudioTrack->GetChannels(); const long long channels = pAudioTrack->GetChannels();
const double sample_rate = pAudioTrack->GetSamplingRate(); const double sample_rate = pAudioTrack->GetSamplingRate();
@ -428,8 +423,7 @@ int main(int argc, char* argv[]) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
libwebm::mkvmuxer::AudioTrack* const audio = mkvmuxer::AudioTrack* const audio = static_cast<mkvmuxer::AudioTrack*>(
static_cast<libwebm::mkvmuxer::AudioTrack*>(
muxer_segment.GetTrackByNumber(aud_track)); muxer_segment.GetTrackByNumber(aud_track));
if (!audio) { if (!audio) {
printf("\n Could not get audio track.\n"); printf("\n Could not get audio track.\n");
@ -467,7 +461,7 @@ int main(int argc, char* argv[]) {
// add a track to the output file corresponding to each metadata // add a track to the output file corresponding to each metadata
// input file. // input file.
libwebm::SampleMuxerMetadata metadata; SampleMuxerMetadata metadata;
if (!metadata.Init(&muxer_segment)) { if (!metadata.Init(&muxer_segment)) {
printf("\n Could not initialize metadata cache.\n"); printf("\n Could not initialize metadata cache.\n");
@ -481,7 +475,7 @@ int main(int argc, char* argv[]) {
return EXIT_FAILURE; return EXIT_FAILURE;
// Set Cues element attributes // Set Cues element attributes
libwebm::mkvmuxer::Cues* const cues = muxer_segment.GetCues(); mkvmuxer::Cues* const cues = muxer_segment.GetCues();
cues->set_output_block_number(output_cues_block_number); cues->set_output_block_number(output_cues_block_number);
if (cues_on_video_track && vid_track) if (cues_on_video_track && vid_track)
muxer_segment.CuesTrack(vid_track); muxer_segment.CuesTrack(vid_track);
@ -492,10 +486,10 @@ int main(int argc, char* argv[]) {
unsigned char* data = NULL; unsigned char* data = NULL;
int data_len = 0; int data_len = 0;
const libwebm::mkvparser::Cluster* cluster = parser_segment->GetFirst(); const mkvparser::Cluster* cluster = parser_segment->GetFirst();
while ((cluster != NULL) && !cluster->EOS()) { while ((cluster != NULL) && !cluster->EOS()) {
const libwebm::mkvparser::BlockEntry* block_entry; const mkvparser::BlockEntry* block_entry;
long status = cluster->GetFirst(block_entry); long status = cluster->GetFirst(block_entry);
@ -505,9 +499,9 @@ int main(int argc, char* argv[]) {
} }
while ((block_entry != NULL) && !block_entry->EOS()) { while ((block_entry != NULL) && !block_entry->EOS()) {
const libwebm::mkvparser::Block* const block = block_entry->GetBlock(); const mkvparser::Block* const block = block_entry->GetBlock();
const long long trackNum = block->GetTrackNumber(); const long long trackNum = block->GetTrackNumber();
const libwebm::mkvparser::Track* const parser_track = const mkvparser::Track* const parser_track =
parser_tracks->GetTrackByNumber(static_cast<unsigned long>(trackNum)); parser_tracks->GetTrackByNumber(static_cast<unsigned long>(trackNum));
// When |parser_track| is NULL, it means that the track number in the // When |parser_track| is NULL, it means that the track number in the
@ -530,7 +524,7 @@ int main(int argc, char* argv[]) {
const int frame_count = block->GetFrameCount(); const int frame_count = block->GetFrameCount();
for (int i = 0; i < frame_count; ++i) { for (int i = 0; i < frame_count; ++i) {
const libwebm::mkvparser::Block::Frame& frame = block->GetFrame(i); const mkvparser::Block::Frame& frame = block->GetFrame(i);
if (frame.len > data_len) { if (frame.len > data_len) {
delete[] data; delete[] data;
@ -543,7 +537,7 @@ int main(int argc, char* argv[]) {
if (frame.Read(&reader, data)) if (frame.Read(&reader, data))
return EXIT_FAILURE; return EXIT_FAILURE;
libwebm::mkvmuxer::Frame muxer_frame; mkvmuxer::Frame muxer_frame;
if (!muxer_frame.Init(data, frame.len)) if (!muxer_frame.Init(data, frame.len))
return EXIT_FAILURE; return EXIT_FAILURE;
muxer_frame.set_track_number(track_type == Track::kAudio ? aud_track : muxer_frame.set_track_number(track_type == Track::kAudio ? aud_track :

View File

@ -17,8 +17,6 @@
#include "mkvmuxer/mkvmuxer.h" #include "mkvmuxer/mkvmuxer.h"
#include "webvtt/vttreader.h" #include "webvtt/vttreader.h"
namespace libwebm {
SampleMuxerMetadata::SampleMuxerMetadata() : segment_(NULL) {} SampleMuxerMetadata::SampleMuxerMetadata() : segment_(NULL) {}
bool SampleMuxerMetadata::Init(mkvmuxer::Segment* segment) { bool SampleMuxerMetadata::Init(mkvmuxer::Segment* segment) {
@ -391,5 +389,3 @@ bool SampleMuxerMetadata::SortableCue::Write(mkvmuxer::Segment* segment) const {
muxer_frame.set_is_key(true); // All metadata frames are keyframes. muxer_frame.set_is_key(true); // All metadata frames are keyframes.
return segment->AddGenericFrame(&muxer_frame); return segment->AddGenericFrame(&muxer_frame);
} }
} // namespace libwebm

View File

@ -17,8 +17,6 @@
#include "webvtt/webvttparser.h" #include "webvtt/webvttparser.h"
namespace libwebm {
namespace mkvmuxer { namespace mkvmuxer {
class Chapter; class Chapter;
class Frame; class Frame;
@ -136,6 +134,4 @@ class SampleMuxerMetadata {
SampleMuxerMetadata& operator=(const SampleMuxerMetadata&); SampleMuxerMetadata& operator=(const SampleMuxerMetadata&);
}; };
} // namespace libwebm
#endif // SAMPLE_MUXER_METADATA_H_ // NOLINT #endif // SAMPLE_MUXER_METADATA_H_ // NOLINT

View File

@ -30,16 +30,15 @@
#pragma warning(disable : 4996) #pragma warning(disable : 4996)
#endif #endif
using libwebm::mkvmuxer::AudioTrack; using mkvmuxer::AudioTrack;
using libwebm::mkvmuxer::Chapter; using mkvmuxer::Chapter;
using libwebm::mkvmuxer::Frame; using mkvmuxer::Frame;
using libwebm::mkvmuxer::MkvWriter; using mkvmuxer::MkvWriter;
using libwebm::mkvmuxer::Segment; using mkvmuxer::Segment;
using libwebm::mkvmuxer::SegmentInfo; using mkvmuxer::SegmentInfo;
using libwebm::mkvmuxer::Track; using mkvmuxer::Track;
using libwebm::mkvmuxer::VideoTrack; using mkvmuxer::VideoTrack;
namespace libwebm {
namespace test { namespace test {
// Base class containing boiler plate stuff. // Base class containing boiler plate stuff.
@ -54,9 +53,10 @@ class MuxerTest : public testing::Test {
// are fatal, but the ASSERT_* gtest macros cannot be used in a constructor. // are fatal, but the ASSERT_* gtest macros cannot be used in a constructor.
void Init() { void Init() {
ASSERT_TRUE(GetTestDataDir().length() > 0); ASSERT_TRUE(GetTestDataDir().length() > 0);
filename_ = GetTempFileName(); filename_ = libwebm::GetTempFileName();
ASSERT_GT(filename_.length(), 0u); ASSERT_GT(filename_.length(), 0u);
temp_file_ = FilePtr(std::fopen(filename_.c_str(), "wb"), FILEDeleter()); temp_file_ = libwebm::FilePtr(std::fopen(filename_.c_str(), "wb"),
libwebm::FILEDeleter());
ASSERT_TRUE(temp_file_.get() != nullptr); ASSERT_TRUE(temp_file_.get() != nullptr);
writer_.reset(new MkvWriter(temp_file_.get())); writer_.reset(new MkvWriter(temp_file_.get()));
is_writer_open_ = true; is_writer_open_ = true;
@ -112,7 +112,7 @@ class MuxerTest : public testing::Test {
bool is_writer_open_ = false; bool is_writer_open_ = false;
Segment segment_; Segment segment_;
std::string filename_; std::string filename_;
FilePtr temp_file_; libwebm::FilePtr temp_file_;
std::uint8_t dummy_data_[kFrameLength]; std::uint8_t dummy_data_[kFrameLength];
}; };
@ -473,7 +473,7 @@ TEST_F(MuxerTest, CuesBeforeClusters) {
mkvparser::MkvReader reader; mkvparser::MkvReader reader;
ASSERT_EQ(0, reader.Open(filename_.c_str())); ASSERT_EQ(0, reader.Open(filename_.c_str()));
MkvWriter cues_writer; MkvWriter cues_writer;
std::string cues_filename = GetTempFileName(); std::string cues_filename = libwebm::GetTempFileName();
ASSERT_GT(cues_filename.length(), 0u); ASSERT_GT(cues_filename.length(), 0u);
cues_writer.Open(cues_filename.c_str()); cues_writer.Open(cues_filename.c_str());
EXPECT_TRUE(segment_.CopyAndMoveCuesBeforeClusters(&reader, &cues_writer)); EXPECT_TRUE(segment_.CopyAndMoveCuesBeforeClusters(&reader, &cues_writer));
@ -704,7 +704,6 @@ TEST_F(MuxerTest, AccurateClusterDurationTwoTracks) {
} }
} // namespace test } // namespace test
} // namespace libwebm
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);

View File

@ -18,21 +18,20 @@
#include "mkvparser/mkvreader.h" #include "mkvparser/mkvreader.h"
#include "testing/test_util.h" #include "testing/test_util.h"
using libwebm::mkvparser::AudioTrack; using mkvparser::AudioTrack;
using libwebm::mkvparser::Block; using mkvparser::Block;
using libwebm::mkvparser::BlockEntry; using mkvparser::BlockEntry;
using libwebm::mkvparser::BlockGroup; using mkvparser::BlockGroup;
using libwebm::mkvparser::Cluster; using mkvparser::Cluster;
using libwebm::mkvparser::CuePoint; using mkvparser::CuePoint;
using libwebm::mkvparser::Cues; using mkvparser::Cues;
using libwebm::mkvparser::MkvReader; using mkvparser::MkvReader;
using libwebm::mkvparser::Segment; using mkvparser::Segment;
using libwebm::mkvparser::SegmentInfo; using mkvparser::SegmentInfo;
using libwebm::mkvparser::Track; using mkvparser::Track;
using libwebm::mkvparser::Tracks; using mkvparser::Tracks;
using libwebm::mkvparser::VideoTrack; using mkvparser::VideoTrack;
namespace libwebm {
namespace test { namespace test {
// Base class containing boiler plate stuff. // Base class containing boiler plate stuff.
@ -664,7 +663,6 @@ TEST_F(ParserTest, StereoModeParsedCorrectly) {
} }
} // namespace test } // namespace test
} // namespace libwebm
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);

View File

@ -21,7 +21,6 @@
#include "common/libwebm_util.h" #include "common/libwebm_util.h"
namespace libwebm {
namespace test { namespace test {
std::string GetTestDataDir() { std::string GetTestDataDir() {
@ -39,8 +38,10 @@ bool CompareFiles(const std::string& file1, const std::string& file2) {
std::uint8_t buf1[kBlockSize] = {0}; std::uint8_t buf1[kBlockSize] = {0};
std::uint8_t buf2[kBlockSize] = {0}; std::uint8_t buf2[kBlockSize] = {0};
FilePtr f1 = FilePtr(std::fopen(file1.c_str(), "rb"), FILEDeleter()); libwebm::FilePtr f1 =
FilePtr f2 = FilePtr(std::fopen(file2.c_str(), "rb"), FILEDeleter()); libwebm::FilePtr(std::fopen(file1.c_str(), "rb"), libwebm::FILEDeleter());
libwebm::FilePtr f2 =
libwebm::FilePtr(std::fopen(file2.c_str(), "rb"), libwebm::FILEDeleter());
if (!f1.get() || !f2.get()) { if (!f1.get() || !f2.get()) {
// Files cannot match if one or both couldn't be opened. // Files cannot match if one or both couldn't be opened.
@ -60,4 +61,3 @@ bool CompareFiles(const std::string& file1, const std::string& file2) {
} }
} // namespace test } // namespace test
} // namespace libwebm

View File

@ -13,7 +13,6 @@
#include <cstddef> #include <cstddef>
#include <string> #include <string>
namespace libwebm {
namespace test { namespace test {
// constants for muxer and parser tests // constants for muxer and parser tests
@ -54,6 +53,5 @@ std::string GetTestFilePath(const std::string& name);
bool CompareFiles(const std::string& file1, const std::string& file2); bool CompareFiles(const std::string& file1, const std::string& file2);
} // namespace test } // namespace test
} // namespace libwebm
#endif // LIBWEBM_TESTING_TEST_UTIL_H_ #endif // LIBWEBM_TESTING_TEST_UTIL_H_

View File

@ -961,7 +961,7 @@ int main(int argc, const char* argv[]) {
} }
const char* const filename = argv[1]; const char* const filename = argv[1];
libwebm::mkvparser::MkvReader reader; mkvparser::MkvReader reader;
int e = reader.Open(filename); int e = reader.Open(filename);