diff -Nru tvheadend-3.4~git201302020753.df9eeef/README tvheadend-3.4~git201302020954.ce67dd9/README --- tvheadend-3.4~git201302020753.df9eeef/README 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/README 2013-02-02 07:54:18.000000000 +0000 @@ -1,33 +1,30 @@ -Tvheadend (TV streaming server) -==================================== -(c) 2006 - 2013 Andreas Öman, et al. + Tvheadend TV streaming server + ============================= + + (c) 2006 - 2012 Andreas Öman, et al. + How to build for Linux ----------------------- +====================== First you need to configure: - $ ./configure +$ ./configure If any dependencies are missing the configure script will complain or attempt to disable optional features. -Build the binary: - - $ make - -After build, the binary resides in `build.linux/`. +$ make +Build the binary, after build the binary resides in 'build.linux/'. Thus, to start it, just type: - $ ./build.linux/tvheadend +$ ./build.linux/tvheadend -Settings are stored in `$HOME/.hts/tvheadend`. +Settings are stored in $HOME/.hts/tvheadend Further information -------------------- +=================== -For more information about building, including generating packages please visit: -> https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Building -> https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Packaging -> https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Git +For more information about building, including generating packages please +visit https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Building diff -Nru tvheadend-3.4~git201302020753.df9eeef/README.md tvheadend-3.4~git201302020954.ce67dd9/README.md --- tvheadend-3.4~git201302020753.df9eeef/README.md 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -Tvheadend (TV streaming server) -==================================== -(c) 2006 - 2013 Andreas Öman, et al. - -How to build for Linux ----------------------- - -First you need to configure: - - $ ./configure - -If any dependencies are missing the configure script will complain or attempt -to disable optional features. - -Build the binary: - - $ make - -After build, the binary resides in `build.linux/`. - -Thus, to start it, just type: - - $ ./build.linux/tvheadend - -Settings are stored in `$HOME/.hts/tvheadend`. - -Further information -------------------- - -For more information about building, including generating packages please visit: -> https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Building -> https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Packaging -> https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/Git diff -Nru tvheadend-3.4~git201302020753.df9eeef/debian/changelog tvheadend-3.4~git201302020954.ce67dd9/debian/changelog --- tvheadend-3.4~git201302020753.df9eeef/debian/changelog 2013-02-02 05:59:53.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/debian/changelog 2013-02-02 07:54:20.000000000 +0000 @@ -1,8 +1,8 @@ -tvheadend (3.4~git201302020753.df9eeef-0ubuntu1~ppa1~lucid1) lucid; urgency=low +tvheadend (3.4~git201302020954.ce67dd9-0ubuntu1~ppa1~lucid1) lucid; urgency=low * Auto build - -- Johan Abbors Sat, 02 Feb 2013 07:53:26 +0200 + -- Johan Abbors Sat, 02 Feb 2013 09:54:20 +0200 tvheadend (3.3) unstable; urgency=low diff -Nru tvheadend-3.4~git201302020753.df9eeef/debian/control tvheadend-3.4~git201302020954.ce67dd9/debian/control --- tvheadend-3.4~git201302020753.df9eeef/debian/control 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/debian/control 2013-02-02 07:54:18.000000000 +0000 @@ -2,7 +2,7 @@ Section: video Priority: extra Maintainer: Andreas Öman -Build-Depends: debhelper (>= 7.0.50), pkg-config, libavahi-client-dev, libssl-dev, zlib1g-dev, wget, bzip2, libcurl4-gnutls-dev, git-core +Build-Depends: debhelper (>= 7.0.50), pkg-config, libavahi-client-dev, libssl-dev, zlib1g-dev, wget, bzip2, libcurl4-gnutls-dev Standards-Version: 3.7.3 Package: tvheadend diff -Nru tvheadend-3.4~git201302020753.df9eeef/debian/patches/dont_fetch_dvb_scan.patch tvheadend-3.4~git201302020954.ce67dd9/debian/patches/dont_fetch_dvb_scan.patch --- tvheadend-3.4~git201302020753.df9eeef/debian/patches/dont_fetch_dvb_scan.patch 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/debian/patches/dont_fetch_dvb_scan.patch 2013-02-02 07:54:18.000000000 +0000 @@ -1,16 +1,22 @@ Index: tvheadend/configure =================================================================== ---- tvheadend.orig/configure 2013-01-31 19:21:57.685113250 +0200 -+++ tvheadend/configure 2013-01-31 21:41:53.966342465 +0200 -@@ -174,12 +174,6 @@ +--- tvheadend.orig/configure 2013-01-12 18:50:46.765519172 +0200 ++++ tvheadend/configure 2013-01-12 18:55:48.647016138 +0200 +@@ -174,18 +174,6 @@ # DVB scan # if enabled linuxdvb && enabled dvbscan; then - printf "${TAB}" "fetching dvb-scan files ..." -- ${ROOTDIR}/support/getmuxlist -- if [ $? -ne 0 ]; then -- echo "fail" -- die "Failed to fetch dvb-scan data (use --disable-dvbscan)" +- if [ -d ${ROOTDIR}/data/dvb-scan/.git ]; then +- (cd ${ROOTDIR}/data/dvb-scan; git pull) &> /dev/null +- else +- rm -rf ${ROOTDIR}/data/dvb-scan &> /dev/null +- URL=git://linuxtv.org/dtv-scan-tables.git +- git clone $URL ${ROOTDIR}/data/dvb-scan &> /dev/null +- if [ $? -ne 0 ]; then +- echo "fail" +- die "Failed to fetch dvb-scan data (use --disable-dvbscan)" +- fi - fi echo "ok" fi diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/atomic.h tvheadend-3.4~git201302020954.ce67dd9/src/atomic.h --- tvheadend-3.4~git201302020753.df9eeef/src/atomic.h 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/atomic.h 2013-02-02 07:54:18.000000000 +0000 @@ -29,9 +29,3 @@ { return __sync_lock_test_and_set(ptr, new); } - -static inline uint64_t -atomic_add_u64(volatile uint64_t *ptr, uint64_t incr) -{ - return __sync_fetch_and_add(ptr, incr); -} diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/channels.c tvheadend-3.4~git201302020954.ce67dd9/src/channels.c --- tvheadend-3.4~git201302020753.df9eeef/src/channels.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/channels.c 2013-02-02 07:54:18.000000000 +0000 @@ -114,6 +114,7 @@ return a->ch_id - b->ch_id; } + /** * */ @@ -346,7 +347,6 @@ int channel_rename(channel_t *ch, const char *newname) { - dvr_entry_t *de; service_t *t; lock_assert(&global_lock); @@ -365,11 +365,6 @@ LIST_FOREACH(t, &ch->ch_services, s_ch_link) t->s_config_save(t); - - LIST_FOREACH(de, &ch->ch_dvrs, de_channel_link) { - dvr_entry_save(de); - dvr_entry_notify(de); - } channel_save(ch); htsp_channel_update(ch); diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb.h tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb.h --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb.h 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb.h 2013-02-02 07:54:18.000000000 +0000 @@ -344,8 +344,6 @@ void dvb_adapter_stop (th_dvb_adapter_t *tda); -void dvb_adapter_stop_dvr (th_dvb_adapter_t *tda); - void dvb_adapter_set_displayname(th_dvb_adapter_t *tda, const char *s); void dvb_adapter_set_enabled(th_dvb_adapter_t *tda, int on); @@ -427,13 +425,13 @@ uint16_t onid, uint16_t tsid, const char *network, const char *logprefix, int enabled, int initialscan, const char *identifier, - dvb_satconf_t *satconf, int create); + dvb_satconf_t *satconf); void dvb_mux_set_networkname(th_dvb_mux_instance_t *tdmi, const char *name); -void dvb_mux_set_tsid(th_dvb_mux_instance_t *tdmi, uint16_t tsid, int force); +void dvb_mux_set_tsid(th_dvb_mux_instance_t *tdmi, uint16_t tsid); -void dvb_mux_set_onid(th_dvb_mux_instance_t *tdmi, uint16_t onid, int force); +void dvb_mux_set_onid(th_dvb_mux_instance_t *tdmi, uint16_t onid); void dvb_mux_set_enable(th_dvb_mux_instance_t *tdmi, int enabled); diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_adapter.c tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_adapter.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_adapter.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_adapter.c 2013-02-02 07:54:18.000000000 +0000 @@ -59,7 +59,6 @@ static const char* dvb_adapter_snr_whitelist[] = { "Sony CXD2820R", "stv090x", - "TurboSight", NULL }; @@ -714,22 +713,6 @@ } void -dvb_adapter_stop_dvr ( th_dvb_adapter_t *tda ) -{ - /* Stop DVR thread */ - if (tda->tda_dvr_pipe.rd != -1) { - tvhlog(LOG_DEBUG, "dvb", "%s stopping thread", tda->tda_rootpath); - int err = tvh_write(tda->tda_dvr_pipe.wr, "", 1); - assert(!err); - pthread_join(tda->tda_dvr_thread, NULL); - close(tda->tda_dvr_pipe.rd); - close(tda->tda_dvr_pipe.wr); - tda->tda_dvr_pipe.rd = -1; - tvhlog(LOG_DEBUG, "dvb", "%s stopped thread", tda->tda_rootpath); - } -} - -void dvb_adapter_stop ( th_dvb_adapter_t *tda ) { /* Poweroff */ @@ -745,8 +728,18 @@ tda->tda_fe_fd = -1; } - dvb_adapter_stop_dvr(tda); - + /* Stop DVR thread */ + if (tda->tda_dvr_pipe.rd != -1) { + tvhlog(LOG_DEBUG, "dvb", "%s stopping thread", tda->tda_rootpath); + int err = tvh_write(tda->tda_dvr_pipe.wr, "", 1); + assert(!err); + pthread_join(tda->tda_dvr_thread, NULL); + close(tda->tda_dvr_pipe.rd); + close(tda->tda_dvr_pipe.wr); + tda->tda_dvr_pipe.rd = -1; + tvhlog(LOG_DEBUG, "dvb", "%s stopped thread", tda->tda_rootpath); + } + dvb_adapter_notify(tda); } diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_fe.c tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_fe.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_fe.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_fe.c 2013-02-02 07:54:18.000000000 +0000 @@ -282,7 +282,6 @@ } dvb_table_flush_all(tdmi); - dvb_adapter_stop_dvr(tda); assert(tdmi->tdmi_scan_queue == NULL); diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_multiplex.c tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_multiplex.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_multiplex.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_multiplex.c 2013-02-02 07:54:18.000000000 +0000 @@ -155,7 +155,7 @@ dvb_mux_create(th_dvb_adapter_t *tda, const struct dvb_mux_conf *dmc, uint16_t onid, uint16_t tsid, const char *network, const char *source, int enabled, int initialscan, const char *identifier, - dvb_satconf_t *satconf, int create) + dvb_satconf_t *satconf) { th_dvb_mux_instance_t *tdmi, *c; char buf[200]; @@ -169,14 +169,12 @@ } if(tdmi != NULL) { - /* Update stuff ... */ int save = 0; char buf2[1024]; buf2[0] = 0; - if(tdmi->tdmi_adapter->tda_autodiscovery && - tdmi_compare_conf(tda->tda_type, &tdmi->tdmi_conf, dmc)) { + if(tdmi_compare_conf(tda->tda_type, &tdmi->tdmi_conf, dmc)) { #if DVB_API_VERSION >= 5 snprintf(buf2, sizeof(buf2), " ("); if (tdmi->tdmi_conf.dmc_fe_modulation != dmc->dmc_fe_modulation) @@ -206,11 +204,6 @@ tdmi->tdmi_network_id = onid; save = 1; } - if(network && strcmp(tdmi->tdmi_network ?: "", network)) { - free(tdmi->tdmi_network); - tdmi->tdmi_network = strdup(network); - save = 1; - } /* HACK - load old transports and remove old mux config */ if(identifier) { @@ -232,9 +225,6 @@ return NULL; } - if (!create) - return NULL; - tdmi = calloc(1, sizeof(th_dvb_mux_instance_t)); if(identifier == NULL) { @@ -801,7 +791,7 @@ tdmi = dvb_mux_create(tda, &dmc, onid, tsid, htsmsg_get_str(m, "network"), NULL, enabled, initscan, - identifier, NULL, 1); + identifier, NULL); if(tdmi != NULL) { if((s = htsmsg_get_str(m, "status")) != NULL) @@ -863,14 +853,10 @@ * */ void -dvb_mux_set_tsid(th_dvb_mux_instance_t *tdmi, uint16_t tsid, int force) +dvb_mux_set_tsid(th_dvb_mux_instance_t *tdmi, uint16_t tsid) { htsmsg_t *m; - if (!force) - if (tdmi->tdmi_transport_stream_id != 0xFFFF || tsid == 0xFFFF) - return; - tdmi->tdmi_transport_stream_id = tsid; dvb_mux_save(tdmi); @@ -885,14 +871,10 @@ * */ void -dvb_mux_set_onid(th_dvb_mux_instance_t *tdmi, uint16_t onid, int force) +dvb_mux_set_onid(th_dvb_mux_instance_t *tdmi, uint16_t onid) { htsmsg_t *m; - if (force) - if (tdmi->tdmi_network_id != 0 || onid == 0) - return; - tdmi->tdmi_network_id = onid; dvb_mux_save(tdmi); @@ -1188,7 +1170,7 @@ } dmc.dmc_polarisation = polarisation; - tdmi = dvb_mux_create(tda, &dmc, 0, 0xffff, NULL, NULL, 1, 1, NULL, NULL, 1); + tdmi = dvb_mux_create(tda, &dmc, 0, 0xffff, NULL, NULL, 1, 1, NULL, NULL); if(tdmi == NULL) return "Mux already exist"; @@ -1215,7 +1197,7 @@ tdmi_src->tdmi_transport_stream_id, tdmi_src->tdmi_network, "copy operation", tdmi_src->tdmi_enabled, - 1, NULL, satconf, 1); + 1, NULL, satconf); if(tdmi_dst == NULL) return -1; // Already exist diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_preconf.c tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_preconf.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_preconf.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_preconf.c 2013-02-02 07:54:18.000000000 +0000 @@ -98,7 +98,7 @@ dmc.dmc_satconf = dvb_satconf_entry_find(tda, satconf, 0); - dvb_mux_create(tda, &dmc, 0, 0xffff, NULL, source, 1, 1, NULL, NULL, 1); + dvb_mux_create(tda, &dmc, 0, 0xffff, NULL, source, 1, 1, NULL, NULL); } } diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_service.c tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_service.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_service.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_service.c 2013-02-02 07:54:18.000000000 +0000 @@ -143,7 +143,7 @@ { th_dvb_mux_instance_t *tdmi = t->s_dvb_mux_instance; th_dvb_adapter_t *tda = tdmi->tdmi_adapter; - return tda->tda_enabled && tdmi->tdmi_enabled && t->s_enabled && t->s_pmt_pid; + return tda->tda_enabled && tdmi->tdmi_enabled && t->s_enabled; } @@ -416,18 +416,12 @@ LIST_FOREACH(t, &tdmi->tdmi_transports, s_group_link) { if(t->s_dvb_service_id == sid) - break; - } - - /* Existing - updated PMT_PID if required */ - if (t) { - if (pmt_pid && pmt_pid != t->s_pmt_pid) { - t->s_pmt_pid = pmt_pid; - *save = 1; - } - return t; + return t; } + if(pmt_pid == 0) + return NULL; + if(identifier == NULL) { snprintf(tmp, sizeof(tmp), "%s_%04x", tdmi->tdmi_identifier, sid); identifier = tmp; diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_tables.c tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_tables.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvb/dvb_tables.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvb/dvb_tables.c 2013-02-02 07:54:18.000000000 +0000 @@ -42,13 +42,6 @@ #include "notify.h" #include "cwc.h" -#if TDT_TRACE -#define TRACE(_pre, _fmt, ...)\ -tvhlog(LOG_DEBUG, "tdt-"_pre, _fmt, __VA_ARGS__) -#else -#define TRACE(_pre, _fmt, ...) (void)0 -#endif - /** * @@ -328,9 +321,6 @@ char provider[256]; char chname0[256], *chname; uint8_t stype; -#if TDT_TRACE - uint8_t running_status; -#endif int l; th_dvb_adapter_t *tda = tdmi->tdmi_adapter; @@ -342,22 +332,22 @@ tsid = ptr[0] << 8 | ptr[1]; onid = ptr[5] << 8 | ptr[6]; if (tableid == 0x42) { - dvb_mux_set_tsid(tdmi, tsid, 0); - dvb_mux_set_onid(tdmi, onid, 0); - if(tdmi->tdmi_transport_stream_id != tsid || tdmi->tdmi_network_id != onid) + if(tdmi->tdmi_transport_stream_id != tsid) return -1; + if(!tdmi->tdmi_network_id) + dvb_mux_set_onid(tdmi, onid); } else { LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) if(tdmi->tdmi_transport_stream_id == tsid && tdmi->tdmi_network_id != onid) break; - if (!tdmi) return -1; + if (!tdmi) return 0; } - TRACE("sdt", "onid %04X tsid %04X", onid, tsid); // version = ptr[2] >> 1 & 0x1f; // section_number = ptr[3]; // last_section_number = ptr[4]; + // original_network_id = ptr[5] << 8 | ptr[6]; // reserved = ptr[7]; if((ptr[2] & 1) == 0) { @@ -373,13 +363,9 @@ int save = 0; service_id = ptr[0] << 8 | ptr[1]; // reserved = ptr[2]; -#if TDT_TRACE - running_status = (ptr[3] >> 5) & 0x7; -#endif + // running_status = (ptr[3] >> 5) & 0x7; free_ca_mode = (ptr[3] >> 4) & 0x1; dllen = ((ptr[3] & 0x0f) << 8) | ptr[4]; - TRACE("sdt", " sid %04X running %d free_ca %d", - service_id, running_status, free_ca_mode); len -= 5; ptr += 5; @@ -410,8 +396,6 @@ if(dvb_desc_service(ptr, dlen, &stype, provider, sizeof(provider), chname0, sizeof(chname0)) == 0) { - TRACE("sdt", " stype = %d, provider = %s, name = %s", - stype, provider, chname0); chname = chname0; /* Some providers insert spaces. Clean up that (both heading and trailing) */ @@ -494,6 +478,7 @@ dvb_pat_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len, uint8_t tableid, void *opaque) { + th_dvb_mux_instance_t *other; th_dvb_adapter_t *tda = tdmi->tdmi_adapter; uint16_t service, pmt, tsid; @@ -506,9 +491,21 @@ } tsid = (ptr[0] << 8) | ptr[1]; - dvb_mux_set_tsid(tdmi, tsid, 0); - if (tdmi->tdmi_transport_stream_id != tsid) - return -1; + + // Make sure this TSID is not already known on another mux + // That might indicate that we have accedentally received a PAT + // from another mux + LIST_FOREACH(other, &tda->tda_muxes, tdmi_adapter_link) + if(other != tdmi && + other->tdmi_conf.dmc_satconf == tdmi->tdmi_conf.dmc_satconf && + other->tdmi_transport_stream_id == tsid && + other->tdmi_network_id == tdmi->tdmi_network_id) + return -1; + + if(tdmi->tdmi_transport_stream_id == 0xffff) + dvb_mux_set_tsid(tdmi, tsid); + else if (tdmi->tdmi_transport_stream_id != tsid) + return -1; // TSID mismatches, skip packet, may be from another mux ptr += 5; len -= 5; @@ -653,11 +650,14 @@ */ static int dvb_table_cable_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len, - uint16_t tsid, uint16_t onid, const char *netname) + uint16_t tsid, uint16_t onid) { struct dvb_mux_conf dmc; int freq, symrate; + if(!tdmi->tdmi_adapter->tda_autodiscovery) + return -1; + if(len < 11) return -1; @@ -672,7 +672,6 @@ return -1; dmc.dmc_fe_params.frequency = freq * 100; - TRACE("nit", " dvb-c frequency %d", dmc.dmc_fe_params.frequency); symrate = bcdtoint(ptr[7]) * 100000 + bcdtoint(ptr[8]) * 1000 + @@ -688,10 +687,8 @@ dmc.dmc_fe_params.u.qam.fec_inner = fec_tab[ptr[10] & 0x07]; - dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, netname, - "automatic mux discovery", 1, 1, NULL, NULL, - tdmi->tdmi_adapter->tda_autodiscovery); - + dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, NULL, + "automatic mux discovery", 1, 1, NULL, NULL); return 0; } @@ -700,12 +697,15 @@ */ static int dvb_table_sat_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len, - uint16_t tsid, uint16_t onid, const char *netname) + uint16_t tsid, uint16_t onid) { int freq, symrate; // uint16_t orbital_pos; struct dvb_mux_conf dmc; + if(!tdmi->tdmi_adapter->tda_autodiscovery) + return -1; + if(len < 11) return -1; @@ -716,7 +716,6 @@ bcdtoint(ptr[0]) * 1000000 + bcdtoint(ptr[1]) * 10000 + bcdtoint(ptr[2]) * 100 + bcdtoint(ptr[3]); dmc.dmc_fe_params.frequency = freq * 10; - TRACE("nit", " dvb-s frequency %d", dmc.dmc_fe_params.frequency); if(!freq) return -1; @@ -773,10 +772,8 @@ } #endif - - dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, netname, - "automatic mux discovery", 1, 1, NULL, tdmi->tdmi_conf.dmc_satconf, - tdmi->tdmi_adapter->tda_autodiscovery); + dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, NULL, + "automatic mux discovery", 1, 1, NULL, tdmi->tdmi_conf.dmc_satconf); return 0; } @@ -787,11 +784,14 @@ */ static int dvb_table_terr_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len, - uint16_t tsid, uint16_t onid, const char *netname) + uint16_t tsid, uint16_t onid) { struct dvb_mux_conf dmc; int freq; + if(!tdmi->tdmi_adapter->tda_autodiscovery) + return -1; + if(len < 11) return -1; @@ -804,7 +804,6 @@ return -1; dmc.dmc_fe_params.frequency = freq; - TRACE("nit", " dvb-t frequency %d", dmc.dmc_fe_params.frequency); dmc.dmc_fe_params.u.ofdm.bandwidth = bandwidth_tab[(ptr[4] & 0xe0) >> 5]; dmc.dmc_fe_params.u.ofdm.constellation=constellation_tab[(ptr[5] & 0xc0) >> 6]; dmc.dmc_fe_params.u.ofdm.hierarchy_information=hierarchy_info_tab[(ptr[5] & 0x38) >> 3]; @@ -813,9 +812,8 @@ dmc.dmc_fe_params.u.ofdm.guard_interval=guard_interval_tab[(ptr[6] & 0x18) >> 3]; dmc.dmc_fe_params.u.ofdm.transmission_mode=transmission_mode_tab[(ptr[6] & 0x06) >> 1]; - dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, netname, - "automatic mux discovery", 1, 1, NULL, NULL, - tdmi->tdmi_adapter->tda_autodiscovery); + dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, NULL, + "automatic mux discovery", 1, 1, NULL, NULL); return 0; } @@ -847,11 +845,11 @@ t = dvb_service_find(tdmi, sid, 0, NULL); if(t != NULL) { - if(t->s_channel_number != chan) { - t->s_channel_number = chan; - t->s_config_save(t); - service_refresh_channel(t); - } + if(t->s_channel_number != chan) { + t->s_channel_number = chan; + t->s_config_save(t); + service_refresh_channel(t); + } } } ptr += 4; @@ -868,92 +866,107 @@ dvb_nit_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len, uint8_t tableid, void *opaque) { - uint8_t dtag, dlen; - uint16_t llen; - char netname[256]; + uint8_t tag, tlen; + int ntl; + char networkname[256]; uint16_t tsid, onid; uint16_t network_id = (ptr[0] << 8) | ptr[1]; - netname[0] = '\0'; - /* Check NID */ - if(tdmi->tdmi_adapter->tda_nitoid && - tdmi->tdmi_adapter->tda_nitoid != network_id) - return -1; + if(tdmi->tdmi_adapter->tda_nitoid) { + if(tableid != 0x41) + return -1; + + if(network_id != tdmi->tdmi_adapter->tda_nitoid) + return -1; - /* Ignore non-current */ - if((ptr[2] & 1) == 0) + } else { + if(tableid != 0x40) + return -1; + } + + if((ptr[2] & 1) == 0) { + /* current_next_indicator == next, skip this */ return -1; + } + + ptr += 5; + len -= 5; - /* Network descriptors */ - llen = ((ptr[5] & 0xf) << 8) | ptr[6]; - ptr += 7; - len -= llen + 7; - if (len < 0) + ntl = ((ptr[0] & 0xf) << 8) | ptr[1]; + ptr += 2; + len -= 2; + if(ntl > len) return -1; - while(llen > 2) { - dtag = ptr[0]; - dlen = ptr[1]; + while(ntl > 2) { + tag = *ptr++; + tlen = *ptr++; + len -= 2; + ntl -= 2; - switch(dtag) { - case DVB_DESC_NETWORK_NAME: - if(dvb_get_string(netname, sizeof(netname), ptr+2, dlen, NULL, NULL)) - return -1; - break; + switch(tag) { + case DVB_DESC_NETWORK_NAME: + if(dvb_get_string(networkname, sizeof(networkname), ptr, tlen, NULL, NULL)) + return -1; + + if(strcmp(tdmi->tdmi_network ?: "", networkname)) + dvb_mux_set_networkname(tdmi, networkname); + break; } - ptr += dlen + 2; - llen -= dlen + 2; + ptr += tlen; + len -= tlen; + ntl -= tlen; } - if (llen) + + if(len < 2) return -1; - /* Transport loop */ - llen = ((ptr[0] & 0xf) << 8) | ptr[1]; + ntl = ((ptr[0] & 0xf) << 8) | ptr[1]; ptr += 2; len -= 2; - if (llen > len) + + if(len < ntl) return -1; + while(len >= 6) { tsid = ( ptr[0] << 8) | ptr[1]; onid = ( ptr[2] << 8) | ptr[3]; - llen = ((ptr[4] & 0xf) << 8) | ptr[5]; - - TRACE("nit", "netw %d/%s onid %04X tsid %04X", - network_id, netname, onid, tsid); + ntl = ((ptr[4] & 0xf) << 8) | ptr[5]; ptr += 6; - len -= llen + 6; - if(len < 0) - return -1; - - while(llen > 2) { - dtag = ptr[0]; - dlen = ptr[1]; + len -= 6; + if(ntl > len) + break; - switch(dtag) { - case DVB_DESC_SAT: - if(tdmi->tdmi_adapter->tda_type == FE_QPSK) - dvb_table_sat_delivery(tdmi, ptr+2, dlen, tsid, onid, netname); - break; - case DVB_DESC_CABLE: - if(tdmi->tdmi_adapter->tda_type == FE_QAM) - dvb_table_cable_delivery(tdmi, ptr+2, dlen, tsid, onid, netname); - break; - case DVB_DESC_TERR: - if(tdmi->tdmi_adapter->tda_type == FE_OFDM) - dvb_table_terr_delivery(tdmi, ptr+2, dlen, tsid, onid, netname); - break; - case DVB_DESC_LOCAL_CHAN: - dvb_table_local_channel(tdmi, ptr+2, dlen, tsid, onid); - break; + while(ntl > 2) { + tag = *ptr++; + tlen = *ptr++; + len -= 2; + ntl -= 2; + + switch(tag) { + case DVB_DESC_SAT: + if(tdmi->tdmi_adapter->tda_type == FE_QPSK) + dvb_table_sat_delivery(tdmi, ptr, tlen, tsid, onid); + break; + case DVB_DESC_CABLE: + if(tdmi->tdmi_adapter->tda_type == FE_QAM) + dvb_table_cable_delivery(tdmi, ptr, tlen, tsid, onid); + break; + case DVB_DESC_TERR: + if(tdmi->tdmi_adapter->tda_type == FE_OFDM) + dvb_table_terr_delivery(tdmi, ptr, tlen, tsid, onid); + break; + case DVB_DESC_LOCAL_CHAN: + dvb_table_local_channel(tdmi, ptr, tlen, tsid, onid); + break; } - llen -= dlen + 2; - ptr += dlen + 2; + ptr += tlen; + len -= tlen; + ntl -= tlen; } - if (llen) - return -1; } return 0; } @@ -1002,9 +1015,8 @@ /* Search all muxes on adapter */ LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) - if(tdmi->tdmi_transport_stream_id == tsid && - tdmi->tdmi_network_id == onid); - break; + if(tdmi->tdmi_transport_stream_id == tsid && tdmi->tdmi_network_id == onid); + break; if(tdmi == NULL) continue; diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvr/dvr.h tvheadend-3.4~git201302020954.ce67dd9/src/dvr/dvr.h --- tvheadend-3.4~git201302020753.df9eeef/src/dvr/dvr.h 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvr/dvr.h 2013-02-02 07:54:18.000000000 +0000 @@ -114,8 +114,6 @@ channel_t *de_channel; LIST_ENTRY(dvr_entry) de_channel_link; - char *de_channel_name; - gtimer_t de_timer; /** @@ -200,7 +198,6 @@ } dvr_entry_t; -#define DVR_CH_NAME(e) ((e)->de_channel == NULL ? (e)->de_channel_name : (e)-> de_channel->ch_name) /** * Autorec entry diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvr/dvr_db.c tvheadend-3.4~git201302020954.ce67dd9/src/dvr/dvr_db.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvr/dvr_db.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvr/dvr_db.c 2013-02-02 07:54:18.000000000 +0000 @@ -174,7 +174,7 @@ dvr_config_t *cfg = dvr_config_find_by_name_default(de->de_config_name); if(cfg->dvr_flags & DVR_CHANNEL_IN_TITLE) - snprintf(output, outlen, "%s-", DVR_CH_NAME(de)); + snprintf(output, outlen, "%s-", de->de_channel->ch_name); else output[0] = 0; @@ -240,12 +240,10 @@ gtimer_arm_abs(&de->de_timer, dvr_timer_expire, de, de->de_stop + cfg->dvr_retention_days * 86400); - } else if (de->de_channel) { + } else { de->de_sched_state = DVR_SCHEDULED; gtimer_arm_abs(&de->de_timer, dvr_timer_start_recording, de, preamble); - } else { - de->de_sched_state = DVR_NOSTATE; } htsp_dvr_entry_add(de); } @@ -337,7 +335,7 @@ tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\" starting at %s, " "scheduled for recording by \"%s\"", - lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), tbuf, creator); + lang_str_get(de->de_title, NULL), de->de_channel->ch_name, tbuf, creator); dvrdb_changed(); dvr_entry_save(de); @@ -460,7 +458,6 @@ LIST_REMOVE(de, de_channel_link); LIST_REMOVE(de, de_global_link); de->de_channel = NULL; - free(de->de_channel_name); dvrdb_changed(); @@ -475,7 +472,7 @@ dvr_db_load_one(htsmsg_t *c, int id) { dvr_entry_t *de; - const char *chname, *s, *creator; + const char *s, *creator; channel_t *ch; uint32_t start, stop, bcid; int d; @@ -487,10 +484,11 @@ if(htsmsg_get_u32(c, "stop", &stop)) return; - if((chname = htsmsg_get_str(c, "channel")) == NULL) + if((s = htsmsg_get_str(c, "channel")) == NULL) + return; + if((ch = channel_find_by_name(s, 0, 0)) == NULL) return; - ch = channel_find_by_name(chname, 0, 0); - + s = htsmsg_get_str(c, "config_name"); cfg = dvr_config_find_by_name_default(s); @@ -505,12 +503,8 @@ de_tally = MAX(id, de_tally); - if (ch) { - de->de_channel = ch; - LIST_INSERT_HEAD(&de->de_channel->ch_dvrs, de, de_channel_link); - } else { - de->de_channel_name = strdup(chname); - } + de->de_channel = ch; + LIST_INSERT_HEAD(&de->de_channel->ch_dvrs, de, de_channel_link); de->de_start = start; de->de_stop = stop; @@ -520,7 +514,7 @@ de->de_pri = dvr_pri2val(htsmsg_get_str(c, "pri")); if(htsmsg_get_s32(c, "start_extra", &d)) - if (ch && ch->ch_dvr_extra_time_pre) + if (ch->ch_dvr_extra_time_pre) de->de_start_extra = ch->ch_dvr_extra_time_pre; else de->de_start_extra = cfg->dvr_extra_time_pre; @@ -528,7 +522,7 @@ de->de_start_extra = d; if(htsmsg_get_s32(c, "stop_extra", &d)) - if (ch && ch->ch_dvr_extra_time_post) + if (ch->ch_dvr_extra_time_post) de->de_stop_extra = ch->ch_dvr_extra_time_post; else de->de_stop_extra = cfg->dvr_extra_time_post; @@ -602,7 +596,7 @@ lock_assert(&global_lock); - htsmsg_add_str(m, "channel", DVR_CH_NAME(de)); + htsmsg_add_str(m, "channel", de->de_channel->ch_name); htsmsg_add_u32(m, "start", de->de_start); htsmsg_add_u32(m, "stop", de->de_stop); @@ -721,7 +715,7 @@ htsp_dvr_entry_update(de); dvr_entry_notify(de); tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\": Updated Timer", - lang_str_get(de->de_title, NULL), DVR_CH_NAME(de)); + lang_str_get(de->de_title, NULL), de->de_channel->ch_name); } return de; @@ -787,7 +781,7 @@ tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\": " "End of program: %s", - lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), + lang_str_get(de->de_title, NULL), de->de_channel->ch_name, dvr_entry_status(de)); dvr_entry_save(de); @@ -822,7 +816,7 @@ de->de_rec_state = DVR_RS_PENDING; tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\" recorder starting", - lang_str_get(de->de_title, NULL), DVR_CH_NAME(de)); + lang_str_get(de->de_title, NULL), de->de_channel->ch_name); dvr_entry_notify(de); htsp_dvr_entry_update(de); @@ -855,8 +849,6 @@ { dvr_entry_t *de; - if(!e->channel) return NULL; - LIST_FOREACH(de, &e->channel->ch_dvrs, de_channel_link) if(de->de_bcast == e) return de; return NULL; @@ -937,6 +929,8 @@ { if(de->de_sched_state == DVR_RECORDING) dvr_stop_recording(de, SM_CODE_SOURCE_DELETED); + + dvr_entry_remove(de); } /** @@ -947,12 +941,8 @@ { dvr_entry_t *de; - while((de = LIST_FIRST(&ch->ch_dvrs)) != NULL) { - LIST_REMOVE(de, de_channel_link); - de->de_channel = NULL; - de->de_channel_name = strdup(ch->ch_name); + while((de = LIST_FIRST(&ch->ch_dvrs)) != NULL) dvr_entry_purge(de); - } } /** diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/dvr/dvr_rec.c tvheadend-3.4~git201302020954.ce67dd9/src/dvr/dvr_rec.c --- tvheadend-3.4~git201302020753.df9eeef/src/dvr/dvr_rec.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/dvr/dvr_rec.c 2013-02-02 07:54:18.000000000 +0000 @@ -32,7 +32,6 @@ #include "service.h" #include "plumbing/tsfix.h" #include "plumbing/globalheaders.h" -#include "htsp_server.h" #include "muxer.h" @@ -126,11 +125,12 @@ { int i, len = strlen(s); for(i = 0; i < len; i++) { - if((dvr_flags & DVR_WHITESPACE_IN_TITLE) && (s[i] == ' ' || s[i] == '\t')) - s[i] = '-'; - - if((s[i] < 32) || (s[i] > 122) || (strchr("/:\\<>|*?'\"", s[i]) != NULL)) + if(s[i] == '/' || s[i] == ':' || s[i] == '\\' || s[i] == '<' || + s[i] == '>' || s[i] == '|' || s[i] == '*' || s[i] == '?') s[i] = '-'; + + if((dvr_flags & DVR_WHITESPACE_IN_TITLE) && s[i] == ' ') + s[i] = '-'; } } @@ -176,7 +176,7 @@ if(cfg->dvr_flags & DVR_DIR_PER_CHANNEL) { - char *chname = strdup(DVR_CH_NAME(de)); + char *chname = strdup(de->de_channel->ch_name); cleanupfilename(chname,cfg->dvr_flags); snprintf(path + strlen(path), sizeof(path) - strlen(path), "/%s", chname); @@ -465,15 +465,11 @@ } if(!started) { - pthread_mutex_lock(&global_lock); - dvr_rec_set_state(de, DVR_RS_WAIT_PROGRAM_START, 0); - if(dvr_rec_start(de, sm->sm_data) == 0) { - started = 1; - dvr_entry_notify(de); - htsp_dvr_entry_update(de); - dvr_entry_save(de); - } - pthread_mutex_unlock(&global_lock); + pthread_mutex_lock(&global_lock); + dvr_rec_set_state(de, DVR_RS_WAIT_PROGRAM_START, 0); + if(dvr_rec_start(de, sm->sm_data) == 0) + started = 1; + pthread_mutex_unlock(&global_lock); } break; @@ -592,7 +588,7 @@ memset(fmap, 0, sizeof(fmap)); fmap['f'] = de->de_filename; /* full path to recoding */ fmap['b'] = basename(fbasename); /* basename of recoding */ - fmap['c'] = DVR_CH_NAME(de); /* channel name */ + fmap['c'] = de->de_channel->ch_name; /* channel name */ fmap['C'] = de->de_creator; /* user who created this recording */ fmap['t'] = lang_str_get(de->de_title, NULL); /* program title */ fmap['d'] = lang_str_get(de->de_desc, NULL); /* program description */ @@ -628,6 +624,6 @@ de->de_mux = NULL; dvr_config_t *cfg = dvr_config_find_by_name_default(de->de_config_name); - if(cfg->dvr_postproc && de->de_filename) + if(cfg->dvr_postproc) dvr_spawn_postproc(de,cfg->dvr_postproc); } diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/htsp_server.c tvheadend-3.4~git201302020954.ce67dd9/src/htsp_server.c --- tvheadend-3.4~git201302020753.df9eeef/src/htsp_server.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/htsp_server.c 2013-02-02 07:54:18.000000000 +0000 @@ -557,8 +557,7 @@ dvr_config_t *cfg; htsmsg_add_u32(out, "id", de->de_id); - if (de->de_channel) - htsmsg_add_u32(out, "channel", de->de_channel->ch_id); + htsmsg_add_u32(out, "channel", de->de_channel->ch_id); htsmsg_add_s64(out, "start", de->de_start); htsmsg_add_s64(out, "stop", de->de_stop); diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/psi.c tvheadend-3.4~git201302020954.ce67dd9/src/psi.c --- tvheadend-3.4~git201302020753.df9eeef/src/psi.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/psi.c 2013-02-02 07:54:18.000000000 +0000 @@ -89,15 +89,15 @@ int len = tsb[off++]; if(len > 0) { if(len > 188 - off) { - ps->ps_lock = 0; - return; + ps->ps_lock = 0; + return; } psi_section_reassemble0(ps, tsb + off, len, 0, crc, cb, opaque); off += len; } } - while(off < 188) { + while(off < 188 && tsb[off] != 0xff) { r = psi_section_reassemble0(ps, tsb + off, 188 - off, pusi, crc, cb, opaque); if(r < 0) { diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/rawtsinput.c tvheadend-3.4~git201302020954.ce67dd9/src/rawtsinput.c --- tvheadend-3.4~git201302020753.df9eeef/src/rawtsinput.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/rawtsinput.c 2013-02-02 07:54:18.000000000 +0000 @@ -92,15 +92,6 @@ return 100; } -/** - * - */ -static int -rawts_service_is_enabled(service_t *t) -{ - return 1; -} - /** * Generate a descriptive name for the source @@ -142,7 +133,6 @@ t->s_config_save = rawts_service_save; t->s_setsourceinfo = rawts_service_setsourceinfo; t->s_quality_index = rawts_service_quality; - t->s_is_enabled = rawts_service_is_enabled; t->s_svcname = strdup(tmp); diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/timeshift/private.h tvheadend-3.4~git201302020954.ce67dd9/src/timeshift/private.h --- tvheadend-3.4~git201302020753.df9eeef/src/timeshift/private.h 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/timeshift/private.h 2013-02-02 07:54:18.000000000 +0000 @@ -19,7 +19,7 @@ #ifndef __TVH_TIMESHIFT_PRIVATE_H__ #define __TVH_TIMESHIFT_PRIVATE_H__ -#define TIMESHIFT_PLAY_BUF 500000 // us to buffer in TX +#define TIMESHIFT_PLAY_BUF 100000 // us to buffer in TX #define TIMESHIFT_FILE_PERIOD 60 // number of secs in each buffer file /** diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/timeshift/timeshift_filemgr.c tvheadend-3.4~git201302020954.ce67dd9/src/timeshift/timeshift_filemgr.c --- tvheadend-3.4~git201302020753.df9eeef/src/timeshift/timeshift_filemgr.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/timeshift/timeshift_filemgr.c 2013-02-02 07:54:18.000000000 +0000 @@ -31,7 +31,6 @@ #include "timeshift/private.h" #include "config2.h" #include "settings.h" -#include "atomic.h" static int timeshift_reaper_run; static timeshift_file_list_t timeshift_reaper_list; @@ -39,7 +38,8 @@ static pthread_mutex_t timeshift_reaper_lock; static pthread_cond_t timeshift_reaper_cond; -uint64_t timeshift_total_size; +pthread_mutex_t timeshift_size_lock; +size_t timeshift_total_size; /* ************************************************************************** * File reaper thread @@ -75,7 +75,10 @@ if (errno != ENOTEMPTY) tvhlog(LOG_ERR, "timeshift", "failed to remove %s [e=%s]", dpath, strerror(errno)); - atomic_add_u64(×hift_total_size, -tsf->size); + pthread_mutex_lock(×hift_size_lock); + assert(tsf->size <= timeshift_total_size); + timeshift_total_size -= tsf->size; + pthread_mutex_unlock(×hift_size_lock); /* Free memory */ while ((ti = TAILQ_FIRST(&tsf->iframes))) { @@ -148,7 +151,9 @@ if (r > 0) { tsf->size += r; - atomic_add_u64(×hift_total_size, r); + pthread_mutex_lock(×hift_size_lock); + timeshift_total_size += r; + pthread_mutex_unlock(×hift_size_lock); } close(tsf->fd); tsf->fd = -1; @@ -225,11 +230,12 @@ } /* Check size */ - if (!timeshift_unlimited_size && - atomic_add_u64(×hift_total_size, 0) >= timeshift_max_size) { + pthread_mutex_lock(×hift_size_lock); + if (!timeshift_unlimited_size && timeshift_total_size >= timeshift_max_size) { tvhlog(LOG_DEBUG, "timshift", "ts %d buffer full", ts->id); ts->full = 1; } + pthread_mutex_unlock(×hift_size_lock); /* Create new file */ tsf_tmp = NULL; @@ -326,6 +332,7 @@ /* Size processing */ timeshift_total_size = 0; + pthread_mutex_init(×hift_size_lock, NULL); /* Start the reaper thread */ timeshift_reaper_run = 1; diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/timeshift/timeshift_writer.c tvheadend-3.4~git201302020954.ce67dd9/src/timeshift/timeshift_writer.c --- tvheadend-3.4~git201302020753.df9eeef/src/timeshift/timeshift_writer.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/timeshift/timeshift_writer.c 2013-02-02 07:54:18.000000000 +0000 @@ -20,7 +20,6 @@ #include "streaming.h" #include "timeshift.h" #include "timeshift/private.h" -#include "atomic.h" #include #include @@ -225,7 +224,9 @@ if (err > 0) { tsf->last = sm->sm_time; tsf->size += err; - atomic_add_u64(×hift_total_size, err); + pthread_mutex_lock(×hift_size_lock); + timeshift_total_size += err; + pthread_mutex_unlock(×hift_size_lock); } return err; } diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/timeshift.c tvheadend-3.4~git201302020954.ce67dd9/src/timeshift.c --- tvheadend-3.4~git201302020753.df9eeef/src/timeshift.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/timeshift.c 2013-02-02 07:54:18.000000000 +0000 @@ -41,7 +41,7 @@ int timeshift_unlimited_period; uint32_t timeshift_max_period; int timeshift_unlimited_size; -uint64_t timeshift_max_size; +size_t timeshift_max_size; /* * Intialise global file manager diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/timeshift.h tvheadend-3.4~git201302020954.ce67dd9/src/timeshift.h --- tvheadend-3.4~git201302020753.df9eeef/src/timeshift.h 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/timeshift.h 2013-02-02 07:54:18.000000000 +0000 @@ -25,8 +25,10 @@ extern int timeshift_unlimited_period; extern uint32_t timeshift_max_period; extern int timeshift_unlimited_size; -extern uint64_t timeshift_max_size; -extern uint64_t timeshift_total_size; +extern size_t timeshift_max_size; + +extern size_t timeshift_total_size; +extern pthread_mutex_t timeshift_size_lock; typedef struct timeshift_status { diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/webui/extjs.c tvheadend-3.4~git201302020954.ce67dd9/src/webui/extjs.c --- tvheadend-3.4~git201302020753.df9eeef/src/webui/extjs.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/webui/extjs.c 2013-02-02 07:54:18.000000000 +0000 @@ -1389,8 +1389,8 @@ m = htsmsg_create_map(); - htsmsg_add_str(m, "channel", DVR_CH_NAME(de)); if(de->de_channel != NULL) { + htsmsg_add_str(m, "channel", de->de_channel->ch_name); if (de->de_channel->ch_icon) htsmsg_add_imageurl(m, "chicon", "imagecache/%d", de->de_channel->ch_icon); diff -Nru tvheadend-3.4~git201302020753.df9eeef/src/webui/simpleui.c tvheadend-3.4~git201302020954.ce67dd9/src/webui/simpleui.c --- tvheadend-3.4~git201302020753.df9eeef/src/webui/simpleui.c 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/src/webui/simpleui.c 2013-02-02 07:54:18.000000000 +0000 @@ -322,7 +322,7 @@ a.tm_hour, a.tm_min, b.tm_hour, b.tm_min); htsbuf_qprintf(hq, "
\"%s\": \"%s\"

", - DVR_CH_NAME(de), lang_str_get(de->de_title, NULL)); + de->de_channel->ch_name, lang_str_get(de->de_title, NULL)); if((rstatus = val2str(de->de_sched_state, recstatustxt)) != NULL) htsbuf_qprintf(hq, "Recording status: %s
", rstatus); diff -Nru tvheadend-3.4~git201302020753.df9eeef/support/getmuxlist tvheadend-3.4~git201302020954.ce67dd9/support/getmuxlist --- tvheadend-3.4~git201302020753.df9eeef/support/getmuxlist 2013-02-02 05:53:24.000000000 +0000 +++ tvheadend-3.4~git201302020954.ce67dd9/support/getmuxlist 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#!/bin/bash -# -# Fetch DVB scan files -# - -# Arguments -DIR=$1 -[ -z "$DIR" ] && DIR=$(dirname $0)/../data/dvb-scan - -# Update -if [ -d ${DIR}/.git ]; then - (cd ${DIR}; git pull) &> /dev/null - -# Fetch -else - rm -rf ${DIR} &> /dev/null - URL=git://linuxtv.org/dtv-scan-tables.git - git clone $URL ${DIR} &> /dev/null -fi