OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // AudioBuffer. | 45 // AudioBuffer. |
46 | 46 |
47 class AsyncAudioDecoder { | 47 class AsyncAudioDecoder { |
48 DISALLOW_NEW(); | 48 DISALLOW_NEW(); |
49 WTF_MAKE_NONCOPYABLE(AsyncAudioDecoder); | 49 WTF_MAKE_NONCOPYABLE(AsyncAudioDecoder); |
50 | 50 |
51 public: | 51 public: |
52 AsyncAudioDecoder(){}; | 52 AsyncAudioDecoder(){}; |
53 ~AsyncAudioDecoder(){}; | 53 ~AsyncAudioDecoder(){}; |
54 | 54 |
55 // Must be called on the main thread. |decodeAsync| and callees must not modi
fy any of the | 55 // Must be called on the main thread. |decodeAsync| and callees must not |
56 // parameters except |audioData|. They are used to associate this decoding in
stance with the | 56 // modify any of the parameters except |audioData|. They are used to |
57 // caller to process the decoding appropriately when finished. | 57 // associate this decoding instance with the caller to process the decoding |
| 58 // appropriately when finished. |
58 void decodeAsync(DOMArrayBuffer* audioData, | 59 void decodeAsync(DOMArrayBuffer* audioData, |
59 float sampleRate, | 60 float sampleRate, |
60 AudioBufferCallback* successCallback, | 61 AudioBufferCallback* successCallback, |
61 AudioBufferCallback* errorCallback, | 62 AudioBufferCallback* errorCallback, |
62 ScriptPromiseResolver*, | 63 ScriptPromiseResolver*, |
63 BaseAudioContext*); | 64 BaseAudioContext*); |
64 | 65 |
65 private: | 66 private: |
66 AudioBuffer* createAudioBufferFromAudioBus(AudioBus*); | 67 AudioBuffer* createAudioBufferFromAudioBus(AudioBus*); |
67 static void decodeOnBackgroundThread(DOMArrayBuffer* audioData, | 68 static void decodeOnBackgroundThread(DOMArrayBuffer* audioData, |
68 float sampleRate, | 69 float sampleRate, |
69 AudioBufferCallback* successCallback, | 70 AudioBufferCallback* successCallback, |
70 AudioBufferCallback* errorCallback, | 71 AudioBufferCallback* errorCallback, |
71 ScriptPromiseResolver*, | 72 ScriptPromiseResolver*, |
72 BaseAudioContext*); | 73 BaseAudioContext*); |
73 static void notifyComplete(DOMArrayBuffer* audioData, | 74 static void notifyComplete(DOMArrayBuffer* audioData, |
74 AudioBufferCallback* successCallback, | 75 AudioBufferCallback* successCallback, |
75 AudioBufferCallback* errorCallback, | 76 AudioBufferCallback* errorCallback, |
76 AudioBus*, | 77 AudioBus*, |
77 ScriptPromiseResolver*, | 78 ScriptPromiseResolver*, |
78 BaseAudioContext*); | 79 BaseAudioContext*); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace blink | 82 } // namespace blink |
82 | 83 |
83 #endif // AsyncAudioDecoder_h | 84 #endif // AsyncAudioDecoder_h |
OLD | NEW |