OpenShot Library | libopenshot  0.2.6
Deinterlace.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for De-interlace 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_DEINTERLACE_EFFECT_H
32 #define OPENSHOT_DEINTERLACE_EFFECT_H
33 
34 #include "../EffectBase.h"
35 
36 #include <string>
37 #include <memory>
38 #include "../Frame.h"
39 #include "../Json.h"
40 #include "../KeyFrame.h"
41 
42 namespace openshot
43 {
44 
45  /**
46  * @brief This class uses the ImageMagick++ libraries, to de-interlace the image, which
47  * removes the EVEN or ODD horizontal lines (which represent different points of time).
48  *
49  * This is most useful when converting video made for traditional TVs to computers,
50  * which are not interlaced.
51  */
52  class Deinterlace : public EffectBase
53  {
54  private:
55  bool isOdd;
56 
57  /// Init effect settings
58  void init_effect_details();
59 
60  public:
61 
62  /// Default constructor, useful when using Json to load the effect properties
63  Deinterlace();
64 
65  /// Constructor
66  Deinterlace(bool isOdd);
67 
68  /// @brief This method is required for all derived classes of ClipBase, and returns a
69  /// new openshot::Frame object. All Clip keyframes and effects are resolved into
70  /// pixels.
71  ///
72  /// @returns A new openshot::Frame object
73  /// @param frame_number The frame number (starting at 1) of the clip or effect on the timeline.
74  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
75 
76  /// @brief This method is required for all derived classes of ClipBase, and returns a
77  /// modified openshot::Frame object
78  ///
79  /// The frame object is passed into this method and used as a starting point (pixels and audio).
80  /// All Clip keyframes and effects are resolved into pixels.
81  ///
82  /// @returns The modified openshot::Frame object
83  /// @param frame The frame object that needs the clip or effect applied to it
84  /// @param frame_number The frame number (starting at 1) of the clip or effect on the timeline.
85  std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
86 
87  // Get and Set JSON methods
88  std::string Json() const override; ///< Generate JSON string of this object
89  void SetJson(const std::string value) override; ///< Load JSON string into this object
90  Json::Value JsonValue() const override; ///< Generate Json::Value for this object
91  void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
92 
93  // Get all properties for a specific frame
94  std::string PropertiesJSON(int64_t requested_frame) const override;
95  };
96 
97 }
98 
99 #endif
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:70
std::string PropertiesJSON(int64_t requested_frame) const override
Json::Value JsonValue() const override
Generate Json::Value for this object.
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition: Deinterlace.h:74
void SetJson(const std::string value) override
Load JSON string into this object.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
std::string Json() const override
Generate JSON string of this object.
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:46
This class uses the ImageMagick++ libraries, to de-interlace the image, which removes the EVEN or ODD...
Definition: Deinterlace.h:52
Deinterlace()
Default constructor, useful when using Json to load the effect properties.
Definition: Deinterlace.cpp:37