mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
libeplayer3: merge Playback to Player class
This commit is contained in:
@@ -37,7 +37,7 @@ class Input
|
||||
bool isContainerRunning;
|
||||
bool terminating;
|
||||
|
||||
Player *context;
|
||||
Player *player;
|
||||
AVFormatContext *avfc;
|
||||
uint64_t readCount;
|
||||
public:
|
||||
|
@@ -47,7 +47,7 @@ class Manager
|
||||
friend class Player;
|
||||
|
||||
private:
|
||||
Player *context;
|
||||
Player *player;
|
||||
OpenThreads::Mutex mutex;
|
||||
std::map<int,Track *> videoTracks, audioTracks, subtitleTracks, teletextTracks;
|
||||
public:
|
||||
|
@@ -32,7 +32,7 @@ class Output
|
||||
Writer *videoWriter, *audioWriter;
|
||||
OpenThreads::Mutex audioMutex, videoMutex;
|
||||
AVStream *audioStream, *videoStream;
|
||||
Player *context;
|
||||
Player *player;
|
||||
public:
|
||||
Output();
|
||||
~Output();
|
||||
|
@@ -1,82 +0,0 @@
|
||||
#ifndef __PLAYBACK_H__
|
||||
#define __PLAYBACK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <OpenThreads/ScopedLock>
|
||||
#include <OpenThreads/Thread>
|
||||
#include <OpenThreads/Condition>
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/time.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswresample/swresample.h>
|
||||
#include <libavutil/opt.h>
|
||||
}
|
||||
|
||||
class Player;
|
||||
class Input;
|
||||
|
||||
class Playback {
|
||||
friend class Player;
|
||||
friend class Input;
|
||||
|
||||
private:
|
||||
Player *context;
|
||||
|
||||
bool isHttp;
|
||||
bool isPaused;
|
||||
bool isCreationPhase;
|
||||
|
||||
bool isSlowMotion;
|
||||
int Speed;
|
||||
int AVSync;
|
||||
|
||||
bool isVideo;
|
||||
bool isAudio;
|
||||
|
||||
std::string url;
|
||||
bool noprobe; /* hack: only minimal probing in av_find_stream_info */
|
||||
|
||||
int hasThreadStarted;
|
||||
|
||||
public:
|
||||
bool isForwarding;
|
||||
bool isBackWard;
|
||||
bool isPlaying;
|
||||
bool abortPlayback;
|
||||
bool abortRequested;
|
||||
uint64_t readCount;
|
||||
|
||||
bool SwitchAudio(int pid);
|
||||
bool SwitchVideo(int pid);
|
||||
bool SwitchTeletext(int pid);
|
||||
bool SwitchSubtitle(int pid);
|
||||
bool GetPts(int64_t &pts);
|
||||
bool GetFrameCount(int64_t &framecount);
|
||||
bool GetDuration(double &duration);
|
||||
bool GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
||||
bool SlowMotion(int repeats);
|
||||
bool FastBackward(int speed);
|
||||
bool FastForward(int speed);
|
||||
bool Open(const char *Url);
|
||||
bool Close();
|
||||
bool Play();
|
||||
bool Pause();
|
||||
bool Continue();
|
||||
bool Stop();
|
||||
bool Seek(float pos, bool absolute);
|
||||
bool Terminate();
|
||||
|
||||
static void* SupervisorThread(void*);
|
||||
|
||||
Playback();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@@ -23,8 +23,6 @@ extern "C" {
|
||||
#include "input.h"
|
||||
#include "output.h"
|
||||
#include "manager.h"
|
||||
#include "playback.h"
|
||||
#include "player.h"
|
||||
|
||||
struct Chapter
|
||||
{
|
||||
@@ -37,27 +35,61 @@ class Player {
|
||||
friend class Input;
|
||||
friend class Output;
|
||||
friend class Manager;
|
||||
friend class Playback;
|
||||
friend class cPlayback;
|
||||
friend int interrupt_cb(void *arg);
|
||||
|
||||
private:
|
||||
Input input;
|
||||
Output output;
|
||||
Manager manager;
|
||||
Playback playback;
|
||||
OpenThreads::Mutex chapterMutex;
|
||||
std::vector<Chapter> chapters;
|
||||
public: //FIXME
|
||||
int64_t *currentAudioPtsP;
|
||||
public:
|
||||
Player()
|
||||
{
|
||||
input.context = this;
|
||||
output.context = this;
|
||||
playback.context = this;
|
||||
manager.context = this;
|
||||
}
|
||||
bool abortPlayback;
|
||||
bool abortRequested;
|
||||
bool isHttp;
|
||||
bool isPaused;
|
||||
bool isCreationPhase;
|
||||
bool isSlowMotion;
|
||||
int Speed;
|
||||
int AVSync;
|
||||
|
||||
bool isVideo;
|
||||
bool isAudio;
|
||||
|
||||
std::string url;
|
||||
bool noprobe; /* hack: only minimal probing in av_find_stream_info */
|
||||
|
||||
int hasThreadStarted;
|
||||
|
||||
static void* SupervisorThread(void*);
|
||||
public:
|
||||
bool isForwarding;
|
||||
bool isBackWard;
|
||||
bool isPlaying;
|
||||
uint64_t readCount;
|
||||
|
||||
bool SwitchAudio(int pid);
|
||||
bool SwitchVideo(int pid);
|
||||
bool SwitchTeletext(int pid);
|
||||
bool SwitchSubtitle(int pid);
|
||||
bool GetPts(int64_t &pts);
|
||||
bool GetFrameCount(int64_t &framecount);
|
||||
bool GetDuration(double &duration);
|
||||
bool GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
||||
bool SlowMotion(int repeats);
|
||||
bool FastBackward(int speed);
|
||||
bool FastForward(int speed);
|
||||
bool Open(const char *Url);
|
||||
bool Close();
|
||||
bool Play();
|
||||
bool Pause();
|
||||
bool Continue();
|
||||
bool Stop();
|
||||
bool Seek(float pos, bool absolute);
|
||||
bool Terminate();
|
||||
bool GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
|
||||
void SetChapters(std::vector<Chapter> &Chapters);
|
||||
Player();
|
||||
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user