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

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

Issue 11137005: Make sure that DecodeAudioFileData() always returns an AudioBus of the exact length of the file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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/audio_file_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector>
9 #include "media/filters/ffmpeg_glue.h" 9 #include "media/filters/ffmpeg_glue.h"
10 10
(...skipping 19 matching lines...) Expand all
30 // channels(), duration(), and number_of_frames() methods can be called. 30 // channels(), duration(), and number_of_frames() methods can be called.
31 // It returns |true| on success. 31 // It returns |true| on success.
32 bool Open(); 32 bool Open();
33 void Close(); 33 void Close();
34 34
35 // After a call to Open(), attempts to fully fill |audio_bus| with decoded 35 // After a call to Open(), attempts to fully fill |audio_bus| with decoded
36 // audio data. Any unfilled frames will be zeroed out. 36 // audio data. Any unfilled frames will be zeroed out.
37 // |audio_data| must be of the same size as channels(). 37 // |audio_data| must be of the same size as channels().
38 // The audio data will be decoded as floating-point linear PCM with 38 // The audio data will be decoded as floating-point linear PCM with
39 // a nominal range of -1.0 -> +1.0. 39 // a nominal range of -1.0 -> +1.0.
40 // Returns |true| on success. 40 // Returns the number of sample-frames actually read which will always be
41 bool Read(AudioBus* audio_bus); 41 // <= audio_bus->frames()
42 // This corresponds to the actual file length.
DaleCurtis 2012/10/13 01:10:35 I'd remove this sentence since it's not correct as
43 int Read(AudioBus* audio_bus);
42 44
43 // These methods can be called once Open() has been called. 45 // These methods can be called once Open() has been called.
44 int channels() const; 46 int channels() const;
45 int sample_rate() const; 47 int sample_rate() const;
48
49 // Please note that duration() and number_of_frames() attempt to be accurate,
50 // but are only estimates. For some encoded formats, the actual duration
51 // of the file can only be determined once all the file data has been read.
52 // The Read() method returns the actual number of sample-frames.
46 base::TimeDelta duration() const; 53 base::TimeDelta duration() const;
47 int64 number_of_frames() const; 54 int64 number_of_frames() const;
48 55
49 private: 56 private:
50 FFmpegURLProtocol* protocol_; 57 FFmpegURLProtocol* protocol_;
51 AVFormatContext* format_context_; 58 AVFormatContext* format_context_;
52 AVCodecContext* codec_context_; 59 AVCodecContext* codec_context_;
53 int stream_index_; 60 int stream_index_;
54 61
55 DISALLOW_COPY_AND_ASSIGN(AudioFileReader); 62 DISALLOW_COPY_AND_ASSIGN(AudioFileReader);
56 }; 63 };
57 64
58 } // namespace media 65 } // namespace media
59 66
60 #endif // MEDIA_FILTERS_AUDIO_FILE_READER_H_ 67 #endif // MEDIA_FILTERS_AUDIO_FILE_READER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/audio_file_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698