OpenShot Library | libopenshot  0.1.9
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  * @section LICENSE
7  *
8  * Copyright (c) 2008-2014 OpenShot Studios, LLC
9  * <http://www.openshotstudios.com/>. This file is part of
10  * OpenShot Library (libopenshot), an open-source project dedicated to
11  * delivering high quality video editing and animation solutions to the
12  * world. For more information visit <http://www.openshot.org/>.
13  *
14  * OpenShot Library (libopenshot) is free software: you can redistribute it
15  * and/or modify it under the terms of the GNU Lesser General Public License
16  * as published by the Free Software Foundation, either version 3 of the
17  * License, or (at your option) any later version.
18  *
19  * OpenShot Library (libopenshot) is distributed in the hope that it will be
20  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #ifndef OPENSHOT_PROFILE_H
29 #define OPENSHOT_PROFILE_H
30 
31 #include <iostream>
32 #include <string>
33 #include <sstream>
34 #include <fstream>
35 #include <QtCore/qstring.h>
36 #include <QtCore/qstringlist.h>
37 #include <QtCore/qfile.h>
38 #include <QTextStream>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include "Exceptions.h"
42 #include "Fraction.h"
43 #include "Json.h"
44 
45 using namespace std;
46 
47 namespace 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  */
56  struct ProfileInfo
57  {
58  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(string path);
90 
91  /// Get and Set JSON methods
92  string Json(); ///< Generate JSON string of this object
93  Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
94  void SetJson(string value); ///< Load JSON string into this object
95  void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
96  };
97 
98 }
99 
100 #endif
Header file for Fraction class.
ProfileInfo info
Profile data stored here.
Definition: Profiles.h:85
string description
The description of this profile.
Definition: Profiles.h:58
Header file for all Exception classes.
Header file for JSON class.
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) ...
Definition: Profiles.h:63
This class represents a fraction.
Definition: Fraction.h:42
This class loads a special text-based file called a Profile.
Definition: Profiles.h:81
This struct holds profile data, typically loaded from a file.
Definition: Profiles.h:56
int width
The width of the video (in pixels)
Definition: Profiles.h:60
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Definition: Profiles.h:62
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
Definition: Profiles.h:61
int height
The height of the video (in pixels)
Definition: Profiles.h:59
This namespace is the default namespace for all code in the openshot library.
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