Chromium Code Reviews| Index: media/filters/frame_processor.h |
| diff --git a/media/filters/frame_processor.h b/media/filters/frame_processor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..225533e917b61b27d552c2ba331b30e8758c98af |
| --- /dev/null |
| +++ b/media/filters/frame_processor.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_FILTERS_FRAME_PROCESSOR_H_ |
| +#define MEDIA_FILTERS_FRAME_PROCESSOR_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/callback_forward.h" |
| +#include "base/time/time.h" |
| +#include "media/base/media_export.h" |
| +#include "media/base/stream_parser.h" |
| +#include "media/filters/frame_processor_base.h" |
| + |
| +namespace media { |
| + |
| +// Helper class that implements Media Source Extension's coded frame processing |
| +// algorithm. |
| +class MEDIA_EXPORT FrameProcessor : public FrameProcessorBase { |
| + public: |
| + typedef base::Callback<void(base::TimeDelta)> UpdateDurationCB; |
| + explicit FrameProcessor(const UpdateDurationCB& update_duration_cb); |
| + virtual ~FrameProcessor(); |
| + |
| + // FrameProcessorBase implementation |
| + virtual void SetSequenceMode(bool sequence_mode) OVERRIDE; |
| + virtual void SetGroupStartTimestampIfInSequenceMode( |
| + base::TimeDelta timestamp_offset) OVERRIDE; |
| + virtual bool ProcessFrames(const StreamParser::BufferQueue& audio_buffers, |
| + const StreamParser::BufferQueue& video_buffers, |
| + const StreamParser::TextBufferQueueMap& text_map, |
| + base::TimeDelta append_window_start, |
| + base::TimeDelta append_window_end, |
| + bool* new_media_segment, |
| + base::TimeDelta* timestamp_offset) OVERRIDE; |
| + |
| + private: |
| + // Helper that processes one frame with the coded frame processing algorithm. |
| + // Returns false on error or true on success. |
| + bool ProcessFrame(scoped_refptr<StreamParserBuffer> frame, |
| + base::TimeDelta append_window_start, |
| + base::TimeDelta append_window_end, |
| + base::TimeDelta* timestamp_offset, |
| + bool* new_media_segment); |
| + |
| + // Sets the need random access point flag on all track buffers to true. |
| + void SetAllTrackBuffersNeedRandomAccessPoint(); |
| + |
| + // Tracks the MSE coded frame processing variable of same name. |
| + // Its value is meaningless if |group_start_timestamp_set_| is false. |
| + // |group_start_timestamp_set_| is initialized to false. |
| + base::TimeDelta group_start_timestamp_; |
| + bool group_start_timestamp_set_; |
|
acolwell GONE FROM CHROMIUM
2014/05/08 00:06:43
nit: Any reason not to use kNoTimestamp() to track
wolenetz
2014/05/08 02:35:28
None now. Done.
|
| + |
| + // Tracks the MSE coded frame processing variable of same name. It stores the |
| + // highest coded frame end timestamp across all coded frames in the current |
| + // coded frame group. It is set to 0 when the SourceBuffer object is created |
| + // and gets updated by ProcessFrames(). |
| + base::TimeDelta group_end_timestamp_; |
| + |
| + UpdateDurationCB update_duration_cb_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FrameProcessor); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_FILTERS_FRAME_PROCESSOR_H_ |