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

Side by Side Diff: media/filters/chunk_demuxer.h

Issue 10066019: Implement sourceAddId() & sourceRemoveId() (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.cc » ('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_FILTERS_CHUNK_DEMUXER_H_ 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_
6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string>
9 10
10 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
11 #include "media/base/byte_queue.h" 12 #include "media/base/byte_queue.h"
12 #include "media/base/demuxer.h" 13 #include "media/base/demuxer.h"
13 #include "media/base/stream_parser.h" 14 #include "media/base/stream_parser.h"
14 15
15 namespace media { 16 namespace media {
16 17
17 class ChunkDemuxerClient; 18 class ChunkDemuxerClient;
18 class ChunkDemuxerStream; 19 class ChunkDemuxerStream;
19 class FFmpegURLProtocol; 20 class FFmpegURLProtocol;
20 21
21 // Demuxer implementation that allows chunks of media data to be passed 22 // Demuxer implementation that allows chunks of media data to be passed
22 // from JavaScript to the media stack. 23 // from JavaScript to the media stack.
23 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost { 24 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost {
24 public: 25 public:
26 // Status codes for AddId() method.
27 enum AddIdStatus {
28 AisNoError, // ID added w/o error.
scherkus (not reviewing) 2012/04/12 20:58:32 I'm calling silliness on the naming here! 1) Why
acolwell GONE FROM CHROMIUM 2012/04/12 22:43:12 Done.
29 AisNotSupported, // Type specified is not supported.
30 AisReachedIdLimit, // Reached ID limit. We can't handle any more IDs.
31 };
32
25 explicit ChunkDemuxer(ChunkDemuxerClient* client); 33 explicit ChunkDemuxer(ChunkDemuxerClient* client);
26 virtual ~ChunkDemuxer(); 34 virtual ~ChunkDemuxer();
27 35
28 // Demuxer implementation. 36 // Demuxer implementation.
29 virtual void Initialize(DemuxerHost* host, 37 virtual void Initialize(DemuxerHost* host,
30 const PipelineStatusCB& cb) OVERRIDE; 38 const PipelineStatusCB& cb) OVERRIDE;
31 virtual void Stop(const base::Closure& callback) OVERRIDE; 39 virtual void Stop(const base::Closure& callback) OVERRIDE;
32 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; 40 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE;
33 virtual void OnAudioRendererDisabled() OVERRIDE; 41 virtual void OnAudioRendererDisabled() OVERRIDE;
34 virtual scoped_refptr<DemuxerStream> GetStream( 42 virtual scoped_refptr<DemuxerStream> GetStream(
35 DemuxerStream::Type type) OVERRIDE; 43 DemuxerStream::Type type) OVERRIDE;
36 virtual base::TimeDelta GetStartTime() const OVERRIDE; 44 virtual base::TimeDelta GetStartTime() const OVERRIDE;
37 virtual int GetBitrate() OVERRIDE; 45 virtual int GetBitrate() OVERRIDE;
38 virtual bool IsLocalSource() OVERRIDE; 46 virtual bool IsLocalSource() OVERRIDE;
39 virtual bool IsSeekable() OVERRIDE; 47 virtual bool IsSeekable() OVERRIDE;
40 48
41 // Methods used by an external object to control this demuxer. 49 // Methods used by an external object to control this demuxer.
42 void FlushData(); 50 void FlushData();
43 51
44 // Appends media data to the stream. Returns false if this method 52 // Appends media data to the stream. Returns false if this method
45 // is called in an invalid state. 53 // is called in an invalid state.
scherkus (not reviewing) 2012/04/12 20:58:32 docs need updating
acolwell GONE FROM CHROMIUM 2012/04/12 22:43:12 Done.
46 bool AppendData(const uint8* data, size_t length); 54 AddIdStatus AddId(const std::string& id, const std::string& type);
55 void RemoveId(const std::string& id);
56 bool AppendData(const std::string& id, const uint8* data, size_t length);
47 void EndOfStream(PipelineStatus status); 57 void EndOfStream(PipelineStatus status);
48 bool HasEnded(); 58 bool HasEnded();
49 void Shutdown(); 59 void Shutdown();
50 60
51 private: 61 private:
52 enum State { 62 enum State {
53 WAITING_FOR_INIT, 63 WAITING_FOR_INIT,
54 INITIALIZING, 64 INITIALIZING,
55 INITIALIZED, 65 INITIALIZED,
56 ENDED, 66 ENDED,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 base::TimeDelta duration_; 98 base::TimeDelta duration_;
89 99
90 scoped_ptr<StreamParser> stream_parser_; 100 scoped_ptr<StreamParser> stream_parser_;
91 101
92 // Should a Seek() call wait for more data before calling the 102 // Should a Seek() call wait for more data before calling the
93 // callback. 103 // callback.
94 bool seek_waits_for_data_; 104 bool seek_waits_for_data_;
95 105
96 ByteQueue byte_queue_; 106 ByteQueue byte_queue_;
97 107
108 // TODO(acolwell): Remove this when fixing http://crbug.com/122909 .
109 std::string source_id_;
110
98 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 111 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
99 }; 112 };
100 113
101 } // namespace media 114 } // namespace media
102 115
103 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 116 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/chunk_demuxer.cc » ('j') | media/filters/chunk_demuxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698