OpenShot Library | libopenshot 0.2.7
Profiles.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Header file for Profile class
4 * @author Jonathan Thomas <jonathan@openshot.org>
5 *
6 * @ref License
7 */
8
9/* LICENSE
10 *
11 * Copyright (c) 2008-2019 OpenShot Studios, LLC
12 * <http://www.openshotstudios.com/>. This file is part of
13 * OpenShot Library (libopenshot), an open-source project dedicated to
14 * delivering high quality video editing and animation solutions to the
15 * world. For more information visit <http://www.openshot.org/>.
16 *
17 * OpenShot Library (libopenshot) is free software: you can redistribute it
18 * and/or modify it under the terms of the GNU Lesser General Public License
19 * as published by the Free Software Foundation, either version 3 of the
20 * License, or (at your option) any later version.
21 *
22 * OpenShot Library (libopenshot) is distributed in the hope that it will be
23 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public License
28 * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29 */
30
31#ifndef OPENSHOT_PROFILE_H
32#define OPENSHOT_PROFILE_H
33
34#include <iostream>
35#include <string>
36#include <sstream>
37#include <fstream>
38#include <QtCore/QString>
39#include <QtCore/QStringList>
40#include <QtCore/QFile>
41#include <QTextStream>
42#include <cstdio>
43#include <cstdlib>
44#include "Fraction.h"
45#include "Json.h"
46
47namespace openshot
48{
49
50 /**
51 * @brief This struct holds profile data, typically loaded from a file
52 *
53 * Profile data contains common settings for Writers, such as frame rate,
54 * aspect ratios, width, and height combinations.
55 */
57 {
58 std::string description; ///< The description of this profile.
59 int height; ///< The height of the video (in pixels)
60 int width; ///< The width of the video (in pixels)
61 int pixel_format; ///< The pixel format (i.e. YUV420P, RGB24, etc...)
62 Fraction fps; ///< Frames per second, as a fraction (i.e. 24/1 = 24 fps)
63 Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
64 Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
65 bool interlaced_frame; // Are the contents of this frame interlaced
66 };
67
68 /**
69 * @brief This class loads a special text-based file called a Profile.
70 *
71 * Profile data contains common video settings, such as framerate, height, width,
72 * aspect ratio, etc... All derived classes from openshot::WriterBase can load profile
73 * data using this class.
74 *
75 * \code
76 * // This example demonstrates how to load a profile with this class.
77 * Profile p("/home/jonathan/dv_ntsc_wide"); // Load the DV NTSC Widt profile data.
78 *
79 * \endcode
80 */
81 class Profile
82 {
83 public:
84 /// Profile data stored here
86
87 /// @brief Constructor for Profile.
88 /// @param path The folder path / location of a profile file
89 Profile(std::string path);
90
91 // Get and Set JSON methods
92 std::string Json() const; ///< Generate JSON string of this object
93 Json::Value JsonValue() const; ///< Generate Json::Value for this object
94 void SetJson(const std::string value); ///< Load JSON string into this object
95 void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
96 };
97
98}
99
100#endif
Header file for Fraction class.
Header file for JSON class.
This class represents a fraction.
Definition: Fraction.h:48
This class loads a special text-based file called a Profile.
Definition: Profiles.h:82
Profile(std::string path)
Constructor for Profile.
Definition: Profiles.cpp:39
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Definition: Profiles.cpp:184
std::string Json() const
Generate JSON string of this object.
Definition: Profiles.cpp:137
ProfileInfo info
Profile data stored here.
Definition: Profiles.h:85
void SetJson(const std::string value)
Load JSON string into this object.
Definition: Profiles.cpp:167
Json::Value JsonValue() const
Generate Json::Value for this object.
Definition: Profiles.cpp:144
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:47
This struct holds profile data, typically loaded from a file.
Definition: Profiles.h:57
std::string description
The description of this profile.
Definition: Profiles.h:58
int width
The width of the video (in pixels)
Definition: Profiles.h:60
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
Definition: Profiles.h:63
Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
Definition: Profiles.h:64
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Definition: Profiles.h:62
int height
The height of the video (in pixels)
Definition: Profiles.h:59
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
Definition: Profiles.h:61