Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/video_coding/codecs/test_framework/video_source.h @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 3.8 KB
Line 
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_CODECS_TEST_FRAMEWORK_VIDEO_SOURCE_H_
12#define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_FRAMEWORK_VIDEO_SOURCE_H_
13
14#include <string>
15#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
16
17enum VideoSize
18    {
19        kUndefined,
20        kSQCIF,     // 128*96       = 12 288
21        kQQVGA,     // 160*120      = 19 200
22        kQCIF,      // 176*144      = 25 344
23        kCGA,       // 320*200      = 64 000
24        kQVGA,      // 320*240      = 76 800
25        kSIF,       // 352*240      = 84 480
26        kWQVGA,     // 400*240      = 96 000
27        kCIF,       // 352*288      = 101 376
28        kW288p,     // 512*288      = 147 456 (WCIF)
29        k448p,      // 576*448      = 281 088
30        kVGA,       // 640*480      = 307 200
31        k432p,      // 720*432      = 311 040
32        kW432p,     // 768*432      = 331 776
33        k4SIF,      // 704*480      = 337 920
34        kW448p,     // 768*448      = 344 064
35        kNTSC,          // 720*480      = 345 600
36        kFW448p,    // 800*448      = 358 400
37        kWVGA,      // 800*480      = 384 000
38        k4CIF,      // 704ï¿œ576      = 405 504
39        kSVGA,      // 800*600      = 480 000
40        kW544p,     // 960*544      = 522 240
41        kW576p,     // 1024*576     = 589 824 (W4CIF)
42        kHD,        // 960*720      = 691 200
43        kXGA,       // 1024*768     = 786 432
44        kWHD,       // 1280*720     = 921 600
45        kFullHD,    // 1440*1080    = 1 555 200
46        kWFullHD,   // 1920*1080    = 2 073 600
47
48        kNumberOfVideoSizes
49    };
50
51class VideoSource
52{
53public:
54    VideoSource();
55    VideoSource(std::string fileName, VideoSize size, int frameRate = 30,
56        webrtc::VideoType type = webrtc::kI420);
57    VideoSource(std::string fileName, int width, int height, int frameRate = 30,
58                webrtc::VideoType type = webrtc::kI420);
59
60    std::string GetFileName() const { return _fileName; }
61    int GetWidth() const { return _width; }
62    int GetHeight() const { return _height; }
63    webrtc::VideoType GetType() const { return _type; }
64    int GetFrameRate() const { return _frameRate; }
65
66    // Returns the file path without a trailing slash.
67    std::string GetFilePath() const;
68
69    // Returns the filename with the path (including the leading slash) removed.
70    std::string GetName() const;
71
72    VideoSize GetSize() const;
73    static VideoSize GetSize(uint16_t width, uint16_t height);
74    unsigned int GetFrameLength() const;
75
76    // Returns a human-readable size string.
77    static const char* GetSizeString(VideoSize size);
78    const char* GetMySizeString() const;
79
80    // Opens the video source, converting and writing to the specified target.
81    // If force is true, the conversion will be done even if the target file
82    // already exists.
83    void Convert(const VideoSource& target, bool force = false) const;
84    static bool FileExists(const char* fileName);
85private:
86    static int GetWidthHeight( VideoSize size, int& width, int& height);
87    std::string _fileName;
88    int _width;
89    int _height;
90    webrtc::VideoType _type;
91    int _frameRate;
92};
93
94class FrameDropper
95{
96public:
97    FrameDropper();
98    bool DropFrame();
99    unsigned int DropsBetweenRenders();
100    void SetFrameRate(double frameRate, double maxFrameRate);
101
102private:
103    unsigned int _dropsBetweenRenders;
104    unsigned int _frameCounter;
105};
106
107
108#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_FRAMEWORK_VIDEO_SOURCE_H_
Note: See TracBrowser for help on using the repository browser.