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

Unified Diff: media/filters/audio_file_reader.h

Issue 2655783004: Decode entire in-memory file for WebAudio (Closed)
Patch Set: Use int, not size_t. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/audio_decoder.cc ('k') | media/filters/audio_file_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_file_reader.h
diff --git a/media/filters/audio_file_reader.h b/media/filters/audio_file_reader.h
index 1e42abd7b018fde25b2d6fce976fa26807de0b63..653dfa78ee4acc9bfc124388e2b5b5bce5767e4c 100644
--- a/media/filters/audio_file_reader.h
+++ b/media/filters/audio_file_reader.h
@@ -6,6 +6,7 @@
#define MEDIA_FILTERS_AUDIO_FILE_READER_H_
#include <memory>
+#include <vector>
#include "base/macros.h"
#include "media/base/audio_codecs.h"
@@ -38,19 +39,24 @@ class MEDIA_EXPORT AudioFileReader {
bool Open();
void Close();
- // After a call to Open(), attempts to fully fill |audio_bus| with decoded
- // audio data. Any unfilled frames will be zeroed out.
- // |audio_data| must be of the same size as channels().
- // The audio data will be decoded as floating-point linear PCM with
- // a nominal range of -1.0 -> +1.0.
- // Returns the number of sample-frames actually read which will always be
- // <= audio_bus->frames()
- int Read(AudioBus* audio_bus);
+ // After a call to Open(), attempts to decode the entire data,
+ // updating |decodedAudioPackets| with each decoded packet in order.
+ // The caller must convert these packets into one complete set of
+ // decoded audio data. The audio data will be decoded as
+ // floating-point linear PCM with a nominal range of -1.0 -> +1.0.
+ // Returns the number of sample-frames actually read which will
+ // always be the total size of all the frames in
+ // |decodedAudioPackets|.
+ int Read(std::vector<std::unique_ptr<AudioBus>>* decoded_audio_packets);
// These methods can be called once Open() has been called.
int channels() const { return channels_; }
int sample_rate() const { return sample_rate_; }
+ // Returns true if (an estimated) duration of the audio data is
+ // known. Must be called after Open();
+ bool HasKnownDuration() const;
+
// Please note that GetDuration() and GetNumberOfFrames() attempt to be
// accurate, but are only estimates. For some encoded formats, the actual
// duration of the file can only be determined once all the file data has been
« no previous file with comments | « content/renderer/media/audio_decoder.cc ('k') | media/filters/audio_file_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698