[Commits] : Tuxbox-GIT: apps branch master updated. CVS-Final-599-gaf19455
Tuxbox Sources
Brought to you by:
dbt1
|
From: GetAway <tux...@ne...> - 2015-06-12 09:27:36
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via af19455866e85fb7a5a27ccf6a735e05e888c261 (commit)
from e7580f6382be79d23e51486b3af889a317ffc80c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit af19455866e85fb7a5a27ccf6a735e05e888c261
Author: GetAway <get...@t-...>
Date: Fri Jun 12 11:26:51 2015 +0200
create Neutrino-HD compatible TS-Files
Based on the code by bellum i added a menu to
switch on/off this function - later, the menu
could be removed.
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/data/locale/deutsch.locale b/tuxbox/neutrino/data/locale/deutsch.locale
index ea360ba..a648230 100644
--- a/tuxbox/neutrino/data/locale/deutsch.locale
+++ b/tuxbox/neutrino/data/locale/deutsch.locale
@@ -1197,6 +1197,7 @@ recordingmenu.gen_psi PSI in TS einfügen
recordingmenu.head Aufnahme Einstellungen
recordingmenu.help Aufnahmegeräte:\n-----------------------\nServer:\nauf PC mit Hilfe eines Streaming-Programmes\n\n(analoger) Videorekorder:\nüber VCR-Ausgang\n\nDirekt (Datei):\nauf ein per NFS gemountetes Verzeichnis\noder eine interne Festplatte\nTS: SPTS-Mode Treiber laden\nPES: SPTS-Mode Treiber nicht laden\n\n\nMaximale DateigröÃe:\n----------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: fast unendlich (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB)
recordingmenu.max_rectime Max. Sofortaufnahmezeit
+recordingmenu.nhd_compatible_ts N-HD komp. TS-Dateien erzeugen
recordingmenu.no_scart Unterdrücke Scart-Umschaltung
recordingmenu.off aus
recordingmenu.record_in_spts_mode in SPTS-Modus aufnehmen
diff --git a/tuxbox/neutrino/data/locale/english.locale b/tuxbox/neutrino/data/locale/english.locale
index 76bcdd1..0fa313f 100644
--- a/tuxbox/neutrino/data/locale/english.locale
+++ b/tuxbox/neutrino/data/locale/english.locale
@@ -1197,6 +1197,7 @@ recordingmenu.gen_psi Insert PSI in TS
recordingmenu.head Recording Settings
recordingmenu.help Recording devices:\n--------------------------\nserver:\nusing streaming software on a PC\n\n(analog) vcr:\nusing the vcr outlet\n\ndirect (file):\ndirectly into an NFS mounted directory\nor onto an internal hard drive\nTS: use spts mode\nPES: do not use spts mode\n\n\nMax. file size:\n---------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: almost unlimited (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB)
recordingmenu.max_rectime Max. instant recording time
+recordingmenu.nhd_compatible_ts Create N-HD comp. TS-Files
recordingmenu.no_scart Switch to SCART
recordingmenu.off off
recordingmenu.record_in_spts_mode Use spts mode
diff --git a/tuxbox/neutrino/src/driver/genpsi.c b/tuxbox/neutrino/src/driver/genpsi.c
index 8e91fdd..511f17f 100644
--- a/tuxbox/neutrino/src/driver/genpsi.c
+++ b/tuxbox/neutrino/src/driver/genpsi.c
@@ -20,8 +20,9 @@ $Id: genpsi.c,v 1.2 2006/01/16 12:45:54 sat_man Exp $
along with this program; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge MA 02139, USA.
- Mit diesem Programm koennen Neutrino TS Streams für das Abspielen unter Enigma gepatched werden
+ Mit diesem Programm koennen Neutrino TS Streams für das Abspielen unter Enigma und Coolstream Neutrino-HD gepatched werden
*/
+
#include <transform.h>
#include <driver/genpsi.h>
@@ -76,6 +77,12 @@ void reset_pids(void)
avPids.nba = 0;
}
+static short nhd_ts = 0;
+void activate_compatible_ts(const short compatible)
+{
+ nhd_ts = compatible;
+}
+
//-- special enigma stream description packet for --
//-- at least 1 video, 1 audo and 1 PCR-Pid stream --
//------------------------------------------------------------------------------------
@@ -85,7 +92,7 @@ static uint8_t pkt_enigma[] =
0x7F, 0x80, 0x24,
0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x6D, 0x66, 0x30, 0x19,
- 0x80, 0x13, 'N','E','U','T','R','I','N','O','N','G', // tag(8), len(8), text(10) -> NG hihi ;)
+ 0x80, 0x13, 'N','E','U','T','R','I','N','O','N','G', // tag(8), len(8), text(10)
0x00, 0x02, 0x00, 0x6e, // cVPID(8), len(8), PID(16)
0x01, 0x03, 0x00, 0x78, 0x00, // cAPID(8), len(8), PID(16), ac3flag(8)
// 0x02, 0x02, 0x00, 0x82,// cTPID(8), len(8), ...
@@ -169,8 +176,25 @@ int genpsi(int fd2)
//-- calculate CRC --
calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 );
+ if (nhd_ts)
+ {
+ //-- after all add dummy record length (60sec = 60000ms) to TS packet
+ // so that basic playback on Coolstream PVRs is possible
+ // correct record length is added in stream2file.cpp
+ // 60sec = 60000ms (dez) -> 0000EA60 hex
+ pkt[SIZE_TS_PKT-8] = 0x60;
+ pkt[SIZE_TS_PKT-7] = 0xEA;
+ pkt[SIZE_TS_PKT-6] = 0x00;
+ pkt[SIZE_TS_PKT-5] = 0x00;
+ //-- and finally add coolstream "magic bytes" to TS packet
+ pkt[SIZE_TS_PKT-4] = 0xBC;
+ pkt[SIZE_TS_PKT-3] = 0x00;
+ pkt[SIZE_TS_PKT-2] = 0x00;
+ pkt[SIZE_TS_PKT-1] = 0x00;
+ }
//-- write TS packet --
bytes += write(fd2, pkt, SIZE_TS_PKT);
+
//-- (II) build PAT --
data_len = COPY_TEMPLATE(pkt, pkt_pat);
//-- calculate CRC --
diff --git a/tuxbox/neutrino/src/driver/genpsi.h b/tuxbox/neutrino/src/driver/genpsi.h
index 7b2ae0b..988ec95 100644
--- a/tuxbox/neutrino/src/driver/genpsi.h
+++ b/tuxbox/neutrino/src/driver/genpsi.h
@@ -34,5 +34,6 @@ $Id: genpsi.h,v 1.1 2005/08/15 14:47:52 metallica Exp $
int genpsi(int fd2);
void transfer_pids(uint16_t pid,uint16_t pidart,short isAC3);
void reset_pids(void);
+void activate_compatible_ts(const short compatible);
#endif
diff --git a/tuxbox/neutrino/src/driver/stream2file.cpp b/tuxbox/neutrino/src/driver/stream2file.cpp
index d94756e..b1d4273 100644
--- a/tuxbox/neutrino/src/driver/stream2file.cpp
+++ b/tuxbox/neutrino/src/driver/stream2file.cpp
@@ -115,6 +115,7 @@ static pthread_t demux_thread[MAXPIDS];
static bool use_o_sync;
static bool use_fdatasync;
static bool gen_psi;
+static bool nhd_ts;
static unsigned long long limit;
static unsigned int ringbuffersize;
static time_t record_start_time = 0;
@@ -129,8 +130,8 @@ typedef struct filenames_t
ringbuffer_t * ringbuffer;
};
-static int sync_byte_offset(const unsigned char * buf, const unsigned int len) {
-
+static int sync_byte_offset(const unsigned char * buf, const unsigned int len)
+{
unsigned int i;
for (i = 0; i < len; i++)
@@ -206,6 +207,9 @@ void * FileThread(void * v_arg)
{
ringbuffer_data_t vec[2];
size_t readsize;
+ time_t file_start_time = 0;
+ time_t file_end_time = 0;
+ unsigned long cs_file_time = 0;
unsigned int filecount = 0;
char radio_extension[5];
const unsigned long long splitsize = (limit / TS_SIZE) * TS_SIZE;
@@ -236,8 +240,26 @@ void * FileThread(void * v_arg)
printf("[stream2file] filename: '%s'\n"
" myfilename: '%s'\n", filename, myfilename);
if (fd2 != -1)
+ {
+ if (nhd_ts)
+ {
+ time(&file_end_time);
+ // calculate record time for coolstream neutrino-hd (record time in ms, little endian format)
+ printf("[stream2file] file record time is: %lu sec \n", file_end_time - file_start_time);
+ //printf("DEBUG - stream2file.cpp: CS file_record_time is: %lX \n", (file_end_time - file_start_time) * 1000);
+ // conversion into little endian
+ cs_file_time = ((((file_end_time - file_start_time) * 1000)>>24)&0xff) | // move byte 3 to byte 0
+ ((((file_end_time - file_start_time) * 1000)<<8)&0xff0000) | // move byte 1 to byte 2
+ ((((file_end_time - file_start_time) * 1000)>>8)&0xff00) | // move byte 2 to byte 1
+ ((((file_end_time - file_start_time) * 1000)<<24)&0xff000000); // byte 0 to byte 3
+ //printf("DEBUG - stream2file.cpp: CS file_record_time stored in ts file: %lX \n", cs_file_time);
+ lseek(fd2, 180, SEEK_SET);
+ write(fd2, &cs_file_time, 4);
+ }
close(fd2);
+ }
+ time(&file_start_time);
if ((fd2 = open(filename, flags, REC_FILE_PERMISSIONS)) < 0)
{
if (errno == EEXIST) {
@@ -316,8 +338,24 @@ void * FileThread(void * v_arg)
}
terminate_thread:
if (fd2 != -1)
- close (fd2);
-
+ {
+ if (nhd_ts)
+ {
+ time(&file_end_time);
+ // calculate record time for coolstream neutrino-hd (record time in ms, little endian format)
+ printf("[stream2file] file record time is: %lu sec \n", file_end_time - file_start_time);
+ //printf("DEBUG - stream2file.cpp: CS file_record_time is: %lX \n", (file_end_time - file_start_time) * 1000);
+ // conversion into little endian
+ cs_file_time = ((((file_end_time - file_start_time) * 1000)>>24)&0xff) | // move byte 3 to byte 0
+ ((((file_end_time - file_start_time) * 1000)<<8)&0xff0000) | // move byte 1 to byte 2
+ ((((file_end_time - file_start_time) * 1000)>>8)&0xff00) | // move byte 2 to byte 1
+ ((((file_end_time - file_start_time) * 1000)<<24)&0xff000000); // byte 0 to byte 3
+ //printf("DEBUG - stream2file.cpp: CS file_record_time stored in ts file: %lX \n", cs_file_time);
+ lseek(fd2, 180, SEEK_SET);
+ write(fd2, &cs_file_time, 4);
+ }
+ close(fd2);
+ }
pthread_exit(NULL);
}
@@ -522,7 +560,7 @@ stream2file_error_msg_t start_recording(const char * const filename,
const unsigned short * const pids,
const bool write_ts,
const unsigned int ringbuffers,
- const bool with_gen_psi )
+ const bool with_gen_psi, const bool nhd_compatible_ts )
{
int fd;
char buf[FILENAMEBUFFERSIZE];
@@ -576,6 +614,9 @@ stream2file_error_msg_t start_recording(const char * const filename,
use_o_sync = with_o_sync;
use_fdatasync = with_fdatasync;
gen_psi = with_gen_psi;
+ nhd_ts = nhd_compatible_ts;
+
+ activate_compatible_ts(nhd_ts);
if (ringbuffers > 4)
ringbuffersize = ((1 << 19) << 4);
@@ -683,7 +724,7 @@ stream2file_error_msg_t stop_recording(void)
mi.clearMovieInfo(&movieinfo);
time(&record_end_time);
- printf("record time: %lu \n",record_end_time-record_start_time);
+ printf("[stream2file] record time: %lu sec \n",record_end_time - record_start_time);
//load MovieInfo and set record time
movieinfo.file.Name = myfilename;
movieinfo.file.Name += ".ts";
diff --git a/tuxbox/neutrino/src/driver/stream2file.h b/tuxbox/neutrino/src/driver/stream2file.h
index 0a564aa..a19017c 100644
--- a/tuxbox/neutrino/src/driver/stream2file.h
+++ b/tuxbox/neutrino/src/driver/stream2file.h
@@ -61,7 +61,7 @@ stream2file_error_msg_t start_recording(const char * const filename,
const unsigned short * const pids,
const bool write_ts = true,
const unsigned int ringbuffers = 20,
- const bool gen_psi = true);
+ const bool gen_psi = true, const bool nhd_compatible_ts = false);
stream2file_error_msg_t stop_recording(void);
#endif
diff --git a/tuxbox/neutrino/src/driver/vcrcontrol.cpp b/tuxbox/neutrino/src/driver/vcrcontrol.cpp
index 9134307..b0c7bd3 100644
--- a/tuxbox/neutrino/src/driver/vcrcontrol.cpp
+++ b/tuxbox/neutrino/src/driver/vcrcontrol.cpp
@@ -896,7 +896,8 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c
pids,
sptsmode,
RingBuffers,
- GenPsi);
+ GenPsi,
+ NHD_TS);
}
CreateTemplateDirectories = true;
if (error_msg == STREAM2FILE_OK)
diff --git a/tuxbox/neutrino/src/driver/vcrcontrol.h b/tuxbox/neutrino/src/driver/vcrcontrol.h
index 6d457a0..dc9e82a 100644
--- a/tuxbox/neutrino/src/driver/vcrcontrol.h
+++ b/tuxbox/neutrino/src/driver/vcrcontrol.h
@@ -149,6 +149,7 @@ class CVCRControl
bool StreamVTxtPid;
bool StreamSubtitlePid;
bool GenPsi;
+ bool NHD_TS;
unsigned int RingBuffers;
virtual CVCRDevices getDeviceType(void) const
@@ -161,12 +162,12 @@ class CVCRControl
const std::string& epgTitle = "", unsigned char apids = 0, const time_t epg_time = 0,
const CTimerd::CTimerEventRepeat eventRepeat = CTimerd::TIMERREPEAT_ONCE);
- CFileDevice(const bool stopplayback, const int stopsectionsd, const char * const directory, const unsigned int splitsize, const bool use_o_sync, const bool use_fdatasync, const bool stream_vtxt_pid, const bool stream_subtitle_pid, const unsigned int ringbuffers, const bool gen_psi, bool createTemplateDirectories)
+ CFileDevice(const bool stopplayback, const int stopsectionsd, const char * const directory, const unsigned int splitsize, const bool use_o_sync, const bool use_fdatasync, const bool stream_vtxt_pid, const bool stream_subtitle_pid, const unsigned int ringbuffers, const bool gen_psi, const bool nhd_compatible_ts, bool createTemplateDirectories)
: Directory(directory), FilenameTemplate(""), CreateTemplateDirectories(createTemplateDirectories),
SplitSize(splitsize), Use_O_Sync(use_o_sync), Use_Fdatasync(use_fdatasync),
StreamVTxtPid(stream_vtxt_pid),
- StreamSubtitlePid(stream_subtitle_pid), GenPsi(gen_psi), RingBuffers(ringbuffers)
+ StreamSubtitlePid(stream_subtitle_pid), GenPsi(gen_psi), NHD_TS(nhd_compatible_ts), RingBuffers(ringbuffers)
{
StopPlayBack = stopplayback;
StopSectionsd = stopsectionsd;
diff --git a/tuxbox/neutrino/src/gui/record_setup.cpp b/tuxbox/neutrino/src/gui/record_setup.cpp
index fb413da..ab95170 100644
--- a/tuxbox/neutrino/src/gui/record_setup.cpp
+++ b/tuxbox/neutrino/src/gui/record_setup.cpp
@@ -286,6 +286,8 @@ int CRecordSetup::showRecordSetup()
CMenuOptionNumberChooser* oj15 = new CMenuOptionNumberChooser(LOCALE_RECORDINGMENU_MAX_RECTIME, &g_settings.recording_max_rectime, true, 1, 8);
oj15->setNumberFormat("%d " + std::string(g_Locale->getText(LOCALE_WORD_HOURS_SHORT)));
+ CMenuOptionChooser* oj16 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_NHD_COMPATIBLE_TS, &g_settings.recording_nhd_compatible_ts, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
+
CStringInput recordingSettings_filenameTemplate(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, &g_settings.recording_filename_template_default, 21, false, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, LOCALE_IPSETUP_HINT_2, "%/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ");
CMenuForwarder* mf11 = new CMenuForwarder(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, true, g_settings.recording_filename_template_default, &recordingSettings_filenameTemplate);
@@ -344,6 +346,7 @@ int CRecordSetup::showRecordSetup()
directRecordingSettings->addItem(oj8);
directRecordingSettings->addItem(oj9);
directRecordingSettings->addItem(oj14); //gen_psi
+ directRecordingSettings->addItem(oj16); //nhd_compatible_ts
int res = recordingSettings->exec(NULL, "");
selected = recordingSettings->getSelected();
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index 054ad0a..a6ef809 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -576,7 +576,8 @@ int CNeutrinoApp::loadSetup()
g_settings.recording_filename_template[i] = configfile.getString("recording_filename_template_" + i_str, "" );
strcpy(g_settings.recording_splitsize[i], configfile.getString("recording_splitsize_" + i_str, "" ).c_str());
}
- g_settings.recording_gen_psi = configfile.getBool("recordingmenu.gen_psi", true);
+ g_settings.recording_gen_psi = configfile.getBool("recordingmenu.gen_psi", true);
+ g_settings.recording_nhd_compatible_ts = configfile.getBool("recordingmenu.nhd_compatible_ts", true);
//streaming (server)
g_settings.streaming_type = configfile.getInt32( "streaming_type", 0 );
@@ -1074,6 +1075,7 @@ void CNeutrinoApp::saveSetup()
configfile.setBool ("recordingmenu.stream_subtitle_pid" , g_settings.recording_stream_subtitle_pid);
configfile.setInt32 ("recordingmenu.ringbuffers" , g_settings.recording_ringbuffers);
configfile.setBool ("recordingmenu.gen_psi" , g_settings.recording_gen_psi);
+ configfile.setBool ("recordingmenu.nhd_compatible_ts" , g_settings.recording_nhd_compatible_ts);
configfile.setInt32 ("recording_choose_direct_rec_dir" , g_settings.recording_choose_direct_rec_dir);
configfile.setBool ("recording_in_spts_mode" , g_settings.recording_in_spts_mode );
configfile.setBool ("recording_zap_on_announce" , g_settings.recording_zap_on_announce );
@@ -1960,7 +1962,16 @@ void CNeutrinoApp::setupRecordingDevice(void)
sscanf(g_settings.recording_splitsize_default, "%u", &splitsize);
ringbuffers = g_settings.recording_ringbuffers;
- recordingdevice = new CVCRControl::CFileDevice(g_settings.recording_stopplayback, g_settings.recording_stopsectionsd, g_settings.recording_dir[0].c_str(), splitsize, g_settings.recording_use_o_sync, g_settings.recording_use_fdatasync, g_settings.recording_stream_vtxt_pid, g_settings.recording_stream_subtitle_pid, ringbuffers, g_settings.recording_gen_psi, true);
+ recordingdevice = new CVCRControl::CFileDevice (g_settings.recording_stopplayback,
+ g_settings.recording_stopsectionsd,
+ g_settings.recording_dir[0].c_str(),
+ splitsize,
+ g_settings.recording_use_o_sync,
+ g_settings.recording_use_fdatasync,
+ g_settings.recording_stream_vtxt_pid,
+ g_settings.recording_stream_subtitle_pid,
+ ringbuffers, g_settings.recording_gen_psi,
+ g_settings.recording_nhd_compatible_ts, true);
CVCRControl::getInstance()->registerDevice(recordingdevice);
}
diff --git a/tuxbox/neutrino/src/system/locals.h b/tuxbox/neutrino/src/system/locals.h
index 9cad528..ced7f2f 100644
--- a/tuxbox/neutrino/src/system/locals.h
+++ b/tuxbox/neutrino/src/system/locals.h
@@ -1224,6 +1224,7 @@ typedef enum
LOCALE_RECORDINGMENU_HEAD,
LOCALE_RECORDINGMENU_HELP,
LOCALE_RECORDINGMENU_MAX_RECTIME,
+ LOCALE_RECORDINGMENU_NHD_COMPATIBLE_TS,
LOCALE_RECORDINGMENU_NO_SCART,
LOCALE_RECORDINGMENU_OFF,
LOCALE_RECORDINGMENU_RECORD_IN_SPTS_MODE,
diff --git a/tuxbox/neutrino/src/system/locals_intern.h b/tuxbox/neutrino/src/system/locals_intern.h
index eea4202..75818c4 100644
--- a/tuxbox/neutrino/src/system/locals_intern.h
+++ b/tuxbox/neutrino/src/system/locals_intern.h
@@ -1224,6 +1224,7 @@ const char * locale_real_names[] =
"recordingmenu.head",
"recordingmenu.help",
"recordingmenu.max_rectime",
+ "recordingmenu.nhd_compatible_ts",
"recordingmenu.no_scart",
"recordingmenu.off",
"recordingmenu.record_in_spts_mode",
diff --git a/tuxbox/neutrino/src/system/settings.h b/tuxbox/neutrino/src/system/settings.h
index 66eb16c..1bb9e34 100644
--- a/tuxbox/neutrino/src/system/settings.h
+++ b/tuxbox/neutrino/src/system/settings.h
@@ -283,6 +283,7 @@ struct {
std::string recording_filename_template[MAX_RECORDING_DIR];
char recording_splitsize[MAX_RECORDING_DIR][10];
int recording_gen_psi;
+ int recording_nhd_compatible_ts;
//streaming
int streaming_type;
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/data/locale/deutsch.locale | 1 +
tuxbox/neutrino/data/locale/english.locale | 1 +
tuxbox/neutrino/src/driver/genpsi.c | 28 +++++++++++++-
tuxbox/neutrino/src/driver/genpsi.h | 1 +
tuxbox/neutrino/src/driver/stream2file.cpp | 53 ++++++++++++++++++++++++---
tuxbox/neutrino/src/driver/stream2file.h | 2 +-
tuxbox/neutrino/src/driver/vcrcontrol.cpp | 3 +-
tuxbox/neutrino/src/driver/vcrcontrol.h | 5 ++-
tuxbox/neutrino/src/gui/record_setup.cpp | 3 ++
tuxbox/neutrino/src/neutrino.cpp | 15 +++++++-
tuxbox/neutrino/src/system/locals.h | 1 +
tuxbox/neutrino/src/system/locals_intern.h | 1 +
tuxbox/neutrino/src/system/settings.h | 1 +
13 files changed, 101 insertions(+), 14 deletions(-)
--
Tuxbox-GIT: apps
|