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

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

Issue 250143002: Media Galleries API: Audio/Video attached pictures support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create Blobs on browser-process, eliminating two IPC copies. Created 6 years, 7 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 | Annotate | Revision Log
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 CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_ 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_
6 #define CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_ 6 #define CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_
7 7
8 #include <string>
9 #include <vector>
10
8 #include "base/callback.h" 11 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "chrome/common/extensions/api/media_galleries.h" 13 #include "chrome/common/extensions/api/media_galleries.h"
14 #include "chrome/common/media_galleries/metadata_types.h"
11 15
12 namespace base { 16 namespace base {
13 class Thread; 17 class Thread;
14 } 18 }
15 19
16 namespace media { 20 namespace media {
17 class DataSource; 21 class DataSource;
18 } 22 }
19 23
20 namespace metadata { 24 namespace metadata {
21 25
22 // This class takes a MIME type and data source and parses its metadata. It 26 // This class takes a MIME type and data source and parses its metadata. It
23 // handles audio, video, and images. It delegates its operations to FFMPEG, 27 // handles audio, video, and images. It delegates its operations to FFMPEG,
24 // libexif, etc. This class lives and operates on the utility thread of the 28 // libexif, etc. This class lives and operates on the utility thread of the
25 // utility process, as we wish to sandbox potentially dangerous operations 29 // utility process, as we wish to sandbox potentially dangerous operations
26 // on user-provided data. 30 // on user-provided data.
27 class MediaMetadataParser { 31 class MediaMetadataParser {
28 public: 32 public:
29 typedef extensions::api::media_galleries::MediaMetadata MediaMetadata; 33 typedef extensions::api::media_galleries::MediaMetadata MediaMetadata;
30 typedef base::Callback<void(scoped_ptr<MediaMetadata>)> MetadataCallback; 34 typedef base::Callback<
35 void(scoped_ptr<MediaMetadata> metadata,
36 const std::vector<AttachedImage>& attached_images)>
37 MetadataCallback;
31 38
32 // Does not take ownership of |source|. Caller is responsible for ensuring 39 // Does not take ownership of |source|. Caller is responsible for ensuring
33 // that |source| outlives this object. 40 // that |source| outlives this object.
34 MediaMetadataParser(media::DataSource* source, const std::string& mime_type); 41 MediaMetadataParser(media::DataSource* source, const std::string& mime_type,
42 bool get_attached_images);
35 43
36 ~MediaMetadataParser(); 44 ~MediaMetadataParser();
37 45
38 // |callback| is called on same message loop. 46 // |callback| is called on same message loop.
39 void Start(const MetadataCallback& callback); 47 void Start(const MetadataCallback& callback);
40 48
41 private: 49 private:
42 // Only accessed on |media_thread_| from this class. 50 // Only accessed on |media_thread_| from this class.
43 media::DataSource* const source_; 51 media::DataSource* const source_;
44 52
45 const std::string mime_type_; 53 const std::string mime_type_;
46 54
55 bool get_attached_images_;
56
47 // Thread that blocking media parsing operations run on while the main thread 57 // Thread that blocking media parsing operations run on while the main thread
48 // handles messages from the browser process. 58 // handles messages from the browser process.
49 // TODO(tommycli): Replace with a reference to a WorkerPool if we ever use 59 // TODO(tommycli): Replace with a reference to a WorkerPool if we ever use
50 // this class in batch mode. 60 // this class in batch mode.
51 scoped_ptr<base::Thread> media_thread_; 61 scoped_ptr<base::Thread> media_thread_;
52 62
53 DISALLOW_COPY_AND_ASSIGN(MediaMetadataParser); 63 DISALLOW_COPY_AND_ASSIGN(MediaMetadataParser);
54 }; 64 };
55 65
56 } // namespace metadata 66 } // namespace metadata
57 67
58 #endif // CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_ 68 #endif // CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698