OpenShot Library | libopenshot  0.2.5
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.h>
39 #include <QtCore/qstringlist.h>
40 #include <QtCore/qfile.h>
41 #include <QTextStream>
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include "Exceptions.h"
45 #include "Fraction.h"
46 #include "Json.h"
47 
48 namespace openshot
49 {
50 
51  /**
52  * @brief This struct holds profile data, typically loaded from a file
53  *
54  * Profile data contains common settings for Writers, such as frame rate,
55  * aspect ratios, width, and height combinations.
56  */
57  struct ProfileInfo
58  {
59  std::string description; ///< The description of this profile.
60  int height; ///< The height of the video (in pixels)
61  int width; ///< The width of the video (in pixels)
62  int pixel_format; ///< The pixel format (i.e. YUV420P, RGB24, etc...)
63  Fraction fps; ///< Frames per second, as a fraction (i.e. 24/1 = 24 fps)
64  Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
65  Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
66  bool interlaced_frame; // Are the contents of this frame interlaced
67  };
68 
69  /**
70  * @brief This class loads a special text-based file called a Profile.
71  *
72  * Profile data contains common video settings, such as framerate, height, width,
73  * aspect ratio, etc... All derived classes from openshot::WriterBase can load profile
74  * data using this class.
75  *
76  * \code
77  * // This example demonstrates how to load a profile with this class.
78  * Profile p("/home/jonathan/dv_ntsc_wide"); // Load the DV NTSC Widt profile data.
79  *
80  * \endcode
81  */
82  class Profile
83  {
84  public:
85  /// Profile data stored here
87 
88  /// @brief Constructor for Profile.
89  /// @param path The folder path / location of a profile file
90  Profile(std::string path);
91 
92  /// Get and Set JSON methods
93  std::string Json() const; ///< Generate JSON string of this object
94  Json::Value JsonValue() const; ///< Generate Json::Value for this object
95  void SetJson(const std::string value); ///< Load JSON string into this object
96  void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
97  };
98 
99 }
100 
101 #endif
Header file for all Exception classes.
Header file for Fraction class.
Header file for JSON class.
This class represents a fraction.
Definition: Fraction.h:45
This class loads a special text-based file called a Profile.
Definition: Profiles.h:83
Profile(std::string path)
Constructor for Profile.
Definition: Profiles.cpp:38
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Definition: Profiles.cpp:183
std::string Json() const
Get and Set JSON methods.
Definition: Profiles.cpp:136
ProfileInfo info
Profile data stored here.
Definition: Profiles.h:86
void SetJson(const std::string value)
Load JSON string into this object.
Definition: Profiles.cpp:166
Json::Value JsonValue() const
Generate Json::Value for this object.
Definition: Profiles.cpp:143
This namespace is the default namespace for all code in the openshot library.
This struct holds profile data, typically loaded from a file.
Definition: Profiles.h:58
std::string description
The description of this profile.
Definition: Profiles.h:59
int width
The width of the video (in pixels)
Definition: Profiles.h:61
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
Definition: Profiles.h:64
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:65
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Definition: Profiles.h:63
int height
The height of the video (in pixels)
Definition: Profiles.h:60
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
Definition: Profiles.h:62