OLD | NEW |
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 #include "chrome/utility/media_galleries/media_metadata_parser.h" | 5 #include "chrome/utility/media_galleries/media_metadata_parser.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "media/base/audio_video_metadata_extractor.h" | 14 #include "media/base/audio_video_metadata_extractor.h" |
15 #include "media/base/data_source.h" | 15 #include "media/base/data_source.h" |
16 #include "net/base/mime_sniffer.h" | 16 #include "net/base/mime_sniffer.h" |
17 | 17 |
18 namespace MediaGalleries = extensions::api::media_galleries; | 18 namespace MediaGalleries = extensions::api::media_galleries; |
19 | 19 |
20 namespace metadata { | 20 namespace metadata { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 void SetStringScopedPtr(const std::string& value, | 24 void SetStringScopedPtr(const std::string& value, |
25 scoped_ptr<std::string>* destination) { | 25 std::unique_ptr<std::string>* destination) { |
26 DCHECK(destination); | 26 DCHECK(destination); |
27 if (!value.empty()) | 27 if (!value.empty()) |
28 destination->reset(new std::string(value)); | 28 destination->reset(new std::string(value)); |
29 } | 29 } |
30 | 30 |
31 void SetIntScopedPtr(int value, scoped_ptr<int>* destination) { | 31 void SetIntScopedPtr(int value, std::unique_ptr<int>* destination) { |
32 DCHECK(destination); | 32 DCHECK(destination); |
33 if (value >= 0) | 33 if (value >= 0) |
34 destination->reset(new int(value)); | 34 destination->reset(new int(value)); |
35 } | 35 } |
36 | 36 |
37 // This runs on |media_thread_|, as the underlying FFmpeg operation is | 37 // This runs on |media_thread_|, as the underlying FFmpeg operation is |
38 // blocking, and the utility thread must not be blocked, so the media file | 38 // blocking, and the utility thread must not be blocked, so the media file |
39 // bytes can be sent from the browser process to the utility process. | 39 // bytes can be sent from the browser process to the utility process. |
40 void ParseAudioVideoMetadata( | 40 void ParseAudioVideoMetadata( |
41 media::DataSource* source, bool get_attached_images, | 41 media::DataSource* source, bool get_attached_images, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 get_attached_images_, metadata, attached_images), | 137 get_attached_images_, metadata, attached_images), |
138 base::Bind(&FinishParseAudioVideoMetadata, callback, | 138 base::Bind(&FinishParseAudioVideoMetadata, callback, |
139 base::Owned(metadata), base::Owned(attached_images))); | 139 base::Owned(metadata), base::Owned(attached_images))); |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
143 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); | 143 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); |
144 } | 144 } |
145 | 145 |
146 } // namespace metadata | 146 } // namespace metadata |
OLD | NEW |