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 #if !defined(MEDIA_DISABLE_FFMPEG) |
24 void SetStringScopedPtr(const std::string& value, | 25 void SetStringScopedPtr(const std::string& value, |
25 std::unique_ptr<std::string>* destination) { | 26 std::unique_ptr<std::string>* destination) { |
26 DCHECK(destination); | 27 DCHECK(destination); |
27 if (!value.empty()) | 28 if (!value.empty()) |
28 destination->reset(new std::string(value)); | 29 destination->reset(new std::string(value)); |
29 } | 30 } |
30 | 31 |
31 void SetIntScopedPtr(int value, std::unique_ptr<int>* destination) { | 32 void SetIntScopedPtr(int value, std::unique_ptr<int>* destination) { |
32 DCHECK(destination); | 33 DCHECK(destination); |
33 if (value >= 0) | 34 if (value >= 0) |
34 destination->reset(new int(value)); | 35 destination->reset(new int(value)); |
35 } | 36 } |
| 37 #endif |
36 | 38 |
37 // This runs on |media_thread_|, as the underlying FFmpeg operation is | 39 // 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 | 40 // 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. | 41 // bytes can be sent from the browser process to the utility process. |
40 void ParseAudioVideoMetadata( | 42 void ParseAudioVideoMetadata( |
41 media::DataSource* source, bool get_attached_images, | 43 media::DataSource* source, bool get_attached_images, |
42 MediaMetadataParser::MediaMetadata* metadata, | 44 MediaMetadataParser::MediaMetadata* metadata, |
43 std::vector<AttachedImage>* attached_images) { | 45 std::vector<AttachedImage>* attached_images) { |
44 DCHECK(source); | 46 DCHECK(source); |
45 DCHECK(metadata); | 47 DCHECK(metadata); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 get_attached_images_, metadata, attached_images), | 139 get_attached_images_, metadata, attached_images), |
138 base::Bind(&FinishParseAudioVideoMetadata, callback, | 140 base::Bind(&FinishParseAudioVideoMetadata, callback, |
139 base::Owned(metadata), base::Owned(attached_images))); | 141 base::Owned(metadata), base::Owned(attached_images))); |
140 return; | 142 return; |
141 } | 143 } |
142 | 144 |
143 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); | 145 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); |
144 } | 146 } |
145 | 147 |
146 } // namespace metadata | 148 } // namespace metadata |
OLD | NEW |