[DEV] set multithread decoding...

This commit is contained in:
Edouard DUPIN 2016-11-15 23:51:33 +01:00
parent f0407db37f
commit d136aa51fb
4 changed files with 29 additions and 9 deletions

View File

@ -68,9 +68,16 @@ namespace appl {
// set application widget:
appl::widget::VideoDisplay::createManagerWidget(_context.getWidgetManager());
// Create the windows
ewol::widget::WindowsShared basicWindows = appl::Windows::create();
ememory::SharedPtr<appl::Windows> basicWindows = appl::Windows::create();
// configure the ewol context to use the new windows
_context.setWindows(basicWindows);
for (int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii);
if (etk::start_with(tmpppp, "-") == true) {
continue;
}
basicWindows->addFile(tmpppp);
}
}
};
}

View File

@ -11,7 +11,8 @@
#include <ewol/widget/Button.hpp>
#include <appl/widget/VideoPlayer.hpp>
appl::Windows::Windows() {
appl::Windows::Windows():
m_id(0) {
addObjectType("appl::Windows");
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
}
@ -57,27 +58,35 @@ void appl::Windows::init() {
void appl::Windows::onCallbackPrevious() {
ememory::SharedPtr<appl::widget::VideoDisplay> tmpDisp = ememory::dynamicPointerCast<appl::widget::VideoDisplay>(getSubObjectNamed("displayer"));
if (tmpDisp != nullptr) {
// TODO : tmpDisp->...
m_id--;
if (m_id < 0) {
m_id = m_list.size()-1;
}
onCallbackPlay();
}
void appl::Windows::onCallbackPlay() {
ememory::SharedPtr<appl::widget::VideoDisplay> tmpDisp = ememory::dynamicPointerCast<appl::widget::VideoDisplay>(getSubObjectNamed("displayer"));
if (tmpDisp != nullptr) {
tmpDisp->setFile("/home/heero/Downloads/Mademoiselle Zazie-e18-Myrtille.mp4");
tmpDisp->setFile(m_list[m_id]);
}
}
void appl::Windows::onCallbackNext() {
ememory::SharedPtr<appl::widget::VideoDisplay> tmpDisp = ememory::dynamicPointerCast<appl::widget::VideoDisplay>(getSubObjectNamed("displayer"));
if (tmpDisp != nullptr) {
// TODO : tmpDisp->...
m_id++;
if (m_id >= m_list.size()) {
m_id = 0;
}
onCallbackPlay();
}
void appl::Windows::onCallbackFPS(const int32_t& _fps) {
APPL_PRINT("FPS = " << _fps);
propertySetOnWidgetNamed("lb-fps", "value", "FPS=<font color='orangered'>" + etk::to_string(_fps) + "</font>");
}
void appl::Windows::addFile(const std::string& _file) {
APPL_PRINT("Add file : " << _file);
m_list.push_back(_file);
}

View File

@ -17,6 +17,8 @@ namespace appl {
Windows();
void init();
ewol::widget::ComposerShared m_composer;
std::vector<std::string> m_list;
int32_t m_id;
public:
DECLARE_FACTORY(Windows);
public: // callback functions
@ -24,6 +26,7 @@ namespace appl {
void onCallbackPlay();
void onCallbackNext();
void onCallbackFPS(const int32_t& _fps);
void addFile(const std::string& _file);
};
}

View File

@ -137,6 +137,7 @@ int appl::Decoder::open_codec_context(int *_streamId, AVFormatContext *_formatCo
}
// Init the decoders, with or without reference counting
av_dict_set(&opts, "refcounted_frames", m_refCount ? "1" : "0", 0);
av_dict_set(&opts, "threads", "auto", 0);
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
APPL_ERROR("Failed to open " << av_get_media_type_string(_type) << " codec");
return ret;