Merge remote-tracking branch 'martiis-libstb-hal/master'

Origin commit data
------------------
Branch: master
Commit: ad87948717
Author: max_10 <max_10@gmx.de>
Date: 2014-05-29 (Thu, 29 May 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
max_10
2014-05-29 23:30:15 +02:00
6 changed files with 38 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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"

View File

@@ -384,3 +384,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();
}

View File

@@ -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
void SetTitle(int title); void SetTitle(int title);
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);