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

Side by Side Diff: media/audio/sounds/wav_audio_handler.h

Issue 1911913002: Convert //media/audio from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_ 5 #ifndef MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_
6 #define MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_ 6 #define MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
12
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
16 17
17 namespace media { 18 namespace media {
18 19
19 class AudioBus; 20 class AudioBus;
20 21
21 // This class provides the input from wav file format. See 22 // This class provides the input from wav file format. See
22 // https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ 23 // https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
23 class MEDIA_EXPORT WavAudioHandler { 24 class MEDIA_EXPORT WavAudioHandler {
24 public: 25 public:
25 virtual ~WavAudioHandler(); 26 virtual ~WavAudioHandler();
26 27
27 // Create a WavAudioHandler using |wav_data|. If |wav_data| cannot be parsed 28 // Create a WavAudioHandler using |wav_data|. If |wav_data| cannot be parsed
28 // correctly, the returned scoped_ptr will be null. The underlying memory for 29 // correctly, the returned scoped_ptr will be null. The underlying memory for
29 // wav_data must survive for the lifetime of this class. 30 // wav_data must survive for the lifetime of this class.
30 static scoped_ptr<WavAudioHandler> Create(const base::StringPiece wav_data); 31 static std::unique_ptr<WavAudioHandler> Create(
32 const base::StringPiece wav_data);
31 33
32 // Returns true when cursor points to the end of the track. 34 // Returns true when cursor points to the end of the track.
33 bool AtEnd(size_t cursor) const; 35 bool AtEnd(size_t cursor) const;
34 36
35 // Copies the audio data to |bus| starting from the |cursor| and in 37 // Copies the audio data to |bus| starting from the |cursor| and in
36 // the case of success stores the number of written bytes in 38 // the case of success stores the number of written bytes in
37 // |bytes_written|. |bytes_written| should not be NULL. Returns false if the 39 // |bytes_written|. |bytes_written| should not be NULL. Returns false if the
38 // operation was unsuccessful. Returns true otherwise. 40 // operation was unsuccessful. Returns true otherwise.
39 bool CopyTo(AudioBus* bus, size_t cursor, size_t* bytes_written) const; 41 bool CopyTo(AudioBus* bus, size_t cursor, size_t* bytes_written) const;
40 42
(...skipping 20 matching lines...) Expand all
61 const uint32_t sample_rate_; 63 const uint32_t sample_rate_;
62 const uint16_t bits_per_sample_; 64 const uint16_t bits_per_sample_;
63 uint32_t total_frames_; 65 uint32_t total_frames_;
64 66
65 DISALLOW_COPY_AND_ASSIGN(WavAudioHandler); 67 DISALLOW_COPY_AND_ASSIGN(WavAudioHandler);
66 }; 68 };
67 69
68 } // namespace media 70 } // namespace media
69 71
70 #endif // MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_ 72 #endif // MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_
OLDNEW
« no previous file with comments | « media/audio/sounds/audio_stream_handler_unittest.cc ('k') | media/audio/sounds/wav_audio_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698