| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> |
| 9 #include "media/filters/ffmpeg_glue.h" | 9 #include "media/filters/ffmpeg_glue.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 FFmpegURLProtocol* protocol_; | 49 FFmpegURLProtocol* protocol_; |
| 50 AVFormatContext* format_context_; | 50 AVFormatContext* format_context_; |
| 51 AVCodecContext* codec_context_; | 51 AVCodecContext* codec_context_; |
| 52 AVCodec* codec_; | 52 AVCodec* codec_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(AudioFileReader); | 54 DISALLOW_COPY_AND_ASSIGN(AudioFileReader); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class InMemoryDataReader : public FFmpegURLProtocol { | |
| 58 public: | |
| 59 // Ownership of |data| is not taken, instead it simply maintains | |
| 60 // a weak reference. | |
| 61 InMemoryDataReader(const char* data, int64 size); | |
| 62 | |
| 63 virtual int Read(int size, uint8* data); | |
| 64 virtual bool GetPosition(int64* position_out); | |
| 65 virtual bool SetPosition(int64 position); | |
| 66 virtual bool GetSize(int64* size_out); | |
| 67 virtual bool IsStreaming(); | |
| 68 | |
| 69 private: | |
| 70 const char* data_; | |
| 71 int64 size_; | |
| 72 int64 position_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(InMemoryDataReader); | |
| 75 }; | |
| 76 | |
| 77 } // namespace media | 57 } // namespace media |
| 78 | 58 |
| 79 #endif // MEDIA_FILTERS_AUDIO_FILE_READER_H_ | 59 #endif // MEDIA_FILTERS_AUDIO_FILE_READER_H_ |
| OLD | NEW |