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

Side by Side Diff: talk/media/base/videoframe.h

Issue 1324263004: Remove cricket::VideoFrame::Set/GetElapsedTime() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased. Re-added CapturedFrame.elapsed_time. Remove once Chromium is updated. Created 5 years, 2 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
« no previous file with comments | « talk/media/base/videocapturer_unittest.cc ('k') | talk/media/base/videoframe.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 24 matching lines...) Expand all
35 35
36 namespace cricket { 36 namespace cricket {
37 37
38 // Represents a YUV420 (a.k.a. I420) video frame. 38 // Represents a YUV420 (a.k.a. I420) video frame.
39 class VideoFrame { 39 class VideoFrame {
40 public: 40 public:
41 VideoFrame() {} 41 VideoFrame() {}
42 virtual ~VideoFrame() {} 42 virtual ~VideoFrame() {}
43 43
44 virtual bool InitToBlack(int w, int h, size_t pixel_width, 44 virtual bool InitToBlack(int w, int h, size_t pixel_width,
45 size_t pixel_height, int64_t elapsed_time, 45 size_t pixel_height, int64_t time_stamp) = 0;
46 int64_t time_stamp) = 0;
47 // Creates a frame from a raw sample with FourCC |format| and size |w| x |h|. 46 // Creates a frame from a raw sample with FourCC |format| and size |w| x |h|.
48 // |h| can be negative indicating a vertically flipped image. 47 // |h| can be negative indicating a vertically flipped image.
49 // |dw| is destination width; can be less than |w| if cropping is desired. 48 // |dw| is destination width; can be less than |w| if cropping is desired.
50 // |dh| is destination height, like |dw|, but must be a positive number. 49 // |dh| is destination height, like |dw|, but must be a positive number.
51 // Returns whether the function succeeded or failed. 50 // Returns whether the function succeeded or failed.
52 51
53 virtual bool Reset(uint32 fourcc, 52 virtual bool Reset(uint32 fourcc,
54 int w, 53 int w,
55 int h, 54 int h,
56 int dw, 55 int dw,
57 int dh, 56 int dh,
58 uint8* sample, 57 uint8* sample,
59 size_t sample_size, 58 size_t sample_size,
60 size_t pixel_width, 59 size_t pixel_width,
61 size_t pixel_height, 60 size_t pixel_height,
62 int64_t elapsed_time,
63 int64_t time_stamp, 61 int64_t time_stamp,
64 webrtc::VideoRotation rotation, 62 webrtc::VideoRotation rotation,
65 bool apply_rotation) = 0; 63 bool apply_rotation) = 0;
66 64
67 // TODO(guoweis): Remove this once all external implementations are updated. 65 // TODO(guoweis): Remove this once all external implementations are updated.
68 virtual bool Reset(uint32 fourcc, 66 virtual bool Reset(uint32 fourcc,
69 int w, 67 int w,
70 int h, 68 int h,
71 int dw, 69 int dw,
72 int dh, 70 int dh,
73 uint8* sample, 71 uint8* sample,
74 size_t sample_size, 72 size_t sample_size,
75 size_t pixel_width, 73 size_t pixel_width,
76 size_t pixel_height, 74 size_t pixel_height,
77 int64_t elapsed_time,
78 int64_t time_stamp, 75 int64_t time_stamp,
79 int rotation) { 76 int rotation) {
80 return Reset(fourcc, w, h, dw, dh, sample, sample_size, pixel_width, 77 return Reset(fourcc, w, h, dw, dh, sample, sample_size, pixel_width,
81 pixel_height, elapsed_time, time_stamp, 78 pixel_height, time_stamp,
82 static_cast<webrtc::VideoRotation>(rotation), true); 79 static_cast<webrtc::VideoRotation>(rotation), true);
83 } 80 }
84 81
85 // Basic accessors. 82 // Basic accessors.
86 // Note this is the width and height without rotation applied. 83 // Note this is the width and height without rotation applied.
87 virtual size_t GetWidth() const = 0; 84 virtual size_t GetWidth() const = 0;
88 virtual size_t GetHeight() const = 0; 85 virtual size_t GetHeight() const = 0;
89 86
90 size_t GetChromaWidth() const { return (GetWidth() + 1) / 2; } 87 size_t GetChromaWidth() const { return (GetWidth() + 1) / 2; }
91 size_t GetChromaHeight() const { return (GetHeight() + 1) / 2; } 88 size_t GetChromaHeight() const { return (GetHeight() + 1) / 2; }
(...skipping 18 matching lines...) Expand all
110 // Returns the underlying video frame buffer. This function is ok to call 107 // Returns the underlying video frame buffer. This function is ok to call
111 // multiple times, but the returned object will refer to the same memory. 108 // multiple times, but the returned object will refer to the same memory.
112 virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() 109 virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer()
113 const = 0; 110 const = 0;
114 111
115 // For retrieving the aspect ratio of each pixel. Usually this is 1x1, but 112 // For retrieving the aspect ratio of each pixel. Usually this is 1x1, but
116 // the aspect_ratio_idc parameter of H.264 can specify non-square pixels. 113 // the aspect_ratio_idc parameter of H.264 can specify non-square pixels.
117 virtual size_t GetPixelWidth() const = 0; 114 virtual size_t GetPixelWidth() const = 0;
118 virtual size_t GetPixelHeight() const = 0; 115 virtual size_t GetPixelHeight() const = 0;
119 116
120 virtual int64_t GetElapsedTime() const = 0;
121 virtual int64_t GetTimeStamp() const = 0; 117 virtual int64_t GetTimeStamp() const = 0;
122 virtual void SetElapsedTime(int64_t elapsed_time) = 0;
123 virtual void SetTimeStamp(int64_t time_stamp) = 0; 118 virtual void SetTimeStamp(int64_t time_stamp) = 0;
124 119
125 // Indicates the rotation angle in degrees. 120 // Indicates the rotation angle in degrees.
126 // TODO(guoweis): Remove this function, rename GetVideoRotation and remove the 121 // TODO(guoweis): Remove this function, rename GetVideoRotation and remove the
127 // skeleton implementation of GetRotation once chrome is updated. 122 // skeleton implementation of GetRotation once chrome is updated.
128 virtual int GetRotation() const { return GetVideoRotation(); } 123 virtual int GetRotation() const { return GetVideoRotation(); }
129 virtual webrtc::VideoRotation GetVideoRotation() const { 124 virtual webrtc::VideoRotation GetVideoRotation() const {
130 return webrtc::kVideoRotation_0; 125 return webrtc::kVideoRotation_0;
131 } 126 }
132 127
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 206
212 // Size of an I420 image of given dimensions when stored as a frame buffer. 207 // Size of an I420 image of given dimensions when stored as a frame buffer.
213 static size_t SizeOf(size_t w, size_t h) { 208 static size_t SizeOf(size_t w, size_t h) {
214 return w * h + ((w + 1) / 2) * ((h + 1) / 2) * 2; 209 return w * h + ((w + 1) / 2) * ((h + 1) / 2) * 2;
215 } 210 }
216 211
217 protected: 212 protected:
218 // Creates an empty frame. 213 // Creates an empty frame.
219 virtual VideoFrame *CreateEmptyFrame(int w, int h, size_t pixel_width, 214 virtual VideoFrame *CreateEmptyFrame(int w, int h, size_t pixel_width,
220 size_t pixel_height, 215 size_t pixel_height,
221 int64_t elapsed_time,
222 int64_t time_stamp) const = 0; 216 int64_t time_stamp) const = 0;
223 virtual void SetRotation(webrtc::VideoRotation rotation) = 0; 217 virtual void SetRotation(webrtc::VideoRotation rotation) = 0;
224 }; 218 };
225 219
226 } // namespace cricket 220 } // namespace cricket
227 221
228 #endif // TALK_MEDIA_BASE_VIDEOFRAME_H_ 222 #endif // TALK_MEDIA_BASE_VIDEOFRAME_H_
OLDNEW
« no previous file with comments | « talk/media/base/videocapturer_unittest.cc ('k') | talk/media/base/videoframe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698