| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // Filters are connected in a strongly typed manner, with downstream filters | 5 // Filters are connected in a strongly typed manner, with downstream filters |
| 6 // always reading data from upstream filters. Upstream filters have no clue | 6 // always reading data from upstream filters. Upstream filters have no clue |
| 7 // who is actually reading from them, and return the results via OnAssignment | 7 // who is actually reading from them, and return the results via OnAssignment |
| 8 // using the AssignableInterface<SomeBufferType> interface: | 8 // using the AssignableInterface<SomeBufferType> interface: |
| 9 // | 9 // |
| 10 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer | 10 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // use the scheduler to signal errors and shutdown playback. | 22 // use the scheduler to signal errors and shutdown playback. |
| 23 | 23 |
| 24 #ifndef MEDIA_BASE_FILTERS_H_ | 24 #ifndef MEDIA_BASE_FILTERS_H_ |
| 25 #define MEDIA_BASE_FILTERS_H_ | 25 #define MEDIA_BASE_FILTERS_H_ |
| 26 | 26 |
| 27 #include <limits> | 27 #include <limits> |
| 28 #include <string> | 28 #include <string> |
| 29 | 29 |
| 30 #include "base/logging.h" | 30 #include "base/logging.h" |
| 31 #include "base/ref_counted.h" | 31 #include "base/ref_counted.h" |
| 32 #include "base/task.h" |
| 32 #include "base/time.h" | 33 #include "base/time.h" |
| 33 #include "media/base/media_format.h" | 34 #include "media/base/media_format.h" |
| 34 | 35 |
| 35 namespace media { | 36 namespace media { |
| 36 | 37 |
| 37 template <class TBuffer> class Assignable; | 38 template <class TBuffer> class Assignable; |
| 38 class Buffer; | 39 class Buffer; |
| 39 class Decoder; | 40 class Decoder; |
| 40 class DemuxerStream; | 41 class DemuxerStream; |
| 41 class FilterHost; | 42 class FilterHost; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Returns the stream for the given index, NULL otherwise | 150 // Returns the stream for the given index, NULL otherwise |
| 150 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id) = 0; | 151 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id) = 0; |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 | 154 |
| 154 class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> { | 155 class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> { |
| 155 public: | 156 public: |
| 156 // Returns the MediaFormat for this filter. | 157 // Returns the MediaFormat for this filter. |
| 157 virtual const MediaFormat& media_format() = 0; | 158 virtual const MediaFormat& media_format() = 0; |
| 158 | 159 |
| 159 // Schedules a read and takes ownership of the given buffer. | 160 // Schedules a read. When the |read_callback| is called, the downstream |
| 160 virtual void Read(Assignable<Buffer>* buffer) = 0; | 161 // filter takes ownership of the buffer by AddRef()'ing the buffer. |
| 162 virtual void Read(Callback1<Buffer*>::Type* read_callback) = 0; |
| 161 | 163 |
| 162 // Given a class that supports the |Interface| and a related static method | 164 // Given a class that supports the |Interface| and a related static method |
| 163 // interface_id(), which returns a const char*, this method returns true if | 165 // interface_id(), which returns a const char*, this method returns true if |
| 164 // the class returns an interface pointer and assigns the pointer to | 166 // the class returns an interface pointer and assigns the pointer to |
| 165 // |interface_out|. Otherwise this method returns false. | 167 // |interface_out|. Otherwise this method returns false. |
| 166 template <class Interface> | 168 template <class Interface> |
| 167 bool QueryInterface(scoped_refptr<Interface>* interface_out) { | 169 bool QueryInterface(scoped_refptr<Interface>* interface_out) { |
| 168 void* i = QueryInterface(Interface::interface_id()); | 170 void* i = QueryInterface(Interface::interface_id()); |
| 169 *interface_out = reinterpret_cast<Interface*>(i); | 171 *interface_out = reinterpret_cast<Interface*>(i); |
| 170 return (NULL != i); | 172 return (NULL != i); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // Initializes this filter, returns true if successful, false otherwise. | 256 // Initializes this filter, returns true if successful, false otherwise. |
| 255 virtual bool Initialize(AudioDecoder* decoder) = 0; | 257 virtual bool Initialize(AudioDecoder* decoder) = 0; |
| 256 | 258 |
| 257 // Sets the output volume. | 259 // Sets the output volume. |
| 258 virtual void SetVolume(float volume) = 0; | 260 virtual void SetVolume(float volume) = 0; |
| 259 }; | 261 }; |
| 260 | 262 |
| 261 } // namespace media | 263 } // namespace media |
| 262 | 264 |
| 263 #endif // MEDIA_BASE_FILTERS_H_ | 265 #endif // MEDIA_BASE_FILTERS_H_ |
| OLD | NEW |