1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_SOURCE_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_SOURCE_H_ 13 14 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 15 #include "webrtc/typedefs.h" 16 17 #include <string> 18 19 enum VideoSize 20 { 21 kUndefined, 22 kSQCIF, // 128*96 = 12 288 23 kQQVGA, // 160*120 = 19 200 24 kQCIF, // 176*144 = 25 344 25 kCGA, // 320*200 = 64 000 26 kQVGA, // 320*240 = 76 800 27 kSIF, // 352*240 = 84 480 28 kWQVGA, // 400*240 = 96 000 29 kCIF, // 352*288 = 101 376 30 kW288p, // 512*288 = 147 456 (WCIF) 31 k448p, // 576*448 = 281 088 32 kVGA, // 640*480 = 307 200 33 k432p, // 720*432 = 311 040 34 kW432p, // 768*432 = 331 776 35 k4SIF, // 704*480 = 337 920 36 kW448p, // 768*448 = 344 064 37 kNTSC, // 720*480 = 345 600 38 kFW448p, // 800*448 = 358 400 39 kWVGA, // 800*480 = 384 000 40 k4CIF, // 704*576 = 405 504 41 kSVGA, // 800*600 = 480 000 42 kW544p, // 960*544 = 522 240 43 kW576p, // 1024*576 = 589 824 (W4CIF) 44 kHD, // 960*720 = 691 200 45 kXGA, // 1024*768 = 786 432 46 kWHD, // 1280*720 = 921 600 47 kFullHD, // 1440*1080 = 1 555 200 48 kWFullHD, // 1920*1080 = 2 073 600 49 50 kNumberOfVideoSizes 51 }; 52 53 54 class VideoSource 55 { 56 public: 57 VideoSource(); 58 VideoSource(std::string fileName, VideoSize size, float frameRate, webrtc::VideoType type = webrtc::kI420); 59 VideoSource(std::string fileName, uint16_t width, uint16_t height, 60 float frameRate = 30, webrtc::VideoType type = webrtc::kI420); 61 GetFileName()62 std::string GetFileName() const { return _fileName; } GetWidth()63 uint16_t GetWidth() const { return _width; } GetHeight()64 uint16_t GetHeight() const { return _height; } GetType()65 webrtc::VideoType GetType() const { return _type; } GetFrameRate()66 float GetFrameRate() const { return _frameRate; } 67 int GetWidthHeight( VideoSize size); 68 69 // Returns the filename with the path (including the leading slash) removed. 70 std::string GetName() const; 71 72 int32_t GetFrameLength() const; 73 74 private: 75 std::string _fileName; 76 uint16_t _width; 77 uint16_t _height; 78 webrtc::VideoType _type; 79 float _frameRate; 80 }; 81 82 #endif // WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_SOURCE_H_ 83