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

Side by Side Diff: ppapi/cpp/private/video_frame_private.h

Issue 14192054: Rename PPAPI Video Stream APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
(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_PRIVATE_VIDEO_FRAME_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_
7
8 #include "ppapi/c/pp_time.h"
9 #include "ppapi/c/private/pp_video_frame_private.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 struct used to hold a video frame.
16
17 namespace pp {
18
19 /// The <code>PP_VideoFrame_Private</code> struct represents a video frame.
20 /// Video sources and destinations use frames to transfer video to and from
21 /// the browser.
22 class VideoFrame_Private {
23 public:
24 /// Default constructor for creating a <code>VideoFrame_Private</code> object.
25 VideoFrame_Private();
26
27 /// Constructor that takes an existing <code>PP_VideoFrame_Private</code>
28 /// structure. The 'image_data' PP_Resource field in the structure will be
29 /// managed by this instance.
30 VideoFrame_Private(PassRef, const PP_VideoFrame_Private& pp_video_frame);
31
32 /// Constructor that takes an existing <code>ImageData</code> instance and
33 /// a timestamp.
34 VideoFrame_Private(const ImageData& image_data, PP_TimeTicks timestamp);
35
36 /// The copy constructor for <code>VideoFrame_Private</code>.
37 ///
38 /// @param[in] other A reference to a <code>VideoFrame_Private</code>.
39 VideoFrame_Private(const VideoFrame_Private& other);
40
41 ~VideoFrame_Private();
42
43 /// The assignment operator for <code>VideoFrame_Private</code>.
44 ///
45 /// @param[in] other A reference to a <code>VideoFrame_Private</code>.
46 VideoFrame_Private& operator=(const VideoFrame_Private& other);
47
48 const PP_VideoFrame_Private& pp_video_frame() const {
49 return video_frame_;
50 }
51
52 ImageData image_data() const {
53 return image_data_;
54 }
55 void set_image_data(const ImageData& image_data) {
56 image_data_ = image_data;
57 // The assignment above manages the underlying PP_Resources. Copy the new
58 // one into our internal video frame struct.
59 video_frame_.image_data = image_data_.pp_resource();
60 }
61
62 PP_TimeTicks timestamp() const { return video_frame_.timestamp; }
63 void set_timestamp(PP_TimeTicks timestamp) {
64 video_frame_.timestamp = timestamp;
65 }
66
67 private:
68 ImageData image_data_; // This manages the PP_Resource in video_frame_.
69 PP_VideoFrame_Private video_frame_;
70 };
71
72 namespace internal {
73
74 // A specialization of CallbackOutputTraits to provide the callback system the
75 // information on how to handle pp::VideoFrame_Private. This converts
76 // PP_VideoFrame_Private to pp::VideoFrame_Private when passing to the plugin,
77 // and specifically manages the PP_Resource embedded in the video_frame_ field.
78 template<>
79 struct CallbackOutputTraits<pp::VideoFrame_Private> {
80 typedef PP_VideoFrame_Private* APIArgType;
81 typedef PP_VideoFrame_Private StorageType;
82
83 static inline APIArgType StorageToAPIArg(StorageType& t) {
84 return &t;
85 }
86
87 static inline pp::VideoFrame_Private StorageToPluginArg(StorageType& t) {
88 return pp::VideoFrame_Private(PASS_REF, t);
89 }
90 };
91
92 } // namespace internal
93
94 } // namespace pp
95
96 #endif // PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698