From 4a39a0fc98a365f73c1a49e1c936ee6fbb8c04eb Mon Sep 17 00:00:00 2001 From: Thomas Inskip Date: Wed, 16 Apr 2014 16:22:31 -0700 Subject: [PATCH] Renamed mp2t::MediaParser to mp2t::Mp2tMediaParser, removed filters namespace. Change-Id: Ib4de2863d5e746b32703d49e721473a2ff6c8de7 --- media/base/demuxer.cc | 2 +- media/filters/h264_bit_reader.cc | 2 - media/filters/h264_bit_reader.h | 2 - media/filters/h264_bit_reader_unittest.cc | 2 - media/filters/h264_parser.cc | 2 - media/filters/h264_parser.h | 2 - media/filters/h264_parser_unittest.cc | 2 - media/formats/mp2t/es_parser_h264.cc | 6 --- media/formats/mp2t/es_parser_h264.h | 12 +++-- media/formats/mp2t/es_parser_h264_unittest.cc | 6 --- media/formats/mp2t/mp2t_media_parser.cc | 44 +++++++++---------- media/formats/mp2t/mp2t_media_parser.h | 10 ++--- .../mp2t/mp2t_media_parser_unittest.cc | 4 +- 13 files changed, 35 insertions(+), 61 deletions(-) diff --git a/media/base/demuxer.cc b/media/base/demuxer.cc index 8bbce8053f..9a8ba92771 100644 --- a/media/base/demuxer.cc +++ b/media/base/demuxer.cc @@ -60,7 +60,7 @@ Status Demuxer::Initialize() { parser_.reset(new mp4::MP4MediaParser()); break; case CONTAINER_MPEG2TS: - parser_.reset(new mp2t::MediaParser()); + parser_.reset(new mp2t::Mp2tMediaParser()); break; default: NOTIMPLEMENTED(); diff --git a/media/filters/h264_bit_reader.cc b/media/filters/h264_bit_reader.cc index 064a277933..9894d97897 100644 --- a/media/filters/h264_bit_reader.cc +++ b/media/filters/h264_bit_reader.cc @@ -6,7 +6,6 @@ #include "media/filters/h264_bit_reader.h" namespace media { -namespace filters { H264BitReader::H264BitReader() : data_(NULL), @@ -111,5 +110,4 @@ size_t H264BitReader::NumEmulationPreventionBytesRead() { return emulation_prevention_bytes_; } -} // namespace filters } // namespace media diff --git a/media/filters/h264_bit_reader.h b/media/filters/h264_bit_reader.h index 0f517c42dd..de65886a1b 100644 --- a/media/filters/h264_bit_reader.h +++ b/media/filters/h264_bit_reader.h @@ -12,7 +12,6 @@ #include "base/basictypes.h" namespace media { -namespace filters { // A class to provide bit-granularity reading of H.264 streams. // This is not a generic bit reader class, as it takes into account @@ -74,7 +73,6 @@ class H264BitReader { DISALLOW_COPY_AND_ASSIGN(H264BitReader); }; -} // namespace filters } // namespace media #endif // MEDIA_FILTERS_H264_BIT_READER_H_ diff --git a/media/filters/h264_bit_reader_unittest.cc b/media/filters/h264_bit_reader_unittest.cc index 8bd16c11d1..e12e75ebcd 100644 --- a/media/filters/h264_bit_reader_unittest.cc +++ b/media/filters/h264_bit_reader_unittest.cc @@ -6,7 +6,6 @@ #include "testing/gtest/include/gtest/gtest.h" namespace media { -namespace filters { TEST(H264BitReaderTest, ReadStreamWithoutEscapeAndTrailingZeroBytes) { H264BitReader reader; @@ -71,5 +70,4 @@ TEST(H264BitReaderTest, StopBitOccupyFullByte) { EXPECT_FALSE(reader.HasMoreRBSPData()); } -} // namespace filters } // namespace media diff --git a/media/filters/h264_parser.cc b/media/filters/h264_parser.cc index 56d7e438f3..4cdc695933 100644 --- a/media/filters/h264_parser.cc +++ b/media/filters/h264_parser.cc @@ -9,7 +9,6 @@ #include "media/filters/h264_parser.h" namespace media { -namespace filters { bool H264SliceHeader::IsPSlice() const { return (slice_type % 5 == kPSlice); @@ -1262,5 +1261,4 @@ H264Parser::Result H264Parser::ParseSEI(H264SEIMessage* sei_msg) { return kOk; } -} // namespace filters } // namespace media diff --git a/media/filters/h264_parser.h b/media/filters/h264_parser.h index 9213612116..d9d5223f6a 100644 --- a/media/filters/h264_parser.h +++ b/media/filters/h264_parser.h @@ -15,7 +15,6 @@ #include "media/filters/h264_bit_reader.h" namespace media { -namespace filters { // For explanations of each struct and its members, see H.264 specification // at http://www.itu.int/rec/T-REC-H.264. @@ -394,7 +393,6 @@ class H264Parser { DISALLOW_COPY_AND_ASSIGN(H264Parser); }; -} // namespace filters } // namespace media #endif // MEDIA_FILTERS_H264_PARSER_H_ diff --git a/media/filters/h264_parser_unittest.cc b/media/filters/h264_parser_unittest.cc index f44e9e51f4..57a9501bd1 100644 --- a/media/filters/h264_parser_unittest.cc +++ b/media/filters/h264_parser_unittest.cc @@ -12,7 +12,6 @@ #include "testing/gtest/include/gtest/gtest.h" namespace media { -namespace filters { TEST(H264ParserTest, StreamFileParsing) { base::FilePath file_path = GetTestDataFilePath("test-25fps.h264"); @@ -70,5 +69,4 @@ TEST(H264ParserTest, StreamFileParsing) { } } -} // namespace filters } // namespace media diff --git a/media/formats/mp2t/es_parser_h264.cc b/media/formats/mp2t/es_parser_h264.cc index d5d0edc52c..c0aca48c92 100644 --- a/media/formats/mp2t/es_parser_h264.cc +++ b/media/formats/mp2t/es_parser_h264.cc @@ -14,12 +14,6 @@ #include "media/filters/h264_parser.h" #include "media/formats/mp2t/mp2t_common.h" -using media::filters::H264Parser; -using media::filters::H264PPS; -using media::filters::H264SliceHeader; -using media::filters::H264SPS; -using media::filters::H264NALU; - namespace media { namespace mp2t { diff --git a/media/formats/mp2t/es_parser_h264.h b/media/formats/mp2t/es_parser_h264.h index c5ff51d6ea..11bb8c4393 100644 --- a/media/formats/mp2t/es_parser_h264.h +++ b/media/formats/mp2t/es_parser_h264.h @@ -15,13 +15,11 @@ #include "media/formats/mp2t/es_parser.h" namespace media { -class OffsetByteQueue; -class VideoStreamInfo; -namespace filters { class H264Parser; +class OffsetByteQueue; struct H264SPS; -} // namespace filters + } // namespace media namespace media { @@ -39,7 +37,7 @@ class EsParserH264 : public EsParser { const EmitSampleCB& emit_sample_cb); virtual ~EsParserH264(); - // EsParser implementation. + // EsParser implementation overrides. virtual bool Parse(const uint8* buf, int size, int64 pts, int64 dts) OVERRIDE; virtual void Flush() OVERRIDE; virtual void Reset() OVERRIDE; @@ -68,7 +66,7 @@ class EsParserH264 : public EsParser { // Update the video decoder config based on an H264 SPS. // Return true if successful. - bool UpdateVideoDecoderConfig(const filters::H264SPS* sps); + bool UpdateVideoDecoderConfig(const H264SPS* sps); // Callbacks to pass the stream configuration and the frames. NewStreamInfoCB new_stream_info_cb_; @@ -81,7 +79,7 @@ class EsParserH264 : public EsParser { // H264 parser state. // - |current_access_unit_pos_| is pointing to an annexB syncword // representing the first NALU of an H264 access unit. - scoped_ptr h264_parser_; + scoped_ptr h264_parser_; int64 current_access_unit_pos_; int64 next_access_unit_pos_; diff --git a/media/formats/mp2t/es_parser_h264_unittest.cc b/media/formats/mp2t/es_parser_h264_unittest.cc index 69749beb7b..ae06f89218 100644 --- a/media/formats/mp2t/es_parser_h264_unittest.cc +++ b/media/formats/mp2t/es_parser_h264_unittest.cc @@ -17,12 +17,6 @@ #include "media/test/test_data_util.h" #include "testing/gtest/include/gtest/gtest.h" -using media::filters::H264Parser; -using media::filters::H264PPS; -using media::filters::H264SliceHeader; -using media::filters::H264SPS; -using media::filters::H264NALU; - namespace media { class VideoStreamInfo; diff --git a/media/formats/mp2t/mp2t_media_parser.cc b/media/formats/mp2t/mp2t_media_parser.cc index 67acc70bdb..100ef35080 100644 --- a/media/formats/mp2t/mp2t_media_parser.cc +++ b/media/formats/mp2t/mp2t_media_parser.cc @@ -108,7 +108,7 @@ bool PidState::PushTsPacket(const TsPacket& ts_packet) { ts_packet.payload_size()); // At the minimum, when parsing failed, auto reset the section parser. - // Components that use the MediaParser can take further action if needed. + // Components that use the Mp2tMediaParser can take further action if needed. if (!status) { DVLOG(1) << "Parsing failed for pid = " << pid_; ResetState(); @@ -143,16 +143,16 @@ void PidState::ResetState() { continuity_counter_ = -1; } -MediaParser::MediaParser() +Mp2tMediaParser::Mp2tMediaParser() : sbr_in_mimetype_(false), is_initialized_(false) { } -MediaParser::~MediaParser() { +Mp2tMediaParser::~Mp2tMediaParser() { STLDeleteValues(&pids_); } -void MediaParser::Init( +void Mp2tMediaParser::Init( const InitCB& init_cb, const NewSampleCB& new_sample_cb, const NeedKeyCB& need_key_cb) { @@ -167,8 +167,8 @@ void MediaParser::Init( need_key_cb_ = need_key_cb; } -void MediaParser::Flush() { - DVLOG(1) << "MediaParser::Flush"; +void Mp2tMediaParser::Flush() { + DVLOG(1) << "Mp2tMediaParser::Flush"; // Flush the buffers and reset the pids. for (std::map::iterator it = pids_.begin(); @@ -185,8 +185,8 @@ void MediaParser::Flush() { ts_byte_queue_.Reset(); } -bool MediaParser::Parse(const uint8* buf, int size) { - DVLOG(1) << "MediaParser::Parse size=" << size; +bool Mp2tMediaParser::Parse(const uint8* buf, int size) { + DVLOG(1) << "Mp2tMediaParser::Parse size=" << size; // Add the data to the parser state. ts_byte_queue_.Push(buf, size); @@ -225,7 +225,7 @@ bool MediaParser::Parse(const uint8* buf, int size) { // Create the PAT state here if needed. scoped_ptr pat_section_parser( new TsSectionPat( - base::Bind(&MediaParser::RegisterPmt, + base::Bind(&Mp2tMediaParser::RegisterPmt, base::Unretained(this)))); scoped_ptr pat_pid_state( new PidState(ts_packet->pid(), PidState::kPidPat, @@ -251,7 +251,7 @@ bool MediaParser::Parse(const uint8* buf, int size) { return EmitRemainingSamples(); } -void MediaParser::RegisterPmt(int program_number, int pmt_pid) { +void Mp2tMediaParser::RegisterPmt(int program_number, int pmt_pid) { DVLOG(1) << "RegisterPmt:" << " program_number=" << program_number << " pmt_pid=" << pmt_pid; @@ -271,7 +271,7 @@ void MediaParser::RegisterPmt(int program_number, int pmt_pid) { DVLOG(1) << "Create a new PMT parser"; scoped_ptr pmt_section_parser( new TsSectionPmt( - base::Bind(&MediaParser::RegisterPes, + base::Bind(&Mp2tMediaParser::RegisterPes, base::Unretained(this), pmt_pid))); scoped_ptr pmt_pid_state( new PidState(pmt_pid, PidState::kPidPmt, pmt_section_parser.Pass())); @@ -279,7 +279,7 @@ void MediaParser::RegisterPmt(int program_number, int pmt_pid) { pids_.insert(std::pair(pmt_pid, pmt_pid_state.release())); } -void MediaParser::RegisterPes(int pmt_pid, +void Mp2tMediaParser::RegisterPes(int pmt_pid, int pes_pid, int stream_type) { // TODO(damienv): check there is no mismatch if the entry already exists. @@ -297,17 +297,17 @@ void MediaParser::RegisterPes(int pmt_pid, es_parser.reset( new EsParserH264( pes_pid, - base::Bind(&MediaParser::OnNewStreamInfo, + base::Bind(&Mp2tMediaParser::OnNewStreamInfo, base::Unretained(this)), - base::Bind(&MediaParser::OnEmitSample, + base::Bind(&Mp2tMediaParser::OnEmitSample, base::Unretained(this)))); } else if (stream_type == kStreamTypeAAC) { es_parser.reset( new EsParserAdts( pes_pid, - base::Bind(&MediaParser::OnNewStreamInfo, + base::Bind(&Mp2tMediaParser::OnNewStreamInfo, base::Unretained(this)), - base::Bind(&MediaParser::OnEmitSample, + base::Bind(&Mp2tMediaParser::OnEmitSample, base::Unretained(this)), sbr_in_mimetype_)); is_audio = true; @@ -327,7 +327,7 @@ void MediaParser::RegisterPes(int pmt_pid, pids_.insert(std::pair(pes_pid, pes_pid_state.release())); } -void MediaParser::OnNewStreamInfo( +void Mp2tMediaParser::OnNewStreamInfo( scoped_refptr& new_stream_info) { DCHECK(new_stream_info); DVLOG(1) << "OnVideoConfigChanged for pid=" << new_stream_info->track_id(); @@ -346,7 +346,7 @@ void MediaParser::OnNewStreamInfo( FinishInitializationIfNeeded(); } -bool MediaParser::FinishInitializationIfNeeded() { +bool Mp2tMediaParser::FinishInitializationIfNeeded() { // Nothing to be done if already initialized. if (is_initialized_) return true; @@ -376,8 +376,8 @@ bool MediaParser::FinishInitializationIfNeeded() { return true; } -void MediaParser::OnEmitSample(uint32 pes_pid, - scoped_refptr& new_sample) { +void Mp2tMediaParser::OnEmitSample(uint32 pes_pid, + scoped_refptr& new_sample) { DCHECK(new_sample); DVLOG(LOG_LEVEL_ES) << "OnEmitSample: " @@ -400,8 +400,8 @@ void MediaParser::OnEmitSample(uint32 pes_pid, pid_state->second->sample_queue().push_back(new_sample); } -bool MediaParser::EmitRemainingSamples() { - DVLOG(LOG_LEVEL_ES) << "mp2t::MediaParser::EmitRemainingBuffers"; +bool Mp2tMediaParser::EmitRemainingSamples() { + DVLOG(LOG_LEVEL_ES) << "Mp2tMediaParser::EmitRemainingBuffers"; // No buffer should be sent until fully initialized. if (!is_initialized_) diff --git a/media/formats/mp2t/mp2t_media_parser.h b/media/formats/mp2t/mp2t_media_parser.h index c9be3b9d53..4ef2b38e21 100644 --- a/media/formats/mp2t/mp2t_media_parser.h +++ b/media/formats/mp2t/mp2t_media_parser.h @@ -26,12 +26,12 @@ class TsSection; typedef std::deque > SampleQueue; -class MediaParser : public media::MediaParser { +class Mp2tMediaParser : public MediaParser { public: - explicit MediaParser(); - virtual ~MediaParser(); + explicit Mp2tMediaParser(); + virtual ~Mp2tMediaParser(); - // media::MediaParser implementation. + // MediaParser implementation overrides. virtual void Init(const InitCB& init_cb, const NewSampleCB& new_sample_cb, const NeedKeyCB& need_key_cb) OVERRIDE; @@ -87,7 +87,7 @@ class MediaParser : public media::MediaParser { // Whether |init_cb_| has been invoked. bool is_initialized_; - DISALLOW_COPY_AND_ASSIGN(MediaParser); + DISALLOW_COPY_AND_ASSIGN(Mp2tMediaParser); }; } // namespace mp2t diff --git a/media/formats/mp2t/mp2t_media_parser_unittest.cc b/media/formats/mp2t/mp2t_media_parser_unittest.cc index 4ab4a43398..6d4e64d620 100644 --- a/media/formats/mp2t/mp2t_media_parser_unittest.cc +++ b/media/formats/mp2t/mp2t_media_parser_unittest.cc @@ -28,13 +28,13 @@ class Mp2tMediaParserTest : public testing::Test { video_frame_count_(0), video_min_dts_(kNoTimestamp), video_max_dts_(kNoTimestamp) { - parser_.reset(new MediaParser()); + parser_.reset(new Mp2tMediaParser()); } protected: typedef std::map > StreamMap; - scoped_ptr parser_; + scoped_ptr parser_; StreamMap stream_map_; int audio_frame_count_; int video_frame_count_;