From 669ab051de92f8c726b523d0f216d75c6c26b393 Mon Sep 17 00:00:00 2001 From: Denis Dolzhenko Date: Thu, 1 Dec 2016 14:29:18 +0200 Subject: [PATCH] TizenRefApp-7502 Video preview isn't displayed in Slideshow during call Change-Id: Id6abc535e911a382827c3b4dc25d958d95f40fd5 Signed-off-by: Denis Dolzhenko --- src/Viewer/Controller/src/SmilPage.cpp | 9 ++++++++- src/Viewer/View/inc/SmilVideoItemView.h | 4 ++-- src/Viewer/View/src/SmilVideoItemView.cpp | 9 +++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Viewer/Controller/src/SmilPage.cpp b/src/Viewer/Controller/src/SmilPage.cpp index 53b66cc5..771cc69d 100644 --- a/src/Viewer/Controller/src/SmilPage.cpp +++ b/src/Viewer/Controller/src/SmilPage.cpp @@ -22,6 +22,7 @@ #include "SmilVideoItemView.h" #include "Logger.h" #include "FileUtils.h" +#include "PathUtils.h" #include "MediaPlayer.h" #include "MediaUtils.h" #include @@ -252,7 +253,13 @@ void SmilPage::buildVideo(const MsgMedia& media) m_HasInvalidFiles = true; return; } - SmilVideoItemView *item = new SmilVideoItemView(getBox(), width, height); + + std::string thumbPath = FileUtils::genUniqueFilePath(PathUtils::getDataPath(""), "thumbnail.jpg"); + if (!thumbPath.empty()) + MediaUtils::getVideoFrame(m_MediaPath, thumbPath); + + SmilVideoItemView *item = new SmilVideoItemView(getBox(), width, height, thumbPath); + remove(thumbPath.c_str()); m_pVideoSink = item->getVideoSink(); item->show(); appendItem(*item); diff --git a/src/Viewer/View/inc/SmilVideoItemView.h b/src/Viewer/View/inc/SmilVideoItemView.h index f30ffb12..11fd76b2 100644 --- a/src/Viewer/View/inc/SmilVideoItemView.h +++ b/src/Viewer/View/inc/SmilVideoItemView.h @@ -25,13 +25,13 @@ namespace Msg : public View { public: - SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight); + SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight, const std::string &thumbPath); virtual ~SmilVideoItemView(); Evas_Object *getVideoSink() const; private: - Evas_Object *createImage(Evas_Object *parent, int width, int height); + Evas_Object *createImage(Evas_Object *parent, int width, int height, const std::string &thumbPath); private: Evas_Object *m_pVideoSink; diff --git a/src/Viewer/View/src/SmilVideoItemView.cpp b/src/Viewer/View/src/SmilVideoItemView.cpp index c7648a57..0536f177 100644 --- a/src/Viewer/View/src/SmilVideoItemView.cpp +++ b/src/Viewer/View/src/SmilVideoItemView.cpp @@ -49,7 +49,7 @@ namespace } } -SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight) +SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight, const std::string &thumbPath) : m_pVideoSink(nullptr) { int w = 0; @@ -59,7 +59,7 @@ SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int vi getResizedSize(videoWidth, videoHeight, w, h); setEo(addLayout(parent, SMIL_ITEM_EDJ_PATH, "smil_video_item")); - Evas_Object *image = createImage(getEo(), w, h); + Evas_Object *image = createImage(getEo(), w, h, thumbPath); setContent(image, "swallow.thumbnail"); } @@ -72,11 +72,12 @@ Evas_Object *SmilVideoItemView::getVideoSink() const return m_pVideoSink; } -Evas_Object *SmilVideoItemView::createImage(Evas_Object *parent, int width, int height) +Evas_Object *SmilVideoItemView::createImage(Evas_Object *parent, int width, int height, const std::string &thumbPath) { Evas *evas = evas_object_evas_get(parent); m_pVideoSink = evas_object_image_filled_add(evas); - expand(m_pVideoSink); + evas_object_image_file_set(m_pVideoSink, thumbPath.c_str(), nullptr); + evas_object_image_fill_set(m_pVideoSink, 0, 0, width, height); evas_object_size_hint_min_set(m_pVideoSink, width, height); evas_object_size_hint_max_set(m_pVideoSink, width, height); evas_object_show(m_pVideoSink); -- 2.34.1