Commit 8741c019 authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: get rid of the useless thread_sys

parent bc4b3050
...@@ -33,42 +33,38 @@ using namespace dash::logic; ...@@ -33,42 +33,38 @@ using namespace dash::logic;
using namespace dash::buffer; using namespace dash::buffer;
DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager, BlockBuffer *buffer) DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager_, BlockBuffer *buffer_)
{ {
this->t_sys = (thread_sys_t *) malloc(sizeof(thread_sys_t)); conManager = conManager_;
this->t_sys->conManager = conManager; buffer = buffer_;
this->t_sys->buffer = buffer;
} }
DASHDownloader::~DASHDownloader () DASHDownloader::~DASHDownloader ()
{ {
this->t_sys->buffer->setEOF(true); buffer->setEOF(true);
vlc_join(this->dashDLThread, NULL); vlc_join(this->dashDLThread, NULL);
free(this->t_sys);
} }
bool DASHDownloader::start () bool DASHDownloader::start ()
{ {
if(vlc_clone(&(this->dashDLThread), download, (void*)this->t_sys, VLC_THREAD_PRIORITY_LOW)) if(vlc_clone(&(this->dashDLThread), download, static_cast<void*>(this), VLC_THREAD_PRIORITY_LOW))
return false; return false;
return true; return true;
} }
void* DASHDownloader::download (void *thread_sys) void* DASHDownloader::download(void *dashDownloader)
{ {
thread_sys_t *t_sys = (thread_sys_t *) thread_sys; DASHDownloader *me = static_cast<DASHDownloader*>(dashDownloader);
HTTPConnectionManager *conManager = t_sys->conManager;
BlockBuffer *buffer = t_sys->buffer;
int ret = 0; int ret = 0;
do do
{ {
block_t *block = NULL; block_t *block = NULL;
ret = conManager->read(Streams::VIDEO, &block); ret = me->conManager->read(Streams::VIDEO, &block);
if(ret > 0) if(ret > 0)
buffer->put(block); me->buffer->put(block);
}while(ret > 0 && !buffer->getEOF()); }while(ret > 0 && !me->buffer->getEOF());
buffer->setEOF(true); me->buffer->setEOF(true);
return NULL; return NULL;
} }
...@@ -35,12 +35,6 @@ ...@@ -35,12 +35,6 @@
namespace dash namespace dash
{ {
struct thread_sys_t
{
dash::http::HTTPConnectionManager *conManager;
buffer::BlockBuffer *buffer;
};
class DASHDownloader class DASHDownloader
{ {
public: public:
...@@ -51,8 +45,9 @@ namespace dash ...@@ -51,8 +45,9 @@ namespace dash
static void* download (void *); static void* download (void *);
private: private:
thread_sys_t *t_sys;
vlc_thread_t dashDLThread; vlc_thread_t dashDLThread;
http::HTTPConnectionManager *conManager;
buffer::BlockBuffer *buffer;
}; };
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment