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

Side by Side Diff: ppapi/cpp/video_frame.h

Issue 14192054: Rename PPAPI Video Stream APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Straighten out naming confusion, improve comments. Created 7 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
« no previous file with comments | « ppapi/cpp/private/video_source_private.cc ('k') | ppapi/cpp/video_frame.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_CPP_VIDEO_FRAME_H_
6 #define PPAPI_CPP_VIDEO_FRAME_H_
7
8 #include "ppapi/c/pp_time.h"
9 #include "ppapi/c/pp_video_frame.h"
10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/cpp/image_data.h"
12 #include "ppapi/cpp/pass_ref.h"
13
14 /// @file
15 /// This file defines the video frame struct used by video readers and writers.
16
17 namespace pp {
18
19 // VideoFrame ------------------------------------------------------------------
20
21 /// The <code>VideoFrame</code> class represents a frame of video in a stream.
22 class VideoFrame {
23 public:
24 /// Default constructor for creating a <code>VideoFrame</code> object.
25 VideoFrame();
26
27 /// Constructor that takes an existing <code>PP_VideoFrame</code> structure.
28 /// The 'image_data' PP_Resource field in the structure will be managed by
29 /// this instance.
30 VideoFrame(PassRef, const PP_VideoFrame& pp_video_frame);
31
32 /// Constructor that takes an existing <code>ImageData</code> instance and
33 /// a timestamp.
34 VideoFrame(const ImageData& image_data, PP_TimeTicks timestamp);
35
36 /// The copy constructor for <code>VideoFrame</code>.
37 ///
38 /// @param[in] other A reference to a <code>VideoFrame</code>.
39 VideoFrame(const VideoFrame& other);
40
41 ~VideoFrame();
42
43 VideoFrame& operator=(const VideoFrame& other);
44
45 const PP_VideoFrame& pp_video_frame() const {
46 return video_frame_;
47 }
48
49 ImageData image_data() const {
50 return image_data_;
51 }
52 void set_image_data(const ImageData& image_data) {
53 image_data_ = image_data;
54 // The assignment above manages the underlying PP_Resources. Copy the new
55 // one into our internal video frame struct.
56 video_frame_.image_data = image_data_.pp_resource();
57 }
58
59 PP_TimeTicks timestamp() const { return video_frame_.timestamp; }
60 void set_timestamp(PP_TimeTicks timestamp) {
61 video_frame_.timestamp = timestamp;
62 }
63
64 private:
65 ImageData image_data_; // This manages the PP_Resource in video_frame_.
66 PP_VideoFrame video_frame_;
67 };
68
69 namespace internal {
70
71 // A specialization of CallbackOutputTraits to provide the callback system the
72 // information on how to handle pp::VideoFrame. This converts PP_VideoFrame to
73 // pp::VideoFrame when passing to the plugin, and specifically manages the
74 // PP_Resource embedded in the video_frame_ field.
75 template<>
76 struct CallbackOutputTraits<pp::VideoFrame> {
77 typedef PP_VideoFrame* APIArgType;
78 typedef PP_VideoFrame StorageType;
79
80 static inline APIArgType StorageToAPIArg(StorageType& t) {
81 return &t;
82 }
83
84 static inline pp::VideoFrame StorageToPluginArg(StorageType& t) {
85 return pp::VideoFrame(PASS_REF, t);
86 }
87 };
88
89 } // namespace internal
90
91 } // namespace pp
92
93 #endif // PPAPI_CPP_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/private/video_source_private.cc ('k') | ppapi/cpp/video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698