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

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: Created 6 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 | 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"
11 14
12 namespace base { 15 namespace base {
13 class Thread; 16 class Thread;
14 } 17 }
15 18
16 namespace media { 19 namespace media {
17 class DataSource; 20 class DataSource;
18 } 21 }
19 22
20 namespace metadata { 23 namespace metadata {
21 24
22 // This class takes a MIME type and data source and parses its metadata. It 25 // 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, 26 // 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 27 // libexif, etc. This class lives and operates on the utility thread of the
25 // utility process, as we wish to sandbox potentially dangerous operations 28 // utility process, as we wish to sandbox potentially dangerous operations
26 // on user-provided data. 29 // on user-provided data.
27 class MediaMetadataParser { 30 class MediaMetadataParser {
28 public: 31 public:
29 typedef extensions::api::media_galleries::MediaMetadata MediaMetadata; 32 typedef extensions::api::media_galleries::MediaMetadata MediaMetadata;
30 typedef base::Callback<void(scoped_ptr<MediaMetadata>)> MetadataCallback; 33 typedef base::Callback<
34 void(scoped_ptr<MediaMetadata> metadata,
35 const std::vector<std::string>& attached_pictures_bytes,
36 const std::vector<std::string>& attached_pictures_types)>
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_pictures);
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_pictures_;
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