mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
gui/movieplayer.cpp, neutrino.cpp: add webtv subtitles support
This commit is contained in:
@@ -163,6 +163,7 @@ void CMoviePlayerGui::Init(void)
|
|||||||
max_y = 0;
|
max_y = 0;
|
||||||
ext_subs = false;
|
ext_subs = false;
|
||||||
iso_file = false;
|
iso_file = false;
|
||||||
|
lock_subs = false;
|
||||||
bgThread = 0;
|
bgThread = 0;
|
||||||
info_1 = "";
|
info_1 = "";
|
||||||
info_2 = "";
|
info_2 = "";
|
||||||
@@ -619,7 +620,7 @@ void* CMoviePlayerGui::bgPlayThread(void *arg)
|
|||||||
eof++;
|
eof++;
|
||||||
else
|
else
|
||||||
eof = 0;
|
eof = 0;
|
||||||
if (eof > 2) {
|
if (eof > 5) {
|
||||||
printf("CMoviePlayerGui::bgPlayThread: playback stopped, try to rezap...\n");
|
printf("CMoviePlayerGui::bgPlayThread: playback stopped, try to rezap...\n");
|
||||||
t_channel_id * chid = new t_channel_id;
|
t_channel_id * chid = new t_channel_id;
|
||||||
*chid = mp->movie_info.epgId;
|
*chid = mp->movie_info.epgId;
|
||||||
@@ -633,6 +634,7 @@ void* CMoviePlayerGui::bgPlayThread(void *arg)
|
|||||||
bgmutex.unlock();
|
bgmutex.unlock();
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
break;
|
break;
|
||||||
|
mp->showSubtitle(0);
|
||||||
}
|
}
|
||||||
printf("%s: play end...\n", __func__);
|
printf("%s: play end...\n", __func__);
|
||||||
mp->PlayFileEnd();
|
mp->PlayFileEnd();
|
||||||
@@ -1776,7 +1778,7 @@ extern "C" {
|
|||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMoviePlayerGui::clearSubtitle()
|
void CMoviePlayerGui::clearSubtitle(bool lock)
|
||||||
{
|
{
|
||||||
if ((max_x-min_x > 0) && (max_y-min_y > 0))
|
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);
|
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_x = CFrameBuffer::getInstance()->getScreenX();
|
||||||
max_y = CFrameBuffer::getInstance()->getScreenY();
|
max_y = CFrameBuffer::getInstance()->getScreenY();
|
||||||
end_time = 0;
|
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);
|
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)
|
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 (!data) {
|
||||||
if (end_time && time_monotonic_ms() > end_time) {
|
if (end_time && time_monotonic_ms() > end_time) {
|
||||||
printf("************************* hide subs *************************\n");
|
printf("************************* hide subs *************************\n");
|
||||||
@@ -1831,7 +1843,6 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AVSubtitle * sub = (AVSubtitle *) data;
|
|
||||||
|
|
||||||
printf("************************* EVT_SUBT_MESSAGE: num_rects %d fmt %d *************************\n", sub->num_rects, sub->format);
|
printf("************************* EVT_SUBT_MESSAGE: num_rects %d fmt %d *************************\n", sub->num_rects, sub->format);
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -104,6 +104,7 @@ class CMoviePlayerGui : public CMenuTarget
|
|||||||
int min_x, min_y, max_x, max_y;
|
int min_x, min_y, max_x, max_y;
|
||||||
time_t end_time;
|
time_t end_time;
|
||||||
bool ext_subs;
|
bool ext_subs;
|
||||||
|
bool lock_subs;
|
||||||
|
|
||||||
/* playback from MB */
|
/* playback from MB */
|
||||||
bool isMovieBrowser;
|
bool isMovieBrowser;
|
||||||
@@ -161,10 +162,7 @@ class CMoviePlayerGui : public CMenuTarget
|
|||||||
bool SelectFile();
|
bool SelectFile();
|
||||||
void updateLcd();
|
void updateLcd();
|
||||||
|
|
||||||
void selectSubtitle();
|
|
||||||
bool convertSubtitle(std::string &text);
|
bool convertSubtitle(std::string &text);
|
||||||
void showSubtitle(neutrino_msg_data_t data);
|
|
||||||
void clearSubtitle();
|
|
||||||
void selectChapter();
|
void selectChapter();
|
||||||
void selectAutoLang();
|
void selectAutoLang();
|
||||||
void parsePlaylist(CFile *file);
|
void parsePlaylist(CFile *file);
|
||||||
@@ -205,6 +203,9 @@ class CMoviePlayerGui : public CMenuTarget
|
|||||||
void Pause(bool b = true);
|
void Pause(bool b = true);
|
||||||
void selectAudioPid();
|
void selectAudioPid();
|
||||||
bool SetPosition(int pos, bool absolute = false);
|
bool SetPosition(int pos, bool absolute = false);
|
||||||
|
void selectSubtitle();
|
||||||
|
void showSubtitle(neutrino_msg_data_t data);
|
||||||
|
void clearSubtitle(bool lock = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2358,6 +2358,9 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
|
|||||||
if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF)
|
if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF)
|
||||||
CRecordManager::getInstance()->exec(NULL, "Record");
|
CRecordManager::getInstance()->exec(NULL, "Record");
|
||||||
}
|
}
|
||||||
|
else if ((mode == mode_webtv) && msg == (neutrino_msg_t) g_settings.mpkey_subtitle) {
|
||||||
|
CMoviePlayerGui::getInstance().selectSubtitle();
|
||||||
|
}
|
||||||
/* after sensitive key bind, check user menu */
|
/* after sensitive key bind, check user menu */
|
||||||
else if (usermenu.showUserMenu(msg)) {
|
else if (usermenu.showUserMenu(msg)) {
|
||||||
}
|
}
|
||||||
@@ -2687,6 +2690,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
|
|||||||
}
|
}
|
||||||
return messages_return::handled;
|
return messages_return::handled;
|
||||||
}
|
}
|
||||||
|
if (mode == mode_webtv && msg == NeutrinoMessages::EVT_SUBT_MESSAGE) {
|
||||||
|
CMoviePlayerGui::getInstance().showSubtitle(data);
|
||||||
|
}
|
||||||
if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
|
if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
|
||||||
CZapit::getInstance()->GetAudioMode(g_settings.audio_AnalogMode);
|
CZapit::getInstance()->GetAudioMode(g_settings.audio_AnalogMode);
|
||||||
if(g_settings.audio_AnalogMode < 0 || g_settings.audio_AnalogMode > 2)
|
if(g_settings.audio_AnalogMode < 0 || g_settings.audio_AnalogMode > 2)
|
||||||
@@ -4270,6 +4276,8 @@ void CNeutrinoApp::StopSubtitles()
|
|||||||
tuxtx_pause_subtitle(true);
|
tuxtx_pause_subtitle(true);
|
||||||
frameBuffer->paintBackground();
|
frameBuffer->paintBackground();
|
||||||
}
|
}
|
||||||
|
if (mode == mode_webtv)
|
||||||
|
CMoviePlayerGui::getInstance().clearSubtitle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNeutrinoApp::StartSubtitles(bool show)
|
void CNeutrinoApp::StartSubtitles(bool show)
|
||||||
@@ -4279,6 +4287,8 @@ void CNeutrinoApp::StartSubtitles(bool show)
|
|||||||
return;
|
return;
|
||||||
dvbsub_start(0);
|
dvbsub_start(0);
|
||||||
tuxtx_pause_subtitle(false);
|
tuxtx_pause_subtitle(false);
|
||||||
|
if (mode == mode_webtv)
|
||||||
|
CMoviePlayerGui::getInstance().clearSubtitle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNeutrinoApp::SelectSubtitles()
|
void CNeutrinoApp::SelectSubtitles()
|
||||||
|
Reference in New Issue
Block a user