Files
libopenshot/include/Player.h
2011-10-11 08:44:27 -05:00

58 lines
1.3 KiB
C++

#ifndef OPENSHOT_PLAYER_H
#define OPENSHOT_PLAYER_H
/**
* \file
* \brief Header file for Frame class
* \author Copyright (c) 2011 Jonathan Thomas
*/
#include <iostream>
#include <vector>
#include "../include/FileReaderBase.h"
#include <SDL.h>
#include <SDL_thread.h>
using namespace std;
namespace openshot
{
typedef void (*CallbackPtr)(int, int, int, const Magick::PixelPacket *Pixels, void *);
/**
* \brief This class is used to playback a video from a reader.
*
* This player does not actually show the video, but rather it invokes a method each time
* a frame should be displayed. This allows the calling application to display the image using
* any toolkit it wishes.
*/
class Player
{
private:
FileReaderBase *reader;
CallbackPtr callback;
void *pythonmethod;
public:
/// Default constructor
Player();
/// Set the current reader, such as a FFmpegReader
void SetReader(FileReaderBase *p_reader);
/// Set a callback function which will be invoked each time a frame is ready to be displayed
void SetFrameCallback(CallbackPtr p_callback, void *p_pythonmethod);
/// Manually invoke function (if any)
void Push();
/// Play the video
void Play();
void putpixel(SDL_Surface *surface, SDL_Overlay *bmp, int x, int y, Uint32 pixel, int pixel_index);
};
}
#endif