• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <string>
15 
16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
17 #include "webrtc/typedefs.h"
18 
19 enum VideoSize {
20   kUndefined,
21   kSQCIF,    // 128*96       = 12 288
22   kQQVGA,    // 160*120      = 19 200
23   kQCIF,     // 176*144      = 25 344
24   kCGA,      // 320*200      = 64 000
25   kQVGA,     // 320*240      = 76 800
26   kSIF,      // 352*240      = 84 480
27   kWQVGA,    // 400*240      = 96 000
28   kCIF,      // 352*288      = 101 376
29   kW288p,    // 512*288      = 147 456 (WCIF)
30   k448p,     // 576*448      = 281 088
31   kVGA,      // 640*480      = 307 200
32   k432p,     // 720*432      = 311 040
33   kW432p,    // 768*432      = 331 776
34   k4SIF,     // 704*480      = 337 920
35   kW448p,    // 768*448      = 344 064
36   kNTSC,     // 720*480      = 345 600
37   kFW448p,   // 800*448      = 358 400
38   kWVGA,     // 800*480      = 384 000
39   k4CIF,     // 704*576      = 405 504
40   kSVGA,     // 800*600      = 480 000
41   kW544p,    // 960*544      = 522 240
42   kW576p,    // 1024*576     = 589 824 (W4CIF)
43   kHD,       // 960*720      = 691 200
44   kXGA,      // 1024*768     = 786 432
45   kWHD,      // 1280*720     = 921 600
46   kFullHD,   // 1440*1080    = 1 555 200
47   kWFullHD,  // 1920*1080    = 2 073 600
48 
49   kNumberOfVideoSizes
50 };
51 
52 class VideoSource {
53  public:
54   VideoSource();
55   VideoSource(std::string fileName,
56               VideoSize size,
57               float frameRate,
58               webrtc::VideoType type = webrtc::kI420);
59   VideoSource(std::string fileName,
60               uint16_t width,
61               uint16_t height,
62               float frameRate = 30,
63               webrtc::VideoType type = webrtc::kI420);
64 
GetFileName()65   std::string GetFileName() const { return _fileName; }
GetWidth()66   uint16_t GetWidth() const { return _width; }
GetHeight()67   uint16_t GetHeight() const { return _height; }
GetType()68   webrtc::VideoType GetType() const { return _type; }
GetFrameRate()69   float GetFrameRate() const { return _frameRate; }
70   int GetWidthHeight(VideoSize size);
71 
72   // Returns the filename with the path (including the leading slash) removed.
73   std::string GetName() const;
74 
75   size_t GetFrameLength() const;
76 
77  private:
78   std::string _fileName;
79   uint16_t _width;
80   uint16_t _height;
81   webrtc::VideoType _type;
82   float _frameRate;
83 };
84 
85 #endif  // WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_SOURCE_H_
86