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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… 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/videoadapter_unittest.cc ('k') | talk/media/base/videocapturer.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 2010 Google Inc. 3 * Copyright 2010 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 CS_RUNNING, // The capturer has been started successfully and is now 61 CS_RUNNING, // The capturer has been started successfully and is now
62 // capturing. 62 // capturing.
63 CS_PAUSED, // The capturer has been paused. 63 CS_PAUSED, // The capturer has been paused.
64 CS_FAILED, // The capturer failed to start. 64 CS_FAILED, // The capturer failed to start.
65 CS_NO_DEVICE, // The capturer has no device and consequently failed to start. 65 CS_NO_DEVICE, // The capturer has no device and consequently failed to start.
66 }; 66 };
67 67
68 class VideoFrame; 68 class VideoFrame;
69 69
70 struct CapturedFrame { 70 struct CapturedFrame {
71 static const uint32 kFrameHeaderSize = 40; // Size from width to data_size. 71 static const uint32_t kFrameHeaderSize = 40; // Size from width to data_size.
72 static const uint32 kUnknownDataSize = 0xFFFFFFFF; 72 static const uint32_t kUnknownDataSize = 0xFFFFFFFF;
73 73
74 CapturedFrame(); 74 CapturedFrame();
75 75
76 // Get the number of bytes of the frame data. If data_size is known, return 76 // Get the number of bytes of the frame data. If data_size is known, return
77 // it directly. Otherwise, calculate the size based on width, height, and 77 // it directly. Otherwise, calculate the size based on width, height, and
78 // fourcc. Return true if succeeded. 78 // fourcc. Return true if succeeded.
79 bool GetDataSize(uint32* size) const; 79 bool GetDataSize(uint32_t* size) const;
80 80
81 // TODO(guoweis): Change the type of |rotation| from int to 81 // TODO(guoweis): Change the type of |rotation| from int to
82 // webrtc::VideoRotation once chromium gets the code. 82 // webrtc::VideoRotation once chromium gets the code.
83 webrtc::VideoRotation GetRotation() const; 83 webrtc::VideoRotation GetRotation() const;
84 84
85 // The width and height of the captured frame could be different from those 85 // The width and height of the captured frame could be different from those
86 // of VideoFormat. Once the first frame is captured, the width, height, 86 // of VideoFormat. Once the first frame is captured, the width, height,
87 // fourcc, pixel_width, and pixel_height should keep the same over frames. 87 // fourcc, pixel_width, and pixel_height should keep the same over frames.
88 int width; // in number of pixels 88 int width; // in number of pixels
89 int height; // in number of pixels 89 int height; // in number of pixels
90 uint32 fourcc; // compression 90 uint32_t fourcc; // compression
91 uint32 pixel_width; // width of a pixel, default is 1 91 uint32_t pixel_width; // width of a pixel, default is 1
92 uint32 pixel_height; // height of a pixel, default is 1 92 uint32_t pixel_height; // height of a pixel, default is 1
93 // TODO(magjed): |elapsed_time| is deprecated - remove once not used anymore. 93 // TODO(magjed): |elapsed_time| is deprecated - remove once not used anymore.
94 int64 elapsed_time; 94 int64_t elapsed_time;
95 int64 time_stamp; // timestamp of when the frame was captured, in unix 95 int64_t time_stamp; // timestamp of when the frame was captured, in unix
96 // time with nanosecond units. 96 // time with nanosecond units.
97 uint32 data_size; // number of bytes of the frame data 97 uint32_t data_size; // number of bytes of the frame data
98 98
99 // TODO(guoweis): This can't be converted to VideoRotation yet as it's 99 // TODO(guoweis): This can't be converted to VideoRotation yet as it's
100 // used by chrome now. 100 // used by chrome now.
101 int rotation; // rotation in degrees of the frame (0, 90, 180, 270) 101 int rotation; // rotation in degrees of the frame (0, 90, 180, 270)
102 102
103 void* data; // pointer to the frame data. This object allocates the 103 void* data; // pointer to the frame data. This object allocates the
104 // memory or points to an existing memory. 104 // memory or points to an existing memory.
105 105
106 private: 106 private:
107 RTC_DISALLOW_COPY_AND_ASSIGN(CapturedFrame); 107 RTC_DISALLOW_COPY_AND_ASSIGN(CapturedFrame);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. 309 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
310 void OnFrameCaptured(VideoCapturer* video_capturer, 310 void OnFrameCaptured(VideoCapturer* video_capturer,
311 const CapturedFrame* captured_frame); 311 const CapturedFrame* captured_frame);
312 void SetCaptureState(CaptureState state); 312 void SetCaptureState(CaptureState state);
313 313
314 // Marshals SignalStateChange onto thread_. 314 // Marshals SignalStateChange onto thread_.
315 void OnMessage(rtc::Message* message); 315 void OnMessage(rtc::Message* message);
316 316
317 // subclasses override this virtual method to provide a vector of fourccs, in 317 // subclasses override this virtual method to provide a vector of fourccs, in
318 // order of preference, that are expected by the media engine. 318 // order of preference, that are expected by the media engine.
319 virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) = 0; 319 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0;
320 320
321 // mutators to set private attributes 321 // mutators to set private attributes
322 void SetId(const std::string& id) { 322 void SetId(const std::string& id) {
323 id_ = id; 323 id_ = id;
324 } 324 }
325 325
326 void SetCaptureFormat(const VideoFormat* format) { 326 void SetCaptureFormat(const VideoFormat* format) {
327 capture_format_.reset(format ? new VideoFormat(*format) : NULL); 327 capture_format_.reset(format ? new VideoFormat(*format) : NULL);
328 if (capture_format_) { 328 if (capture_format_) {
329 ASSERT(capture_format_->interval > 0 && 329 ASSERT(capture_format_->interval > 0 &&
330 "Capture format expected to have positive interval."); 330 "Capture format expected to have positive interval.");
331 // Video adapter really only cares about capture format interval. 331 // Video adapter really only cares about capture format interval.
332 video_adapter_.SetInputFormat(*capture_format_); 332 video_adapter_.SetInputFormat(*capture_format_);
333 } 333 }
334 } 334 }
335 335
336 void SetSupportedFormats(const std::vector<VideoFormat>& formats); 336 void SetSupportedFormats(const std::vector<VideoFormat>& formats);
337 VideoFrameFactory* frame_factory() { return frame_factory_.get(); } 337 VideoFrameFactory* frame_factory() { return frame_factory_.get(); }
338 338
339 private: 339 private:
340 void Construct(); 340 void Construct();
341 // Get the distance between the desired format and the supported format. 341 // Get the distance between the desired format and the supported format.
342 // Return the max distance if they mismatch. See the implementation for 342 // Return the max distance if they mismatch. See the implementation for
343 // details. 343 // details.
344 int64 GetFormatDistance(const VideoFormat& desired, 344 int64_t GetFormatDistance(const VideoFormat& desired,
345 const VideoFormat& supported); 345 const VideoFormat& supported);
346 346
347 // Convert captured frame to readable string for LOG messages. 347 // Convert captured frame to readable string for LOG messages.
348 std::string ToString(const CapturedFrame* frame) const; 348 std::string ToString(const CapturedFrame* frame) const;
349 349
350 // Updates filtered_supported_formats_ so that it contains the formats in 350 // Updates filtered_supported_formats_ so that it contains the formats in
351 // supported_formats_ that fulfill all applied restrictions. 351 // supported_formats_ that fulfill all applied restrictions.
352 void UpdateFilteredSupportedFormats(); 352 void UpdateFilteredSupportedFormats();
353 // Returns true if format doesn't fulfill all applied restrictions. 353 // Returns true if format doesn't fulfill all applied restrictions.
354 bool ShouldFilterFormat(const VideoFormat& format) const; 354 bool ShouldFilterFormat(const VideoFormat& format) const;
355 355
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 // Whether capturer should apply rotation to the frame before signaling it. 397 // Whether capturer should apply rotation to the frame before signaling it.
398 bool apply_rotation_; 398 bool apply_rotation_;
399 399
400 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); 400 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
401 }; 401 };
402 402
403 } // namespace cricket 403 } // namespace cricket
404 404
405 #endif // TALK_MEDIA_BASE_VIDEOCAPTURER_H_ 405 #endif // TALK_MEDIA_BASE_VIDEOCAPTURER_H_
OLDNEW
« no previous file with comments | « talk/media/base/videoadapter_unittest.cc ('k') | talk/media/base/videocapturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698