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

Side by Side Diff: chrome/utility/media_galleries/media_metadata_parser.cc

Issue 1415793003: fix build when ffmpeg, libvpx and libwebm are disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 #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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // This runs on |media_thread_|, as the underlying FFmpeg operation is 50 // This runs on |media_thread_|, as the underlying FFmpeg operation is
51 // blocking, and the utility thread must not be blocked, so the media file 51 // blocking, and the utility thread must not be blocked, so the media file
52 // bytes can be sent from the browser process to the utility process. 52 // bytes can be sent from the browser process to the utility process.
53 void ParseAudioVideoMetadata( 53 void ParseAudioVideoMetadata(
54 media::DataSource* source, bool get_attached_images, 54 media::DataSource* source, bool get_attached_images,
55 MediaMetadataParser::MediaMetadata* metadata, 55 MediaMetadataParser::MediaMetadata* metadata,
56 std::vector<AttachedImage>* attached_images) { 56 std::vector<AttachedImage>* attached_images) {
57 DCHECK(source); 57 DCHECK(source);
58 DCHECK(metadata); 58 DCHECK(metadata);
59
60 #if !defined(MEDIA_DISABLE_FFMPEG)
59 media::AudioVideoMetadataExtractor extractor; 61 media::AudioVideoMetadataExtractor extractor;
60 62
61 if (!extractor.Extract(source, get_attached_images)) 63 if (!extractor.Extract(source, get_attached_images))
62 return; 64 return;
63 65
64 if (extractor.duration() >= 0) 66 if (extractor.duration() >= 0)
65 metadata->duration.reset(new double(extractor.duration())); 67 metadata->duration.reset(new double(extractor.duration()));
66 68
67 if (extractor.height() >= 0 && extractor.width() >= 0) { 69 if (extractor.height() >= 0 && extractor.width() >= 0) {
68 metadata->height.reset(new int(extractor.height())); 70 metadata->height.reset(new int(extractor.height()));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (get_attached_images) { 103 if (get_attached_images) {
102 for (std::vector<std::string>::const_iterator it = 104 for (std::vector<std::string>::const_iterator it =
103 extractor.attached_images_bytes().begin(); 105 extractor.attached_images_bytes().begin();
104 it != extractor.attached_images_bytes().end(); ++it) { 106 it != extractor.attached_images_bytes().end(); ++it) {
105 attached_images->push_back(AttachedImage()); 107 attached_images->push_back(AttachedImage());
106 attached_images->back().data = *it; 108 attached_images->back().data = *it;
107 net::SniffMimeTypeFromLocalData(it->c_str(), it->length(), 109 net::SniffMimeTypeFromLocalData(it->c_str(), it->length(),
108 &attached_images->back().type); 110 &attached_images->back().type);
109 } 111 }
110 } 112 }
113 #endif
111 } 114 }
112 115
113 void FinishParseAudioVideoMetadata( 116 void FinishParseAudioVideoMetadata(
114 MediaMetadataParser::MetadataCallback callback, 117 MediaMetadataParser::MetadataCallback callback,
115 MediaMetadataParser::MediaMetadata* metadata, 118 MediaMetadataParser::MediaMetadata* metadata,
116 std::vector<AttachedImage>* attached_images) { 119 std::vector<AttachedImage>* attached_images) {
117 DCHECK(!callback.is_null()); 120 DCHECK(!callback.is_null());
118 DCHECK(metadata); 121 DCHECK(metadata);
119 DCHECK(attached_images); 122 DCHECK(attached_images);
120 123
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 source_, 192 source_,
190 base::Bind(&FinishParseImageMetadata, base::Owned(extractor), 193 base::Bind(&FinishParseImageMetadata, base::Owned(extractor),
191 mime_type_, callback)); 194 mime_type_, callback));
192 return; 195 return;
193 } 196 }
194 197
195 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); 198 callback.Run(MediaMetadata(), std::vector<AttachedImage>());
196 } 199 }
197 200
198 } // namespace metadata 201 } // namespace metadata
OLDNEW
« no previous file with comments | « chrome/utility/extensions/extensions_handler.cc ('k') | content/renderer/media/audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698