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

This commit is contained in:
[CST] Focus
2015-05-29 15:26:55 +03:00
parent d8dcb1da1b
commit 93a0327930
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