mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
libeplayer3/input: allow access to AVFormatContext
This commit is contained in:
@@ -47,6 +47,8 @@ class Input
|
|||||||
friend int interrupt_cb(void *arg);
|
friend int interrupt_cb(void *arg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
OpenThreads::Mutex mutex;
|
||||||
|
|
||||||
Track *videoTrack;
|
Track *videoTrack;
|
||||||
Track *audioTrack;
|
Track *audioTrack;
|
||||||
Track *subtitleTrack;
|
Track *subtitleTrack;
|
||||||
@@ -81,6 +83,8 @@ class Input
|
|||||||
bool SwitchVideo(Track *track);
|
bool SwitchVideo(Track *track);
|
||||||
bool GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
bool GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
||||||
bool GetReadCount(uint64_t &readcount);
|
bool GetReadCount(uint64_t &readcount);
|
||||||
|
AVFormatContext *GetAVFormatContext();
|
||||||
|
void ReleaseAVFormatContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -114,6 +114,9 @@ class Player {
|
|||||||
void RequestAbort();
|
void RequestAbort();
|
||||||
bool GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
|
bool GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
|
||||||
|
|
||||||
|
AVFormatContext *GetAVFormatContext() { return input.GetAVFormatContext(); }
|
||||||
|
void ReleaseAVFormatContext() { input.ReleaseAVFormatContext(); }
|
||||||
|
|
||||||
Player();
|
Player();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@@ -532,6 +532,7 @@ bool Input::Stop()
|
|||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
if (avfc) {
|
if (avfc) {
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
for (unsigned int i = 0; i < avfc->nb_streams; i++)
|
for (unsigned int i = 0; i < avfc->nb_streams; i++)
|
||||||
avcodec_close(avfc->streams[i]->codec);
|
avcodec_close(avfc->streams[i]->codec);
|
||||||
avformat_close_input(&avfc);
|
avformat_close_input(&avfc);
|
||||||
@@ -542,6 +543,21 @@ bool Input::Stop()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AVFormatContext *Input::GetAVFormatContext()
|
||||||
|
{
|
||||||
|
mutex.lock();
|
||||||
|
if (avfc)
|
||||||
|
return avfc;
|
||||||
|
mutex.unlock();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::ReleaseAVFormatContext()
|
||||||
|
{
|
||||||
|
if (avfc)
|
||||||
|
mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
bool Input::Seek(int64_t avts, bool absolute)
|
bool Input::Seek(int64_t avts, bool absolute)
|
||||||
{
|
{
|
||||||
if (absolute)
|
if (absolute)
|
||||||
|
@@ -36,10 +36,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <OpenThreads/ScopedLock>
|
|
||||||
#include <OpenThreads/Thread>
|
|
||||||
#include <OpenThreads/Condition>
|
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
|
@@ -362,3 +362,12 @@ int cPlayback::GetTeletextPid(void)
|
|||||||
{
|
{
|
||||||
return player->GetTeletextPid();
|
return player->GetTeletextPid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AVFormatContext *cPlayback::GetAVFormatContext()
|
||||||
|
{
|
||||||
|
return player ? player->GetAVFormatContext() : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cPlayback::ReleaseAVFormatContext() { if (player)
|
||||||
|
player->ReleaseAVFormatContext();
|
||||||
|
}
|
||||||
|
@@ -10,9 +10,12 @@ typedef enum {
|
|||||||
} playmode_t;
|
} playmode_t;
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
|
struct AVFormatContext;
|
||||||
|
|
||||||
class cPlayback
|
class cPlayback
|
||||||
{
|
{
|
||||||
|
friend class CStreamInfo2;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool playing;
|
bool playing;
|
||||||
@@ -58,6 +61,9 @@ class cPlayback
|
|||||||
#endif
|
#endif
|
||||||
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
|
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
|
||||||
void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
||||||
|
|
||||||
|
AVFormatContext *GetAVFormatContext();
|
||||||
|
void ReleaseAVFormatContext();
|
||||||
#if 0
|
#if 0
|
||||||
// Functions that are not used by movieplayer.cpp:
|
// Functions that are not used by movieplayer.cpp:
|
||||||
bool GetOffset(off64_t &offset);
|
bool GetOffset(off64_t &offset);
|
||||||
|
Reference in New Issue
Block a user