gui/movieplayer.cpp, neutrino.cpp: add webtv subtitles support

Origin commit data
------------------
Branch: ni/coolstream
Commit: 93a0327930
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2015-05-29 (Fri, 29 May 2015)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2015-05-29 15:26:55 +03:00
parent d11e931c4d
commit 5c67dbb6f3
3 changed files with 28 additions and 6 deletions

View File

@@ -163,6 +163,7 @@ void CMoviePlayerGui::Init(void)
max_y = 0;
ext_subs = false;
iso_file = false;
lock_subs = false;
bgThread = 0;
info_1 = "";
info_2 = "";
@@ -619,7 +620,7 @@ void* CMoviePlayerGui::bgPlayThread(void *arg)
eof++;
else
eof = 0;
if (eof > 2) {
if (eof > 5) {
printf("CMoviePlayerGui::bgPlayThread: playback stopped, try to rezap...\n");
t_channel_id * chid = new t_channel_id;
*chid = mp->movie_info.epgId;
@@ -633,6 +634,7 @@ void* CMoviePlayerGui::bgPlayThread(void *arg)
bgmutex.unlock();
if (res == 0)
break;
mp->showSubtitle(0);
}
printf("%s: play end...\n", __func__);
mp->PlayFileEnd();
@@ -1776,7 +1778,7 @@ extern "C" {
#include <libavcodec/avcodec.h>
}
void CMoviePlayerGui::clearSubtitle()
void CMoviePlayerGui::clearSubtitle(bool lock)
{
if ((max_x-min_x > 0) && (max_y-min_y > 0))
frameBuffer->paintBackgroundBoxRel(min_x, min_y, max_x-min_x, max_y-min_y);
@@ -1786,6 +1788,7 @@ void CMoviePlayerGui::clearSubtitle()
max_x = CFrameBuffer::getInstance()->getScreenX();
max_y = CFrameBuffer::getInstance()->getScreenY();
end_time = 0;
lock_subs = lock;
}
fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors, int ox, int oy, int dx, int dy);
@@ -1824,6 +1827,15 @@ bool CMoviePlayerGui::convertSubtitle(std::string &text)
void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data)
{
AVSubtitle * sub = (AVSubtitle *) data;
if (lock_subs) {
if (sub) {
avsubtitle_free(sub);
delete sub;
}
return;
}
if (!data) {
if (end_time && time_monotonic_ms() > end_time) {
printf("************************* hide subs *************************\n");
@@ -1831,7 +1843,6 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data)
}
return;
}
AVSubtitle * sub = (AVSubtitle *) data;
printf("************************* EVT_SUBT_MESSAGE: num_rects %d fmt %d *************************\n", sub->num_rects, sub->format);
#if 0

View File

@@ -104,6 +104,7 @@ class CMoviePlayerGui : public CMenuTarget
int min_x, min_y, max_x, max_y;
time_t end_time;
bool ext_subs;
bool lock_subs;
/* playback from MB */
bool isMovieBrowser;
@@ -161,10 +162,7 @@ class CMoviePlayerGui : public CMenuTarget
bool SelectFile();
void updateLcd();
void selectSubtitle();
bool convertSubtitle(std::string &text);
void showSubtitle(neutrino_msg_data_t data);
void clearSubtitle();
void selectChapter();
void selectAutoLang();
void parsePlaylist(CFile *file);
@@ -205,6 +203,9 @@ class CMoviePlayerGui : public CMenuTarget
void Pause(bool b = true);
void selectAudioPid();
bool SetPosition(int pos, bool absolute = false);
void selectSubtitle();
void showSubtitle(neutrino_msg_data_t data);
void clearSubtitle(bool lock = false);
};
#endif