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

Side by Side Diff: media/base/stream_parser.h

Issue 10205004: Refactoring StreamParser & StreamParserHost interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/filters/chunk_demuxer.h » ('j') | media/filters/chunk_demuxer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_STREAM_PARSER_H_ 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_
6 #define MEDIA_BASE_STREAM_PARSER_H_ 6 #define MEDIA_BASE_STREAM_PARSER_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 class AudioDecoderConfig; 17 class AudioDecoderConfig;
18 class Buffer; 18 class Buffer;
19 class VideoDecoderConfig; 19 class VideoDecoderConfig;
20 20
21 // Provides callback methods for StreamParser to report information 21 // Provides callback methods for StreamParser to report information
22 // about the media stream. 22 // about the media stream.
23 class MEDIA_EXPORT StreamParserHost { 23 class MEDIA_EXPORT StreamParserHost {
24 public: 24 public:
25 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; 25 typedef std::deque<scoped_refptr<Buffer> > BufferQueue;
26 26
27 StreamParserHost(); 27 StreamParserHost();
28 virtual ~StreamParserHost(); 28 virtual ~StreamParserHost();
29 29
30 // A new audio decoder configuration was encountered. All audio buffers 30 // New audio and/or video decoder configurations were encountered. All audio
31 // after this call will be associated with this configuration. 31 // and video buffers after this call will be associated with these
32 virtual bool OnNewAudioConfig(const AudioDecoderConfig& config) = 0; 32 // configurations.
33 33 virtual bool OnNewConfigs(const AudioDecoderConfig& audio_config,
scherkus (not reviewing) 2012/04/24 01:40:04 what does true/false mean?
acolwell GONE FROM CHROMIUM 2012/04/24 16:25:55 Done.
34 // A new video decoder configuration was encountered. All video buffers 34 const VideoDecoderConfig& video_config) = 0;
35 // after this call will be associated with this configuration.
36 virtual bool OnNewVideoConfig(const VideoDecoderConfig& config) = 0;
37 35
38 // New audio buffers have been received. 36 // New audio buffers have been received.
39 virtual bool OnAudioBuffers(const BufferQueue& buffers) = 0; 37 virtual bool OnAudioBuffers(const BufferQueue& buffers) = 0;
40 38
41 // New video buffers have been received. 39 // New video buffers have been received.
42 virtual bool OnVideoBuffers(const BufferQueue& buffers) = 0; 40 virtual bool OnVideoBuffers(const BufferQueue& buffers) = 0;
43 41
44 private: 42 private:
45 DISALLOW_COPY_AND_ASSIGN(StreamParserHost); 43 DISALLOW_COPY_AND_ASSIGN(StreamParserHost);
46 }; 44 };
(...skipping 18 matching lines...) Expand all
65 // start time, and duration. 63 // start time, and duration.
66 virtual void Init(const InitCB& init_cb, StreamParserHost* host) = 0; 64 virtual void Init(const InitCB& init_cb, StreamParserHost* host) = 0;
67 65
68 // Called when a seek occurs. This flushes the current parser state 66 // Called when a seek occurs. This flushes the current parser state
69 // and puts the parser in a state where it can receive data for the new seek 67 // and puts the parser in a state where it can receive data for the new seek
70 // point. 68 // point.
71 virtual void Flush() = 0; 69 virtual void Flush() = 0;
72 70
73 // Called when there is new data to parse. 71 // Called when there is new data to parse.
74 // 72 //
75 // Returns < 0 if the parse fails. 73 // Returns true if the parse succeeds.
76 // Returns 0 if more data is needed. 74 virtual bool Parse(const uint8* buf, int size) = 0;
77 // Returning > 0 indicates success & the number of bytes parsed.
78 virtual int Parse(const uint8* buf, int size) = 0;
79 75
80 private: 76 private:
81 DISALLOW_COPY_AND_ASSIGN(StreamParser); 77 DISALLOW_COPY_AND_ASSIGN(StreamParser);
82 }; 78 };
83 79
84 } // namespace media 80 } // namespace media
85 81
86 #endif // MEDIA_BASE_STREAM_PARSER_H_ 82 #endif // MEDIA_BASE_STREAM_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/chunk_demuxer.h » ('j') | media/filters/chunk_demuxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698