mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 10:21:04 +02:00
driver/streamts.cpp: add webtv channels streaming for compatible streams
Origin commit data
------------------
Branch: ni/coolstream
Commit: c13eb939fe
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2016-02-05 (Fri, 05 Feb 2016)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -31,12 +31,16 @@
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
typedef std::set<int> stream_pids_t;
|
||||
typedef std::set<int> stream_fds_t;
|
||||
|
||||
class CStreamInstance : public OpenThreads::Thread
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
bool running;
|
||||
cDemux * dmx;
|
||||
CFrontend * frontend;
|
||||
@@ -47,15 +51,16 @@ class CStreamInstance : public OpenThreads::Thread
|
||||
stream_pids_t pids;
|
||||
stream_fds_t fds;
|
||||
|
||||
bool Send(ssize_t r);
|
||||
void Close();
|
||||
void run();
|
||||
virtual bool Send(ssize_t r, unsigned char * _buf = NULL);
|
||||
virtual void Close();
|
||||
virtual void run();
|
||||
friend class CStreamManager;
|
||||
public:
|
||||
CStreamInstance(int clientfd, t_channel_id chid, stream_pids_t &pids);
|
||||
~CStreamInstance();
|
||||
bool Start();
|
||||
bool Stop();
|
||||
virtual ~CStreamInstance();
|
||||
virtual bool Open();
|
||||
virtual bool Start();
|
||||
virtual bool Stop();
|
||||
void AddClient(int clientfd);
|
||||
void RemoveClient(int clientfd);
|
||||
bool HasFd(int fd);
|
||||
@@ -63,6 +68,30 @@ class CStreamInstance : public OpenThreads::Thread
|
||||
t_channel_id GetChannelId() { return channel_id; }
|
||||
};
|
||||
|
||||
class CStreamStream : public CStreamInstance
|
||||
{
|
||||
private:
|
||||
AVFormatContext *ifcx;
|
||||
AVFormatContext *ofcx;
|
||||
AVIOContext *avio_ctx;
|
||||
|
||||
bool stopped;
|
||||
bool interrupt;
|
||||
void run();
|
||||
void Close();
|
||||
|
||||
public:
|
||||
CStreamStream(int clientfd, t_channel_id chid, stream_pids_t &pids);
|
||||
~CStreamStream();
|
||||
|
||||
bool Open();
|
||||
bool Start();
|
||||
bool Stop();
|
||||
|
||||
static int Interrupt(void * data);
|
||||
static int write_packet(void *opaque, uint8_t *buf, int buf_size);
|
||||
};
|
||||
|
||||
typedef std::pair<t_channel_id, CStreamInstance*> streammap_pair_t;
|
||||
typedef std::map<t_channel_id, CStreamInstance*> streammap_t;
|
||||
typedef streammap_t::iterator streammap_iterator_t;
|
||||
@@ -102,5 +131,4 @@ class CStreamManager : public OpenThreads::Thread
|
||||
int GetPort() { return port; }
|
||||
bool AddClient(int fd);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user