Switch to new record code

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1575 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 94a9e24563
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2011-07-21 (Thu, 21 Jul 2011)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2011-07-21 11:06:10 +00:00
parent 9bce88858b
commit 6304f9de33
3 changed files with 50 additions and 27 deletions

View File

@@ -22,9 +22,8 @@ libneutrino_driver_a_SOURCES = \
framebuffer.cpp \ framebuffer.cpp \
fb_window.cpp \ fb_window.cpp \
rcinput.cpp \ rcinput.cpp \
vcrcontrol.cpp \ record.cpp \
audioplay.cpp \ audioplay.cpp \
stream2file.cpp \
screen_max.cpp \ screen_max.cpp \
slotbuffer.c \ slotbuffer.c \
file.cpp \ file.cpp \

View File

@@ -85,12 +85,11 @@
extern cVideo * videoDecoder; extern cVideo * videoDecoder;
extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */
extern CInfoClock *InfoClock; extern CInfoClock *InfoClock;
extern t_channel_id live_channel_id;
#define MINUTEOFFSET 117*262072 #define MINUTEOFFSET 117*262072
#define MP_TS_SIZE 262072 // ~0.5 sec #define MP_TS_SIZE 262072 // ~0.5 sec
extern char rec_filename[512];
#ifndef __USE_FILE_OFFSET64 #ifndef __USE_FILE_OFFSET64
#error not using 64 bit file offsets #error not using 64 bit file offsets
#endif /* __USE_FILE__OFFSET64 */ #endif /* __USE_FILE__OFFSET64 */
@@ -157,7 +156,6 @@ void CMoviePlayerGui::Delete()
instance_mp = NULL; instance_mp = NULL;
} }
CMoviePlayerGui::CMoviePlayerGui() CMoviePlayerGui::CMoviePlayerGui()
{ {
Init(); Init();
@@ -433,6 +431,29 @@ void CMoviePlayerGui::updateLcd(const std::string & sel_filename)
CVFD::getInstance()->showMenuText(0, lcd.c_str(), -1, true); CVFD::getInstance()->showMenuText(0, lcd.c_str(), -1, true);
} }
void CMoviePlayerGui::fillPids(MI_MOVIE_INFO * p_movie_info)
{
if(p_movie_info == NULL)
return;
g_numpida = 0; CAPIDSelectExec::g_currentapid = 0;
if(!p_movie_info->audioPids.empty()) {
CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[0].epgAudioPid; //FIXME
CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[0].atype;
}
for (int i = 0; i < (int)p_movie_info->audioPids.size(); i++) {
CAPIDSelectExec::g_apids[i] = p_movie_info->audioPids[i].epgAudioPid;
CAPIDSelectExec::g_ac3flags[i] = p_movie_info->audioPids[i].atype;
g_numpida++;
if (p_movie_info->audioPids[i].selected) {
CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[i].epgAudioPid; //FIXME
CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[i].atype;
}
}
g_vpid = p_movie_info->epgVideoPid;
g_vtype = p_movie_info->VideoType;
}
extern bool has_hdd; extern bool has_hdd;
#define TIMESHIFT_SECONDS 3 #define TIMESHIFT_SECONDS 3
void CMoviePlayerGui::PlayFile(void) void CMoviePlayerGui::PlayFile(void)
@@ -454,13 +475,19 @@ void CMoviePlayerGui::PlayFile(void)
CMovieInfo cMovieInfo; // funktions to save and load movie info CMovieInfo cMovieInfo; // funktions to save and load movie info
MI_MOVIE_INFO *p_movie_info = NULL; // movie info handle which comes from the MovieBrowser, if not NULL MoviePla yer is able to save new bookmarks MI_MOVIE_INFO *p_movie_info = NULL; // movie info handle which comes from the MovieBrowser, if not NULL MoviePla yer is able to save new bookmarks
int eof = 0; int eof = 0;
std::string rec_filename;
if (has_hdd) if (has_hdd)
system("(rm /hdd/.wakeup; touch /hdd/.wakeup; sync) > /dev/null 2> /dev/null &"); system("(rm /hdd/.wakeup; touch /hdd/.wakeup; sync) > /dev/null 2> /dev/null &");
if (timeshift) { if (timeshift) {
#if 0 //FIXME is this needed ? pids used from p_movie_info anyway ?
CVCRControl::getInstance()->GetPids(&g_vpid, &g_vtype, &CAPIDSelectExec::g_currentapid, &CAPIDSelectExec::g_currentac3, &g_numpida, CAPIDSelectExec::g_apids, CAPIDSelectExec::g_ac3flags); CVCRControl::getInstance()->GetPids(&g_vpid, &g_vtype, &CAPIDSelectExec::g_currentapid, &CAPIDSelectExec::g_currentac3, &g_numpida, CAPIDSelectExec::g_apids, CAPIDSelectExec::g_ac3flags);
p_movie_info = CVCRControl::getInstance()->GetMovieInfo(); p_movie_info = CVCRControl::getInstance()->GetMovieInfo();
#endif
p_movie_info = CRecordManager::getInstance()->GetMovieInfo(live_channel_id);
rec_filename = CRecordManager::getInstance()->GetFileName(live_channel_id) + ".ts";
fillPids(p_movie_info);
} }
int width = 280; int width = 280;
@@ -513,17 +540,8 @@ void CMoviePlayerGui::PlayFile(void)
if (timesh) { if (timesh) {
char fname[255]; char fname[255];
int cnt = 10 * 1000000;
while (!strlen(rec_filename)) {
usleep(1000);
cnt -= 1000;
if (!cnt)
break;
}
if (!strlen(rec_filename))
return;
sprintf(fname, "%s.ts", rec_filename); sprintf(fname, "%s", rec_filename.c_str());
filename = fname; filename = fname;
sel_filename = std::string(rindex(filename, '/') + 1); sel_filename = std::string(rindex(filename, '/') + 1);
printf("Timeshift: %s\n", sel_filename.c_str()); printf("Timeshift: %s\n", sel_filename.c_str());
@@ -680,7 +698,9 @@ void CMoviePlayerGui::PlayFile(void)
// get the movie info handle (to be used for e.g. bookmark handling) // get the movie info handle (to be used for e.g. bookmark handling)
p_movie_info = moviebrowser->getCurrentMovieInfo(); p_movie_info = moviebrowser->getCurrentMovieInfo();
bool recfile = CNeutrinoApp::getInstance()->recordingstatus && !strncmp(rec_filename, filename, strlen(rec_filename)); //bool recfile = CNeutrinoApp::getInstance()->recordingstatus && !strncmp(rec_filename, filename, strlen(rec_filename));
bool recfile = CRecordManager::getInstance()->RecordingStatus(p_movie_info->epgId) &&
CRecordManager::getInstance()->GetFileName(p_movie_info->epgId) == file->Name;
if (!recfile && p_movie_info->length) { if (!recfile && p_movie_info->length) {
minuteoffset = file->Size / p_movie_info->length; minuteoffset = file->Size / p_movie_info->length;
minuteoffset = (minuteoffset / MP_TS_SIZE) * MP_TS_SIZE; minuteoffset = (minuteoffset / MP_TS_SIZE) * MP_TS_SIZE;
@@ -688,7 +708,7 @@ void CMoviePlayerGui::PlayFile(void)
minuteoffset = MINUTEOFFSET; minuteoffset = MINUTEOFFSET;
secondoffset = minuteoffset / 60; secondoffset = minuteoffset / 60;
} }
#if 0
if(!p_movie_info->audioPids.empty()) { if(!p_movie_info->audioPids.empty()) {
CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[0].epgAudioPid; //FIXME CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[0].epgAudioPid; //FIXME
CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[0].atype; CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[0].atype;
@@ -700,11 +720,12 @@ void CMoviePlayerGui::PlayFile(void)
if (p_movie_info->audioPids[i].selected) { if (p_movie_info->audioPids[i].selected) {
CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[i].epgAudioPid; //FIXME CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[i].epgAudioPid; //FIXME
CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[i].atype; CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[i].atype;
//break;
} }
} }
g_vpid = p_movie_info->epgVideoPid; g_vpid = p_movie_info->epgVideoPid;
g_vtype = p_movie_info->VideoType; g_vtype = p_movie_info->VideoType;
#endif
fillPids(p_movie_info);
printf("CMoviePlayerGui::PlayFile: file %s apid %X atype %d vpid %x vtype %d\n", filename, CAPIDSelectExec::g_currentapid, CAPIDSelectExec::g_currentac3, g_vpid, g_vtype); printf("CMoviePlayerGui::PlayFile: file %s apid %X atype %d vpid %x vtype %d\n", filename, CAPIDSelectExec::g_currentapid, CAPIDSelectExec::g_currentac3, g_vpid, g_vtype);
printf("Bytes per minute: %lld\n", minuteoffset); printf("Bytes per minute: %lld\n", minuteoffset);
// get the start position for the movie // get the start position for the movie
@@ -1214,7 +1235,7 @@ void CMoviePlayerGui::PlayFile(void)
if (isMovieBrowser == true && p_movie_info != NULL) { if (isMovieBrowser == true && p_movie_info != NULL) {
std::string fname = p_movie_info->file.Name; std::string fname = p_movie_info->file.Name;
strReplace(fname, ".ts", ".bmp"); strReplace(fname, ".ts", ".bmp");
CVCRControl::getInstance()->Screenshot(0, (char *)fname.c_str()); //CVCRControl::getInstance()->Screenshot(0, (char *)fname.c_str());
} }
} }
#if 0 #if 0

View File

@@ -41,7 +41,7 @@
#include "gui/moviebrowser.h" #include "gui/moviebrowser.h"
#include "gui/movieinfo.h" #include "gui/movieinfo.h"
#include <gui/widget/hintbox.h> #include <gui/widget/hintbox.h>
#include <driver/vcrcontrol.h> #include <driver/record.h>
#include <playback.h> #include <playback.h>
#include <stdio.h> #include <stdio.h>
@@ -71,7 +71,6 @@ class CMoviePlayerGui : public CMenuTarget
}; };
private: private:
void Init(void);
pthread_t rct; pthread_t rct;
CFrameBuffer * frameBuffer; CFrameBuffer * frameBuffer;
int m_LastMode; int m_LastMode;
@@ -99,6 +98,7 @@ class CMoviePlayerGui : public CMenuTarget
static unsigned short g_vtype; static unsigned short g_vtype;
static unsigned short g_vpid; static unsigned short g_vpid;
static std::string g_language[REC_MAX_APIDS]; static std::string g_language[REC_MAX_APIDS];
const static short MOVIE_HINT_BOX_TIMER = 5; // time to show bookmark hints in seconds
CFileBrowser * filebrowser; CFileBrowser * filebrowser;
CMovieBrowser* moviebrowser; CMovieBrowser* moviebrowser;
@@ -106,23 +106,26 @@ class CMoviePlayerGui : public CMenuTarget
CBookmarkManager * bookmarkmanager; CBookmarkManager * bookmarkmanager;
CFileFilter tsfilefilter;
CFileFilter pesfilefilter;
CFileFilter vlcfilefilter;
static cPlayback *playback;
static CMoviePlayerGui* instance_mp;
void Init(void);
void PlayStream(int streamtype); void PlayStream(int streamtype);
void PlayFile(); void PlayFile();
void cutNeutrino(); void cutNeutrino();
void restoreNeutrino(); void restoreNeutrino();
CFileFilter tsfilefilter;
CFileFilter pesfilefilter;
CFileFilter vlcfilefilter;
void showHelpTS(void); void showHelpTS(void);
void showHelpVLC(void); void showHelpVLC(void);
void callInfoViewer(const std::string & epg_title, const std::string & epg_info1, void callInfoViewer(const std::string & epg_title, const std::string & epg_info1,
const std::string & epg_channel, const int duration, const int pos); const std::string & epg_channel, const int duration, const int pos);
void fillPids(MI_MOVIE_INFO * p_movie_info);
static CMoviePlayerGui* instance_mp;
static cPlayback *playback;
CMoviePlayerGui(const CMoviePlayerGui&) {}; CMoviePlayerGui(const CMoviePlayerGui&) {};
const static short MOVIE_HINT_BOX_TIMER = 5; // time to show bookmark hints in seconds
public: public:
CMoviePlayerGui(); CMoviePlayerGui();