[DEV] set multithread decoding...
This commit is contained in:
parent
f0407db37f
commit
d136aa51fb
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user