Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: media/base/stream_parser.h

Issue 10134066: Replace StreamParserHost interface with callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make callbacks hold unretained references. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/stream_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/stream_parser.h
diff --git a/media/base/stream_parser.h b/media/base/stream_parser.h
index daeee4bb2d11510bb671d955475eb530873a63b2..2d71573226e8f20f301528ffe2beaab222bd401d 100644
--- a/media/base/stream_parser.h
+++ b/media/base/stream_parser.h
@@ -18,37 +18,11 @@ class AudioDecoderConfig;
class Buffer;
class VideoDecoderConfig;
-// Provides callback methods for StreamParser to report information
-// about the media stream.
-class MEDIA_EXPORT StreamParserHost {
- public:
- typedef std::deque<scoped_refptr<Buffer> > BufferQueue;
-
- StreamParserHost();
- virtual ~StreamParserHost();
-
- // New audio and/or video decoder configurations were encountered. All audio
- // and video buffers after this call will be associated with these
- // configurations.
- // Returns true if the new configurations are accepted.
- // Returns false if the new configurations are not supported and indicates
- // that a parsing error should be signalled.
- virtual bool OnNewConfigs(const AudioDecoderConfig& audio_config,
- const VideoDecoderConfig& video_config) = 0;
-
- // New audio buffers have been received.
- virtual bool OnAudioBuffers(const BufferQueue& buffers) = 0;
-
- // New video buffers have been received.
- virtual bool OnVideoBuffers(const BufferQueue& buffers) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(StreamParserHost);
-};
-
// Abstract interface for parsing media byte streams.
class MEDIA_EXPORT StreamParser {
public:
+ typedef std::deque<scoped_refptr<Buffer> > BufferQueue;
+
StreamParser();
virtual ~StreamParser();
@@ -60,11 +34,33 @@ class MEDIA_EXPORT StreamParser {
// value if the first parameter is true.
typedef base::Callback<void(bool, base::TimeDelta)> InitCB;
+ // Indicates when new stream configurations have been parsed.
+ // First parameter - The new audio configuration. If the config is not valid
+ // then it means that there isn't an audio stream.
+ // Second parameter - The new video configuration. If the config is not valid
+ // then it means that there isn't an audio stream.
+ // Return value - True if the new configurations are accepted.
+ // False if the new configurations are not supported
+ // and indicates that a parsing error should be signalled.
+ typedef base::Callback<bool(const AudioDecoderConfig&,
+ const VideoDecoderConfig&)> NewConfigCB;
+
+ // New stream buffers have been parsed.
+ // First parameter - A queue of newly parsed buffers.
+ // Return value - True indicates that the buffers are accepted.
+ // False if something was wrong with the buffers and a parsing
+ // error should be signalled.
+ typedef base::Callback<bool(const BufferQueue&)> NewBuffersCB;
+
+
// Initialize the parser with necessary callbacks. Must be called before any
// data is passed to Parse(). |init_cb| will be called once enough data has
// been parsed to determine the initial stream configurations, presentation
// start time, and duration.
- virtual void Init(const InitCB& init_cb, StreamParserHost* host) = 0;
+ virtual void Init(const InitCB& init_cb,
+ const NewConfigCB& config_cb,
+ const NewBuffersCB& audio_cb,
+ const NewBuffersCB& video_cb) = 0;
// Called when a seek occurs. This flushes the current parser state
// and puts the parser in a state where it can receive data for the new seek
« no previous file with comments | « no previous file | media/base/stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698