| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_AUDIO_FILE_READER_H_ | 5 #ifndef MEDIA_FILTERS_AUDIO_FILE_READER_H_ |
| 6 #define MEDIA_FILTERS_AUDIO_FILE_READER_H_ | 6 #define MEDIA_FILTERS_AUDIO_FILE_READER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include "base/basictypes.h" |
| 9 #include "media/filters/ffmpeg_glue.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/base/media_export.h" |
| 10 | 11 |
| 11 struct AVCodecContext; | 12 struct AVCodecContext; |
| 12 struct AVFormatContext; | |
| 13 | 13 |
| 14 namespace base { class TimeDelta; } | 14 namespace base { class TimeDelta; } |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 class AudioBus; | 18 class AudioBus; |
| 19 class FFmpegGlue; |
| 19 class FFmpegURLProtocol; | 20 class FFmpegURLProtocol; |
| 20 | 21 |
| 21 class MEDIA_EXPORT AudioFileReader { | 22 class MEDIA_EXPORT AudioFileReader { |
| 22 public: | 23 public: |
| 23 // Audio file data will be read using the given protocol. | 24 // Audio file data will be read using the given protocol. |
| 24 // The AudioFileReader does not take ownership of |protocol| and | 25 // The AudioFileReader does not take ownership of |protocol| and |
| 25 // simply maintains a weak reference to it. | 26 // simply maintains a weak reference to it. |
| 26 explicit AudioFileReader(FFmpegURLProtocol* protocol); | 27 explicit AudioFileReader(FFmpegURLProtocol* protocol); |
| 27 virtual ~AudioFileReader(); | 28 virtual ~AudioFileReader(); |
| 28 | 29 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 int sample_rate() const; | 47 int sample_rate() const; |
| 47 | 48 |
| 48 // Please note that duration() and number_of_frames() attempt to be accurate, | 49 // Please note that duration() and number_of_frames() attempt to be accurate, |
| 49 // but are only estimates. For some encoded formats, the actual duration | 50 // but are only estimates. For some encoded formats, the actual duration |
| 50 // of the file can only be determined once all the file data has been read. | 51 // of the file can only be determined once all the file data has been read. |
| 51 // The Read() method returns the actual number of sample-frames it has read. | 52 // The Read() method returns the actual number of sample-frames it has read. |
| 52 base::TimeDelta duration() const; | 53 base::TimeDelta duration() const; |
| 53 int64 number_of_frames() const; | 54 int64 number_of_frames() const; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 FFmpegURLProtocol* protocol_; | 57 scoped_ptr<FFmpegGlue> glue_; |
| 57 AVFormatContext* format_context_; | |
| 58 AVCodecContext* codec_context_; | 58 AVCodecContext* codec_context_; |
| 59 int stream_index_; | 59 int stream_index_; |
| 60 FFmpegURLProtocol* protocol_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(AudioFileReader); | 62 DISALLOW_COPY_AND_ASSIGN(AudioFileReader); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace media | 65 } // namespace media |
| 65 | 66 |
| 66 #endif // MEDIA_FILTERS_AUDIO_FILE_READER_H_ | 67 #endif // MEDIA_FILTERS_AUDIO_FILE_READER_H_ |
| OLD | NEW |