Changed / Refactored many enums and structs, to better standardize the naming of everything. Improved some more descriptions and briefs.

This commit is contained in:
Jonathan Thomas
2013-09-10 12:59:06 -05:00
parent 234201743a
commit cbed47ea5f
26 changed files with 74 additions and 90 deletions

View File

@@ -83,5 +83,6 @@
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

7
.pydevproject Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
</pydev_project>

View File

@@ -41,6 +41,7 @@
using namespace std;
/// This namespace is the default namespace for all code in the openshot library
namespace openshot
{

View File

@@ -42,12 +42,13 @@
#include "AudioBufferSource.h"
#include "Exceptions.h"
/// This namespace is the default namespace for all code in the openshot library.
namespace openshot {
/**
* @brief This class is used to resample audio data for many sequential frames. It maintains some data from the last
* call to GetResampledBuffer(), so there are no pops and clicks between frames.
* @brief This class is used to resample audio data for many sequential frames.
*
* It maintains some data from the last call to GetResampledBuffer(), so there
* are no pops and clicks between frames.
*/
class AudioResampler {
private:

View File

@@ -34,14 +34,13 @@
#include "Frame.h"
#include "Exceptions.h"
/// This namespace is the default namespace for all code in the openshot library.
namespace openshot {
/**
* @brief This class is a cache manager for Frame objects. It is used by FileReaders (such as FFmpegReader) to cache
* recently accessed frames.
* @brief This class is a cache manager for Frame objects.
*
* Due to the high cost of decoding streams, once a frame is decoded, converted to RGB, and a Frame object is created,
* It is used by FileReaders (such as FFmpegReader) to cache recently accessed frames. Due to the
* high cost of decoding streams, once a frame is decoded, converted to RGB, and a Frame object is created,
* it critical to keep these Frames cached for performance reasons. However, the larger the cache, the more memory
* is required. You can set the max number of bytes to cache.
*/

View File

@@ -64,8 +64,8 @@ namespace openshot
};
/**
* @brief This version enumeration allows the user to choose which version
* of the chunk they would like (low quality, medium, or high quality).
* @brief This enumeration allows the user to choose which version
* of the chunk they would like (low, medium, or high quality).
*
* Since chunks contain multiple video streams, this version enumeration
* allows the user to choose which version of the chunk they would like.
@@ -82,7 +82,12 @@ namespace openshot
/**
* @brief This class reads a special chunk-formatted file, which can be easily
* shared in a distributed environment, and can return openshot::Frame objects.
* shared in a distributed environment.
*
* It stores the video in small "chunks", which are really just short video clips,
* a few seconds each. A ChunkReader only needs the part of the chunk that contains
* the frames it is looking for. For example, if you only need the end of a video,
* only the last few chunks might be needed to successfully access those openshot::Frame objects.
*
* \code
* // This example demonstrates how to read a chunk folder and access frame objects inside it.

View File

@@ -9,7 +9,6 @@
#include "../include/Fraction.h"
/// This namespace is the default namespace for all code in the openshot library.
namespace openshot {
/**

View File

@@ -25,9 +25,10 @@ using namespace std;
namespace openshot
{
/**
* @brief This class is used as a simple, dummy reader, which always returns a blank frame, and
* can be created with any framerate or samplerate. This is useful in unit tests that need to test
* different framerates or samplerates.
* @brief This class is used as a simple, dummy reader, which always returns a blank frame.
*
* A dummy reader can be created with any framerate or samplerate. This is useful in unit
* tests that need to test different framerates or samplerates.
*/
class DummyReader : public ReaderBase
{

View File

@@ -50,14 +50,17 @@ using namespace std;
namespace openshot
{
/// This struct holds the associated video frame and starting sample # for an audio packet.
/// Because audio packets do not match up with video frames, this helps determine exactly
/// where the audio packet's samples belong.
struct audio_packet_location
/**
* @brief This struct holds the associated video frame and starting sample # for an audio packet.
*
* Because audio packets do not match up with video frames, this helps determine exactly
* where the audio packet's samples belong.
*/
struct AudioLocation
{
int frame;
int sample_start;
int is_near(audio_packet_location location, int samples_per_frame, int amount);
int is_near(AudioLocation location, int samples_per_frame, int amount);
};
/**
@@ -96,7 +99,7 @@ namespace openshot
map<AVPicture*, AVPicture*> frames;
map<int, int> processing_video_frames;
map<int, int> processing_audio_frames;
audio_packet_location previous_packet_location;
AudioLocation previous_packet_location;
// DEBUG VARIABLES (FOR AUDIO ISSUES)
bool display_debug;
@@ -142,7 +145,7 @@ namespace openshot
tr1::shared_ptr<Frame> CreateFrame(int requested_frame);
/// Calculate Starting video frame and sample # for an audio PTS
audio_packet_location GetAudioPTSLocation(int pts);
AudioLocation GetAudioPTSLocation(int pts);
/// Get an AVFrame (if any)
bool GetAVFrame();

View File

@@ -32,7 +32,7 @@ namespace openshot
/**
* This enumeration designates which a type of stream when encoding
*/
enum Stream_Type
enum StreamType
{
VIDEO_STREAM,
AUDIO_STREAM
@@ -163,7 +163,7 @@ namespace openshot
Fraction pixel_ratio, bool interlaced, bool top_field_first, int bit_rate);
/// Set custom options (some codecs accept additional params)
void SetOption(Stream_Type stream, string name, string value);
void SetOption(StreamType stream, string name, string value);
/// Write the file header (after the options are set)
void WriteHeader();

View File

@@ -29,7 +29,7 @@ namespace openshot
* needed to remove artificial fields added when converting between 24 fps (film)
* and television fps (29.97 fps NTSC or 25 fps PAL).
*/
enum Pulldown_Method
enum PulldownType
{
PULLDOWN_CLASSIC, // Classic 2:3:2:3 pull-down
PULLDOWN_ADVANCED, // Advanced 2:3:3:2 pull-down (minimal dirty frames)
@@ -109,7 +109,7 @@ namespace openshot
bool field_toggle; // Internal odd / even toggle (used when building the mapping)
Framerate original; // The original frame rate
Framerate target; // The target frame rate
Pulldown_Method pulldown; // The pull-down technique
PulldownType pulldown; // The pull-down technique
ReaderBase *reader; // The source video reader
Cache final_cache; // Cache of actual Frame objects
@@ -128,7 +128,7 @@ namespace openshot
public:
/// Default constructor for FrameMapper class
FrameMapper(ReaderBase *reader, Framerate target, Pulldown_Method pulldown);
FrameMapper(ReaderBase *reader, Framerate target, PulldownType pulldown);
/// Close the internal reader
void Close();

View File

@@ -82,7 +82,7 @@ namespace openshot {
void AddPoint(float x, float y);
/// Add a new point on the key-frame, with a specific interpolation type
void AddPoint(float x, float y, Interpolation_Type interpolate);
void AddPoint(float x, float y, InterpolationType interpolate);
/// Set the handles, used for smooth curves. The handles are based on the surrounding points.
void SetHandles(Point current);

View File

@@ -8,7 +8,7 @@
*
* @mainpage OpenShot Video Editing Library C++ API
*
* Welcome to the OpenShot Video Editing Library C++ API | libopenshot. This library was developed to
* Welcome to the OpenShot Video Editing Library (libopenshot) C++ API. This library was developed to
* make high-quality video editing and animation solutions freely available to the world. With a focus
* on stability, performance, and ease-of-use, we believe libopenshot is the best cross-platform,
* open-source video editing library in the world. This library powers

View File

@@ -16,7 +16,7 @@ namespace openshot
* point and this one. Bezier is a smooth curve. Linear is a straight line. Constant is
* is a jump from the previous point to this one.
*/
enum Interpolation_Type {
enum InterpolationType {
BEZIER,
LINEAR,
CONSTANT
@@ -28,7 +28,7 @@ namespace openshot
* automatically, to achieve the smoothest curves. MANUAL will leave the handles
* alone, making it the responsibility of the user to set them.
*/
enum Handle_Type {
enum HandleType {
AUTO,
MANUAL
};
@@ -56,8 +56,8 @@ namespace openshot
Coordinate co; ///< This is the primary coordinate
Coordinate handle_left; ///< This is the left handle coordinate
Coordinate handle_right; ///< This is the right handle coordinate
Interpolation_Type interpolation; ///< This is the interpolation mode
Handle_Type handle_type; ///< This is the handle mode
InterpolationType interpolation; ///< This is the interpolation mode
HandleType handle_type; ///< This is the handle mode
/// Constructor which creates a single coordinate at X=0
Point(float y);
@@ -66,16 +66,16 @@ namespace openshot
Point(float x, float y);
/// Constructor which also creates a Point and sets the X,Y, and interpolation of the Point.
Point(float x, float y, Interpolation_Type interpolation);
Point(float x, float y, InterpolationType interpolation);
// Constructor which takes a coordinate
Point(Coordinate co);
// Constructor which takes a coordinate and interpolation mode
Point(Coordinate co, Interpolation_Type interpolation);
Point(Coordinate co, InterpolationType interpolation);
// Constructor which takes a coordinate, interpolation mode, and handle type
Point(Coordinate co, Interpolation_Type interpolation, Handle_Type handle_type);
Point(Coordinate co, InterpolationType interpolation, HandleType handle_type);
/**
* Set the left and right handles to the same Y coordinate as the primary

View File

@@ -34,7 +34,7 @@ using namespace openshot;
namespace openshot {
/// Comparison method for sorting clip pointers (by Position and Layer)
struct compare_clip_pointers{
struct CompareClips{
bool operator()( Clip* lhs, Clip* rhs){
return lhs->Position() <= rhs->Position() && lhs->Layer() < rhs->Layer();
}};

View File

@@ -29,7 +29,7 @@ include_directories(${SDL_INCLUDE_DIR})
################# QT4 ###################
# Find QT4 libraries
SET(QT_QMAKE_EXECUTABLE '/usr/bin/qmake-qt4') # DEBUB, WORK-AROUND: Force the use of QT4 (when multiple versions are installed)
#SET(QT_QMAKE_EXECUTABLE '/usr/bin/qmake-qt4') # DEBUB, WORK-AROUND: Force the use of QT4 (when multiple versions are installed)
FIND_PACKAGE(Qt4)
# Include Qt headers (needed for compile)

View File

@@ -67,7 +67,7 @@ void FFmpegReader::InitScalers()
}
// This struct holds the associated video frame and starting sample # for an audio packet.
int audio_packet_location::is_near(audio_packet_location location, int samples_per_frame, int amount)
int AudioLocation::is_near(AudioLocation location, int samples_per_frame, int amount)
{
// Is frame even close to this one?
if (abs(location.frame - frame) >= 2)
@@ -523,7 +523,7 @@ tr1::shared_ptr<Frame> FFmpegReader::ReadStream(int requested_frame)
UpdatePTSOffset(false);
// Determine related video frame and starting sample # from audio PTS
audio_packet_location location = GetAudioPTSLocation(packet->pts);
AudioLocation location = GetAudioPTSLocation(packet->pts);
// Process Audio Packet
ProcessAudioPacket(requested_frame, location.frame, location.sample_start);
@@ -1197,7 +1197,7 @@ int FFmpegReader::ConvertFrameToAudioPTS(int frame_number)
}
// Calculate Starting video frame and sample # for an audio PTS
audio_packet_location FFmpegReader::GetAudioPTSLocation(int pts)
AudioLocation FFmpegReader::GetAudioPTSLocation(int pts)
{
// Apply PTS offset
pts = pts + audio_pts_offset;
@@ -1229,7 +1229,7 @@ audio_packet_location FFmpegReader::GetAudioPTSLocation(int pts)
sample_start = 0;
// Prepare final audio packet location
audio_packet_location location = {whole_frame, sample_start};
AudioLocation location = {whole_frame, sample_start};
// Compare to previous audio packet (and fix small gaps due to varying PTS timestamps)
if (previous_packet_location.frame != -1 && location.is_near(previous_packet_location, samples_per_frame, samples_per_frame))

View File

@@ -175,7 +175,7 @@ void FFmpegWriter::SetAudioOptions(bool has_audio, string codec, int sample_rate
}
// Set custom options (some codecs accept additional params)
void FFmpegWriter::SetOption(Stream_Type stream, string name, string value)
void FFmpegWriter::SetOption(StreamType stream, string name, string value)
{
// Declare codec context
AVCodecContext *c = NULL;

View File

@@ -9,7 +9,7 @@
using namespace std;
using namespace openshot;
FrameMapper::FrameMapper(ReaderBase *reader, Framerate target, Pulldown_Method pulldown) :
FrameMapper::FrameMapper(ReaderBase *reader, Framerate target, PulldownType pulldown) :
reader(reader), target(target), pulldown(pulldown), final_cache(820 * 1024)
{

View File

@@ -79,7 +79,7 @@ void Keyframe::AddPoint(float x, float y)
}
// Add a new point on the key-frame, with a specific interpolation type
void Keyframe::AddPoint(float x, float y, Interpolation_Type interpolate)
void Keyframe::AddPoint(float x, float y, InterpolationType interpolate)
{
// Create a point
Point new_point(x, y, interpolate);

Some files were not shown because too many files have changed in this diff Show More