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