2012-08-29 15:29:15 -05:00
|
|
|
#ifndef OPENSHOT_IMAGE_READER_H
|
|
|
|
|
#define OPENSHOT_IMAGE_READER_H
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \file
|
|
|
|
|
* \brief Header file for ImageReader class
|
|
|
|
|
* \author Copyright (c) 2011 Jonathan Thomas
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "FileReaderBase.h"
|
|
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
#include <ctime>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <omp.h>
|
|
|
|
|
#include <stdio.h>
|
2012-10-14 03:43:52 -05:00
|
|
|
#include <tr1/memory>
|
2012-08-29 15:29:15 -05:00
|
|
|
#include "Magick++.h"
|
|
|
|
|
#include "Cache.h"
|
|
|
|
|
#include "Exceptions.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
namespace openshot
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief This class uses the ImageMagick++ libraries, to open image files, and return
|
|
|
|
|
* openshot::Frame objects containing the image.
|
|
|
|
|
*/
|
|
|
|
|
class ImageReader : public FileReaderBase
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
string path;
|
2012-11-08 04:35:21 -06:00
|
|
|
tr1::shared_ptr<Magick::Image> image;
|
2012-10-09 01:45:34 -05:00
|
|
|
bool is_open;
|
2012-08-29 15:29:15 -05:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/// Constructor for ImageReader. This automatically opens the media file and loads
|
|
|
|
|
/// frame 1, or it throws one of the following exceptions.
|
2012-10-10 01:07:47 -05:00
|
|
|
ImageReader(string path) throw(InvalidFile);
|
2012-08-29 15:29:15 -05:00
|
|
|
|
|
|
|
|
/// Close File
|
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
|
|
/// Get an openshot::Frame object for a specific frame number of this reader. All numbers
|
|
|
|
|
/// return the same Frame, since they all share the same image data.
|
|
|
|
|
///
|
|
|
|
|
/// @returns The requested frame (containing the image)
|
|
|
|
|
/// @param[requested_frame] number The frame number that is requested.
|
2012-10-14 03:43:52 -05:00
|
|
|
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
2012-10-08 16:22:18 -05:00
|
|
|
|
|
|
|
|
/// Open File - which is called by the constructor automatically
|
2012-10-09 01:45:34 -05:00
|
|
|
void Open() throw(InvalidFile);
|
2012-08-29 15:29:15 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|