From 3f0ca5d08240fe7d311eab41a411b0e2e3d63f6a Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Sun, 14 Oct 2012 13:42:05 +0200 Subject: [PATCH 01/36] Polish Character Encoding Fixes --- data/conf/charset | 208 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 188 insertions(+), 20 deletions(-) diff --git a/data/conf/charset b/data/conf/charset index e597bb74..01fd4fcf 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -1,31 +1,73 @@ [ + { + "tsid": 1048, + "onid": 1, + "charset": "PL_AUTO", + "sid": 4310, + "description": "Astra 19.2E TV Trwam" + }, + { + "tsid": 1059, + "onid": 1, + "charset": "PL_AUTO", + "sid": 0, + "description": "Astra 19.2E TVP" + }, + { + "tsid": 1111, + "onid": 1, + "charset": "PL_AUTO", + "sid": 7269, + "description": "Astra 19.2E TV Trwam" + }, + { + "tsid": 8100, + "onid": 156, + "charset": "PL_AUTO", + "sid": 1500, + "description": "Eurobird 9.0E TV Polonia" + }, + { + "tsid": 8300, + "onid": 156, + "charset": "PL_AUTO", + "sid": 620, + "description": "Eurobird 9.0E TVN International" + }, { "tsid": 200, "onid": 318, "charset": "PL_AUTO", - "sid": 13878, - "description": "ESP2 NE Polish" + "sid": 13834, + "description": "Hotbird 13.0 Eutelsat Eurosport PL" }, { "tsid": 200, "onid": 318, "charset": "PL_AUTO", "sid": 13864, - "description": "EUROSPORT2 PL" + "description": "Hotbird 13.0 Eutelsat Eurosport 2 PL" }, { "tsid": 200, "onid": 318, "charset": "PL_AUTO", "sid": 13865, - "description": "Hotbird Eutelsat (Eurosport)" + "description": "Hotbird 13.0 Eutelsat Eurosport PL" + }, + { + "tsid": 200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13878, + "description": "Hotbird 13.0 Eutelsat Eurosport 2 NE PL" }, { "tsid": 300, "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 Animal Planet HD" + "description": "Hotbird 13.0 ITI/Nka HD PL" }, { "tsid": 400, @@ -74,28 +116,35 @@ "onid": 318, "charset": "PL_AUTO", "sid": 13070, - "description": "Hotbird 13.0 Cyfra+ ESP HD PL" + "description": "Hotbird 13.0 Cyfra+ Eurosport HD PL" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13080, + "description": "Hotbird 13.0 Cyfra+ Eurosport HD PL" }, { "tsid": 400, "onid": 318, "charset": "PL_AUTO", "sid": 13081, - "description": "EUROSPORT HD" + "description": "Hotbird 13.0 Cyfra+ Eurosport HD PL" }, { "tsid": 400, "onid": 318, "charset": "PL_AUTO", "sid": 13082, - "description": "EUROSPORT HD" + "description": "Hotbird 13.0 Cyfra+ Eurosport HD PL" }, { "tsid": 1000, "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 Grupa ITI" + "description": "Hotbird 13.0 ITI/Nka TVN" }, { "tsid": 1100, @@ -104,6 +153,27 @@ "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, + { + "tsid": 1300, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 ITI/Nka" + }, + { + "tsid": 1400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 30, + "description": "Hotbird 13.0 Nick Junior" + }, + { + "tsid": 1400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 31, + "description": "Hotbird 13.0 Nickelodeon HD" + }, { "tsid": 1500, "onid": 318, @@ -116,7 +186,7 @@ "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 EskaTV, TVN" + "description": "Hotbird 13.0 ITI/Nka EskaTV, TVN" }, { "tsid": 1800, @@ -132,6 +202,13 @@ "sid": 0, "description": "Hotbird 13.0 Cyfrowy Polsat" }, + { + "tsid": 7700, + "onid": 318, + "charset": "PL_AUTO", + "sid": 117, + "description": "Hotbird 13.0 Hot TV PL" + }, { "tsid": 7800, "onid": 113, @@ -150,8 +227,43 @@ "tsid": 8100, "onid": 318, "charset": "PL_AUTO", - "sid": 0, - "description": "Hotbird 13.0 Eutelsat (Universal)" + "sid": 14900, + "description": "Hotbird 13.0 Eutelsat Sport Klub PL" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14901, + "description": "Hotbird 13.0 Eutelsat Universal CE" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14902, + "description": "Hotbird 13.0 Eutelsat Sci-Fi CE" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14910, + "description": "Hotbird 13.0 Eutelsat Sport Klub PL" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14911, + "description": "Hotbird 13.0 Eutelsat Universal CE" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14912, + "description": "Hotbird 13.0 Eutelsat Sci-Fi CE" }, { "tsid": 11000, @@ -160,6 +272,20 @@ "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, + { + "tsid": 11100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 4661, + "description": "Hotbird 13.0 Eutelsat Wedding TV" + }, + { + "tsid": 11200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Polsat Cyfrowy PPV" + }, { "tsid": 11400, "onid": 318, @@ -172,7 +298,7 @@ "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 BBC HD, ITI" + "description": "Hotbird 13.0 ITI/Nka" }, { "tsid": 11900, @@ -182,46 +308,74 @@ "description": "Hotbird 13.0 Cyfra+" }, { - "tsid": 12200, + "tsid": 12000, "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 Disney Channel Polska, TCM and other" + "description": "Hotbird 13.0 Polsat Cyfrowy" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7457, + "description": "Hotbird 13.0 Globecast Cartoon Network PL / TCM CE" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7466, + "description": "Hotbird 13.0 Globecast Disney Channel PL" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7467, + "description": "Hotbird 13.0 Globecast Cartoon Network CE" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7468, + "description": "Hotbird 13.0 Globecast TCM CE" }, { "tsid": 12800, "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 Viacom ... MTV / VH1 Polska" + "description": "Hotbird 13.0 Viacom MTV / VH1 Polska" }, { "tsid": 13000, "onid": 318, "charset": "PL_AUTO", "sid": 0, - "description": "Hotbird 13.0 BBC Polska, TLC and other" + "description": "Hotbird 13.0 Globecast Orange PL" }, { "tsid": 13100, "onid": 318, "charset": "PL_AUTO", "sid": 7322, - "description": "TV5 Monde Europe" + "description": "Hotbird 13.0 TV5 Monde Europe" }, { "tsid": 13100, "onid": 318, "charset": "PL_AUTO", "sid": 7324, - "description": "Hotbird 13.0 Crime and Investigation" + "description": "Hotbird 13.0 Crime & Investigation" }, { "tsid": 13100, "onid": 318, "charset": "PL_AUTO", "sid": 7325, - "description": "Hotbird 13.0 Crime + Investigation" + "description": "Hotbird 13.0 Crime & Investigation" }, { "tsid": 13200, @@ -230,6 +384,20 @@ "sid": 0, "description": "Hotbird 13.0 Cyfrowy Polsat" }, + { + "tsid": 13400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 4754, + "description": "Hotbird 13.0 TVR" + }, + { + "tsid": 15400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13511, + "description": "Hotbird 13.0 Rebel TV" + } { "tsid": 15700, "onid": 318, From 6df3e69335c0cf692663f2049ab1e2d7bb804b58 Mon Sep 17 00:00:00 2001 From: Vuolter Date: Fri, 3 May 2013 15:12:09 +0200 Subject: [PATCH 02/36] README updated --- README | 14 +++++++++++--- README.md | 18 +++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/README b/README index dd1cc6ef..2ead1fa8 100644 --- a/README +++ b/README @@ -1,7 +1,14 @@ -Tvheadend (TV streaming server) v3.5 +Tvheadend v3.5 ==================================== (c) 2006 - 2013 Andreas Öman, et al. + +What it is +---------- + +Tvheadend is a TV streaming server and digital video recorder, supporting DVB-S, DVB-S2, DVB-C, DVB-T, DVB-T2, ATSC, IPTV, and Analog video (V4L) as input sources. + + How to build for Linux ---------------------- @@ -16,7 +23,7 @@ Build the binary: $ make -After build, the binary resides in `build.linux/`. +After build, the binary resides in `build.linux` directory. Thus, to start it, just type: @@ -24,10 +31,11 @@ Thus, to start it, just type: Settings are stored in `$HOME/.hts/tvheadend`. + Further information ------------------- -For more information about building, including generating packages please visit: +For more information about building, including generating packages, please visit: > https://tvheadend.org/projects/tvheadend/wiki/Building > https://tvheadend.org/projects/tvheadend/wiki/Packaging > https://tvheadend.org/projects/tvheadend/wiki/Git diff --git a/README.md b/README.md index 5f2c0675..6c7c7bfc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,14 @@ -Tvheadend (TV streaming server) +Tvheadend ==================================== (c) 2006 - 2013 Andreas Öman, et al. + +What it is +---------- + +Tvheadend is a TV streaming server and digital video recorder, supporting DVB-S, DVB-S2, DVB-C, DVB-T, DVB-T2, ATSC, IPTV, and Analog video (V4L) as input sources. + + How to build for Linux ---------------------- @@ -16,7 +23,7 @@ Build the binary: $ make -After build, the binary resides in `build.linux/`. +After build, the binary resides in `build.linux` directory. Thus, to start it, just type: @@ -24,10 +31,11 @@ Thus, to start it, just type: Settings are stored in `$HOME/.hts/tvheadend`. + Further information ------------------- -For more information about building, including generating packages please visit: -> https://tvheadend.org/projects/tvheadend/wiki/Building -> https://tvheadend.org/projects/tvheadend/wiki/Packaging +For more information about building, including generating packages, please visit: +> https://tvheadend.org/projects/tvheadend/wiki/Building +> https://tvheadend.org/projects/tvheadend/wiki/Packaging > https://tvheadend.org/projects/tvheadend/wiki/Git From f6547d5ad9335a81bf78af681ca94130efbbffd3 Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Wed, 22 May 2013 09:17:16 +0200 Subject: [PATCH 03/36] upstream uptodate file --- data/conf/charset | 548 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 548 insertions(+) create mode 100644 data/conf/charset diff --git a/data/conf/charset b/data/conf/charset new file mode 100644 index 00000000..63ff8f75 --- /dev/null +++ b/data/conf/charset @@ -0,0 +1,548 @@ +[ + { + "tsid": 1048, + "onid": 1, + "charset": "PL_AUTO", + "sid": 4310, + "description": "Astra 19.2E TV Trwam" + }, + { + "tsid": 1059, + "onid": 1, + "charset": "PL_AUTO", + "sid": 0, + "description": "Astra 19.2E TVP" + }, + { + "tsid": 8100, + "onid": 156, + "charset": "PL_AUTO", + "sid": 1500, + "description": "Eurobird 9.0E TV Polonia" + }, + { + "tsid": 8300, + "onid": 156, + "charset": "PL_AUTO", + "sid": 620, + "description": "Eurobird 9.0E TVN International" + }, + { + "tsid": 200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13834, + "description": "Hotbird 13.0 Eutelsat Eurosport PL" + }, + { + "tsid": 200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13864, + "description": "Hotbird 13.0 Eutelsat Eurosport 2 PL" + }, + { + "tsid": 200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13865, + "description": "Hotbird 13.0 Eutelsat Eurosport PL" + }, + { + "tsid": 200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13878, + "description": "Hotbird 13.0 Eutelsat Eurosport 2 NE PL" + }, + { + "tsid": 300, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+ HD PL" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13020, + "description": "Hotbird 13.0 NC+ Canal+ HD PL" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13022, + "description": "Hotbird 13.0 NC+ Canal+ Sport HD Polska" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13023, + "description": "Hotbird 13.0 NC+ Nat Geographic HD Polska" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13025, + "description": "Hotbird 13.0 NC+ Filmbox HD" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13026, + "description": "Hotbird 13.0 NC+ AXN Spin HD" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13027, + "description": "Hotbird 13.0 NC+ TVN 7 HD" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13070, + "description": "Hotbird 13.0 NC+ Eurosport HD PL" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13080, + "description": "Hotbird 13.0 NC+ Eurosport HD PL" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13081, + "description": "Hotbird 13.0 NC+ Eurosport HD PL" + }, + { + "tsid": 400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13082, + "description": "Hotbird 13.0 NC+ Eurosport HD PL" + }, + { + "tsid": 1000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+ TVN" + }, + { + "tsid": 1100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 1300, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 1400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 30, + "description": "Hotbird 13.0 Nick Junior" + }, + { + "tsid": 1400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 31, + "description": "Hotbird 13.0 Nickelodeon HD" + }, + { + "tsid": 1500, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 1600, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 1800, + "onid": 200, + "charset": "PL_AUTO", + "sid": 3623, + "description": "Hotbird 13.0 Polo TV" + }, + { + "tsid": 7400, + "onid": 113, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Cyfrowy Polsat" + }, + { + "tsid": 7700, + "onid": 318, + "charset": "PL_AUTO", + "sid": 117, + "description": "Hotbird 13.0 Hot TV PL" + }, + { + "tsid": 7800, + "onid": 113, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Cyfrowy Polsat" + }, + { + "tsid": 7900, + "onid": 113, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Cyfrowy Polsat" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14900, + "description": "Hotbird 13.0 Eutelsat Sport Klub PL" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14901, + "description": "Hotbird 13.0 Eutelsat Universal CE" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14902, + "description": "Hotbird 13.0 Eutelsat Sci-Fi CE" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14910, + "description": "Hotbird 13.0 Eutelsat Sport Klub PL" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14911, + "description": "Hotbird 13.0 Eutelsat Universal CE" + }, + { + "tsid": 8100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14912, + "description": "Hotbird 13.0 Eutelsat Sci-Fi CE" + }, + { + "tsid": 11000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 11100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 4680, + "description": "Hotbird 13.0 Eutelsat 13th Street PL" + }, + { + "tsid": 11200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Polsat Cyfrowy" + }, + { + "tsid": 11400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 11500, + "onid": 318, + "charset": "PL_AUTO", + "sid": 17309, + "description": "Hotbird 13.0 Baby TV PL" + }, + { + "tsid": 11600, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 11900, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 NC+" + }, + { + "tsid": 12000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Polsat Cyfrowy" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7457, + "description": "Hotbird 13.0 Globecast Cartoon Network PL / TCM CE" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7466, + "description": "Hotbird 13.0 Globecast Disney Channel PL" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7467, + "description": "Hotbird 13.0 Globecast Cartoon Network CE" + }, + { + "tsid": 12200, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7468, + "description": "Hotbird 13.0 Globecast TCM CE" + }, + { + "tsid": 12800, + "onid": 318, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 MTV Networks" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14602, + "description": "Hotbird 13.0 Globecast BBC Entertainment" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14603, + "description": "Hotbird 13.0 Globecast BBC Knowledge" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14604, + "description": "Hotbird 13.0 Globecast BBC Lifestyle" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14605, + "description": "Hotbird 13.0 Globecast BBC Cbeebies" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14612, + "description": "Hotbird 13.0 Globecast IDiscovery" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14613, + "description": "Hotbird 13.0 Globecast TLC Polska" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14619, + "description": "Hotbird 13.0 Globecast MTV Dance" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14620, + "description": "Hotbird 13.0 Globecast Viasat Explorer" + }, + { + "tsid": 13000, + "onid": 318, + "charset": "PL_AUTO", + "sid": 14621, + "description": "Hotbird 13.0 Globecast ESPN America" + }, + { + "tsid": 13100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7324, + "description": "Hotbird 13.0 Crime & Investigation" + }, + { + "tsid": 13100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7325, + "description": "Hotbird 13.0 Crime & Investigation" + }, + { + "tsid": 13200, + "onid": 113, + "charset": "PL_AUTO", + "sid": 0, + "description": "Hotbird 13.0 Cyfrowy Polsat" + }, + { + "tsid": 13400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 4754, + "description": "Hotbird 13.0 TVR" + }, + { + "tsid": 15400, + "onid": 318, + "charset": "PL_AUTO", + "sid": 13511, + "description": "Hotbird 13.0 RBL.TV" + }, + { + "tsid": 15700, + "onid": 318, + "charset": "PL_AUTO", + "sid": 10626, + "description": "Hotbird 13.0 Disco TV" + }, + { + "tsid": 1, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12070.50 H" + }, + { + "tsid": 2, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11797.50 H" + }, + { + "tsid": 3, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11719.50 H" + }, + { + "tsid": 4, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12031.50 H" + }, + { + "tsid": 6, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11914.50 H" + }, + { + "tsid": 10, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11332.25 H" + }, + { + "tsid": 11, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12382.50 H" + }, + { + "tsid": 12, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12304.50 H" + }, + { + "tsid": 13, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11992.50 H" + }, + { + "tsid": 14, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11875.50 H" + }, + { + "tsid": 15, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 10920.75 H" + }, + { + "tsid": 17, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11758.50 H" + }, + { + "tsid": 33, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12480.00 V" + } +] From a636cf69945f3be59041a791e4246846912d1108 Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Wed, 22 May 2013 09:20:37 +0200 Subject: [PATCH 04/36] Greek character encoding override addition based on nonstandard_encoding from IPBox HD --- data/conf/charset | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/data/conf/charset b/data/conf/charset index 63ff8f75..9f39d2bc 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -27,6 +27,13 @@ "sid": 620, "description": "Eurobird 9.0E TVN International" }, + { + "tsid": 200, + "onid": 318, + "charset": "ISO8859-7", + "sid": 13805, + "description": "Hotbird 13.0 Eutelsat Eurosport GR" + }, { "tsid": 200, "onid": 318, @@ -34,6 +41,13 @@ "sid": 13834, "description": "Hotbird 13.0 Eutelsat Eurosport PL" }, + { + "tsid": 200, + "onid": 318, + "charset": "ISO8859-7", + "sid": 13840, + "description": "Hotbird 13.0 Eutelsat Eurosport GR" + }, { "tsid": 200, "onid": 318, @@ -188,6 +202,34 @@ "sid": 3623, "description": "Hotbird 13.0 Polo TV" }, + { + "tsid": 5500, + "onid": 318, + "charset": "ISO8859-7", + "sid": 0, + "description": "Hotbird 13.0 Nova GR" + }, + { + "tsid": 6100, + "onid": 318, + "charset": "ISO8859-7", + "sid": 0, + "description": "Hotbird 13.0 Nova GR" + }, + { + "tsid": 7100, + "onid": 318, + "charset": "ISO8859-7", + "sid": 0, + "description": "Hotbird 13.0 Nova GR" + }, + { + "tsid": 7300, + "onid": 318, + "charset": "ISO8859-7", + "sid": 0, + "description": "Hotbird 13.0 Nova GR" + }, { "tsid": 7400, "onid": 113, @@ -314,6 +356,13 @@ "sid": 0, "description": "Hotbird 13.0 Polsat Cyfrowy" }, + { + "tsid": 12100, + "onid": 318, + "charset": "ISO8859-7", + "sid": 0, + "description": "Hotbird 13.0 Nova GR" + }, { "tsid": 12200, "onid": 318, From 5a163d7638851113ddb8b7d78db047ab3462d98c Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Wed, 22 May 2013 09:26:06 +0200 Subject: [PATCH 05/36] Turkish character encoding override addition based on encoding.conf from http://git.opendreambox.org/?p=enigma2.git;a=summary --- data/conf/charset | 133 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/data/conf/charset b/data/conf/charset index 9f39d2bc..238ccd10 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -593,5 +593,138 @@ "charset": "ISO8859-15", "sid": 0, "description": "Astra 19.2E Sky Germany 12480.00 V" + }, + { + "tsid": 20400, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10762.00 V" + }, + { + "tsid": 20600, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10803.75 V" + }, + { + "tsid": 20700, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10845.00 H" + }, + { + "tsid": 20800, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10845.25 V" + }, + { + "tsid": 20900, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 108877.00 H" + }, + { + "tsid": 21000, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10928.00 H" + }, + { + "tsid": 21100, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10887.00 V" + }, + { + "tsid": 21200, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 10928.00 V" + }, + { + "tsid": 41200, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11455.50 V" + }, + { + "tsid": 50100, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11471.00 H" + }, + { + "tsid": 50200, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11492.00 V" + }, + { + "tsid": 50300, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11673.00 H" + }, + { + "tsid": 50400, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11534.00 V" + }, + { + "tsid": 50500, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11554.00 H" + }, + { + "tsid": 50600, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11575.00 V" + }, + { + "tsid": 50700, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11596.00 H" + }, + { + "tsid": 50800, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11679.00 H" + }, + { + "tsid": 50900, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11513.00 H" + }, + { + "tsid": 51000, + "onid": 126, + "charset": "ISO8859-9", + "sid": 0, + "description": "Turksat 7E Digitürk 11617.00 V" } ] From db947242a6bbd985a3ada295170d46084aa68b06 Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Wed, 22 May 2013 09:28:34 +0200 Subject: [PATCH 06/36] Moving skyde overrides to the beggining of the file to sort the list in the alphabetical order just like sattelites names go and skyde is located on Astra hence is deserves the place in the start --- data/conf/charset | 182 +++++++++++++++++++++++----------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/data/conf/charset b/data/conf/charset index 238ccd10..926bc1ce 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -1,4 +1,95 @@ [ + { + "tsid": 1, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12070.50 H" + }, + { + "tsid": 2, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11797.50 H" + }, + { + "tsid": 3, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11719.50 H" + }, + { + "tsid": 4, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12031.50 H" + }, + { + "tsid": 6, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11914.50 H" + }, + { + "tsid": 10, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11332.25 H" + }, + { + "tsid": 11, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12382.50 H" + }, + { + "tsid": 12, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12304.50 H" + }, + { + "tsid": 13, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11992.50 H" + }, + { + "tsid": 14, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11875.50 H" + }, + { + "tsid": 15, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 10920.75 H" + }, + { + "tsid": 17, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 11758.50 H" + }, + { + "tsid": 33, + "onid": 133, + "charset": "ISO8859-15", + "sid": 0, + "description": "Astra 19.2E Sky Germany 12480.00 V" + }, { "tsid": 1048, "onid": 1, @@ -503,97 +594,6 @@ "sid": 10626, "description": "Hotbird 13.0 Disco TV" }, - { - "tsid": 1, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 12070.50 H" - }, - { - "tsid": 2, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11797.50 H" - }, - { - "tsid": 3, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11719.50 H" - }, - { - "tsid": 4, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 12031.50 H" - }, - { - "tsid": 6, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11914.50 H" - }, - { - "tsid": 10, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11332.25 H" - }, - { - "tsid": 11, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 12382.50 H" - }, - { - "tsid": 12, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 12304.50 H" - }, - { - "tsid": 13, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11992.50 H" - }, - { - "tsid": 14, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11875.50 H" - }, - { - "tsid": 15, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 10920.75 H" - }, - { - "tsid": 17, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 11758.50 H" - }, - { - "tsid": 33, - "onid": 133, - "charset": "ISO8859-15", - "sid": 0, - "description": "Astra 19.2E Sky Germany 12480.00 V" - }, { "tsid": 20400, "onid": 126, From 5c8ade8536b762dbce855ed2c306b44cf50f8136 Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Wed, 22 May 2013 09:33:29 +0200 Subject: [PATCH 07/36] I have found several ovverrides http://www.ab-forum.info/viewtopic.php?f=147&t=41393 that help with encoding on the platforms of Easteuropean origin for enigma2 boxes. This commit sets encoding for Romanian channels from RCS DigiTV --- data/conf/charset | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/data/conf/charset b/data/conf/charset index 926bc1ce..608620df 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -594,6 +594,97 @@ "sid": 10626, "description": "Hotbird 13.0 Disco TV" }, + { + "tsid": 1, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 2, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 3, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 4, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 5, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 6, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 7, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 8, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 9, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 10, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 11, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 12, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, + { + "tsid": 13, + "onid": 1, + "charset": "ISO8859-2", + "sid": 0, + "description": "Intelsat/Thor 1W RCS DigiTV" + }, { "tsid": 20400, "onid": 126, From ac53915b9785a65e607854c341ba54f75ec387d6 Mon Sep 17 00:00:00 2001 From: Wojciech Myrda Date: Wed, 22 May 2013 09:37:20 +0200 Subject: [PATCH 08/36] The lists out there set ISO8859-5 encoding for all the channels in the "Sattelite BG" digital platform from 23.5E however hence several of those transponders share their channels with other platforms this commit sets in only where it is safe meaning where channels are used by this platform only. To set them for others would require more testing --- data/conf/charset | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/data/conf/charset b/data/conf/charset index 608620df..b8a0cb00 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -104,6 +104,20 @@ "sid": 0, "description": "Astra 19.2E TVP" }, + { + "tsid": 3218, + "onid": 3, + "charset": "ISO8859-5", + "sid": 0, + "description": "Astra 23.5E Satellite BG 12051.00 V" + }, + { + "tsid": 3226, + "onid": 3, + "charset": "ISO8859-5", + "sid": 0, + "description": "Astra 23.5E Satellite BG 12207.00 V" + }, { "tsid": 8100, "onid": 156, From dcbfd1425ade55cd253039afce2f9702f766e663 Mon Sep 17 00:00:00 2001 From: CSchlipp Date: Wed, 22 May 2013 09:49:33 +0200 Subject: [PATCH 09/36] Change status.xml to default xml-style with only one element/tag per line Change status.xml to default xml-style with only one element/tag per line. Makes it a lot more easier to parse the file. --- src/webui/simpleui.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/webui/simpleui.c b/src/webui/simpleui.c index 30f87699..c4fe3e2c 100644 --- a/src/webui/simpleui.c +++ b/src/webui/simpleui.c @@ -1,6 +1,6 @@ /* * tvheadend, WEBUI / HTML user interface - * Copyright (C) 2008 Andreas Öman + * Copyright (C) 2008 Andreas �man * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -422,20 +422,20 @@ page_status(http_connection_t *hc, html_escape(buf, lang_str_get(de->de_title, NULL), sizeof(buf)); htsbuf_qprintf(hq, - "" - "" - "%d/%02d/%02d" - "" - "%"PRItime_t"" - "%"PRItime_t"" - "" - "" - "%d/%02d/%02d" - "" - "%"PRItime_t"" - "%"PRItime_t"" - "" - "%s", + "\n" + "\n" + "%d/%02d/%02d\n" + "\n" + "%"PRItime_t"\n" + "%"PRItime_t"\n" + "\n" + "\n" + "%d/%02d/%02d\n" + "\n" + "%"PRItime_t"\n" + "%"PRItime_t"\n" + "\n" + "%s\n", a.tm_year + 1900, a.tm_mon + 1, a.tm_mday, a.tm_hour, a.tm_min, de->de_start, @@ -448,14 +448,14 @@ page_status(http_connection_t *hc, rstatus = val2str(de->de_sched_state, recstatustxt); html_escape(buf, rstatus, sizeof(buf)); - htsbuf_qprintf(hq, "%s\n", buf); + htsbuf_qprintf(hq, "%s\n\n", buf); cc++; timeleft = -1; } } if ((cc==0) && (timeleft < INT_MAX)) { - htsbuf_qprintf(hq, "%d\n",timeleft); + htsbuf_qprintf(hq, "\n%d\n\n",timeleft); } dvr_query_free(&dqr); From cae63f8a942b0d266067f31067beb3205a61eefe Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 13:54:12 +0200 Subject: [PATCH 10/36] Add PLATFORM_* define to config.h to allow supporting non Linux platforms. --- support/configure.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/support/configure.inc b/support/configure.inc index 9b745c03..e5c5acd6 100755 --- a/support/configure.inc +++ b/support/configure.inc @@ -486,6 +486,11 @@ EOF CONFIG_H="${BUILDDIR}/config.h" cat > "${CONFIG_H}" < ${CONFIG_H} < Date: Sat, 4 May 2013 13:57:34 +0200 Subject: [PATCH 11/36] Enable SSL per default on FreeBSD because libssl is in base so it's always available. --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index fcec9de4..6e4577fb 100755 --- a/configure +++ b/configure @@ -74,7 +74,10 @@ check_bin bzip2 || echo 'WARN: no bzip2 binary found' # # SSL # -if check_pkg openssl || check_pkg libssl; then +if [ ${PLATFORM} = "freebsd" ]; then + # FreeBSD has libssl in base + enable ssl +elif check_pkg openssl || check_pkg libssl; then enable ssl else die "SSL development support not found" From 946130a832649b7708aa53e6c4b366655d6b4376 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 13:59:54 +0200 Subject: [PATCH 12/36] Avoid "install -D" because the flag is not available on FreeBSD. --- support/posix.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/support/posix.mk b/support/posix.mk index 03e772da..693db1e6 100644 --- a/support/posix.mk +++ b/support/posix.mk @@ -5,8 +5,10 @@ INSTICON= ${DESTDIR}$(prefix)/share/icons/hicolor/scalable/apps install: ${PROG} ${MAN} - install -D ${PROG} ${DESTDIR}${bindir}/tvheadend - install -D ${MAN} ${DESTDIR}${mandir}/tvheadend.1 + install -d ${DESTDIR}${bindir} + install ${PROG} ${DESTDIR}${bindir}/tvheadend + install -d ${DESTDIR}${mandir} + install ${MAN} ${DESTDIR}${mandir}/tvheadend.1 for bundle in ${BUNDLES}; do \ mkdir -p ${DESTDIR}${datadir}/tvheadend/$$bundle ;\ From 3103e1814a78e0cb93db357628ecffb33bf4e70d Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:04:08 +0200 Subject: [PATCH 13/36] Add missing include for FreeBSD which has AF_INET6 defined in sys/socket.h tvheadend-3.4/src/access.c: In function 'netmask_verify': tvheadend-3.4/src/access.c:164: error: dereferencing pointer to incomplete type tvheadend-3.4/src/access.c:164: error: 'AF_INET6' undeclared (first use in this function) tvheadend-3.4/src/access.c:164: error: (Each undeclared identifier is reported only once tvheadend-3.4/src/access.c:164: error: for each function it appears in.) tvheadend-3.4/src/access.c:177: error: dereferencing pointer to incomplete type tvheadend-3.4/src/access.c:177: error: 'AF_INET' undeclared (first use in this function) tvheadend-3.4/src/access.c:193: error: dereferencing pointer to incomplete type tvheadend-3.4/src/access.c: In function 'access_set_prefix': tvheadend-3.4/src/access.c:422: error: 'AF_INET6' undeclared (first use in this function) tvheadend-3.4/src/access.c: In function 'access_record_build': tvheadend-3.4/src/access.c:554: error: 'AF_INET6' undeclared (first use in this function) --- src/access.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/access.c b/src/access.c index 25ee2948..19d8eef6 100644 --- a/src/access.c +++ b/src/access.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include From 99e5d63e81635ddaec46fc0a4077105bc8e5fa9b Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:10:42 +0200 Subject: [PATCH 14/36] Add missing includes for shutdown(2) and SHUT_RDWR on FreeBSD. tvheadend-3.4/src/cwc.c: In function 'cwc_session': tvheadend-3.4/src/cwc.c:1139: warning: implicit declaration of function 'shutdown' tvheadend-3.4/src/cwc.c:1139: error: 'SHUT_RDWR' undeclared (first use in this function) tvheadend-3.4/src/cwc.c:1139: error: (Each undeclared identifier is reported only once tvheadend-3.4/src/cwc.c:1139: error: for each function it appears in.) tvheadend-3.4/src/cwc.c: In function 'cwc_entry_update': tvheadend-3.4/src/cwc.c:2369: error: 'SHUT_RDWR' undeclared --- src/cwc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cwc.c b/src/cwc.c index 60d2cb11..c4e3e590 100644 --- a/src/cwc.c +++ b/src/cwc.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include "tvheadend.h" From 70d79169eaece032bc10c0d703bf0dcf798a6487 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:16:33 +0200 Subject: [PATCH 15/36] Remove unused sys/epoll.h includes --- src/dvb/dvb_input_raw.c | 1 - src/dvb/dvb_tables.c | 1 - src/timeshift.c | 1 - src/timeshift/timeshift_filemgr.c | 1 - src/timeshift/timeshift_reader.c | 1 - src/timeshift/timeshift_writer.c | 1 - 6 files changed, 6 deletions(-) diff --git a/src/dvb/dvb_input_raw.c b/src/dvb/dvb_input_raw.c index 0c3f2a56..d414ba42 100644 --- a/src/dvb/dvb_input_raw.c +++ b/src/dvb/dvb_input_raw.c @@ -28,7 +28,6 @@ #include #include #include -#include #include "tvheadend.h" #include "dvb.h" diff --git a/src/dvb/dvb_tables.c b/src/dvb/dvb_tables.c index 037fbbbb..937583f1 100644 --- a/src/dvb/dvb_tables.c +++ b/src/dvb/dvb_tables.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/src/timeshift.c b/src/timeshift.c index de3766e9..3a4063d7 100644 --- a/src/timeshift.c +++ b/src/timeshift.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/src/timeshift/timeshift_filemgr.c b/src/timeshift/timeshift_filemgr.c index c7debb9b..cd58d33f 100644 --- a/src/timeshift/timeshift_filemgr.c +++ b/src/timeshift/timeshift_filemgr.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index f2a3b6bc..e9b3ca53 100644 --- a/src/timeshift/timeshift_reader.c +++ b/src/timeshift/timeshift_reader.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/src/timeshift/timeshift_writer.c b/src/timeshift/timeshift_writer.c index 0e2f50ae..e3ecc22c 100644 --- a/src/timeshift/timeshift_writer.c +++ b/src/timeshift/timeshift_writer.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include From 10abaf885306783198ae9244f778e90864413c33 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:20:29 +0200 Subject: [PATCH 16/36] Add missing include for accept(2) on FreeBSD. tvheadend-3.4/src/epggrab/module.c: In function '_epggrab_socket_thread': tvheadend-3.4/src/epggrab/module.c:357: warning: implicit declaration of function 'accept' tvheadend-3.4/src/epggrab/module.c: In function 'epggrab_module_enable_socket': tvheadend-3.4/src/epggrab/module.c:382: warning: implicit declaration of function 'shutdown' tvheadend-3.4/src/epggrab/module.c:382: error: 'SHUT_RDWR' undeclared (first use in this function) tvheadend-3.4/src/epggrab/module.c:382: error: (Each undeclared identifier is reported only once tvheadend-3.4/src/epggrab/module.c:382: error: for each function it appears in.) tvheadend-3.4/src/epggrab/module.c:392: warning: implicit declaration of function 'socket' tvheadend-3.4/src/epggrab/module.c:392: error: 'AF_UNIX' undeclared (first use in this function) tvheadend-3.4/src/epggrab/module.c:392: error: 'SOCK_STREAM' undeclared (first use in this function) tvheadend-3.4/src/epggrab/module.c:398: warning: implicit declaration of function 'bind' tvheadend-3.4/src/epggrab/module.c:406: warning: implicit declaration of function 'listen' --- src/epggrab/module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/epggrab/module.c b/src/epggrab/module.c index b920eea1..44a39138 100644 --- a/src/epggrab/module.c +++ b/src/epggrab/module.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "tvheadend.h" From 112c26433688a30a9245a4242956514d7a64cbd9 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:22:18 +0200 Subject: [PATCH 17/36] Add missing include for FreeBSD which has AF_INET6 defined in sys/socket.h --- src/htsp_server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/htsp_server.c b/src/htsp_server.c index 77dbb6c0..a4da3279 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "tvheadend.h" #include "channels.h" From bf1c6ac55ad12e6f1fbb9d0b399d89f6245d1d54 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:24:04 +0200 Subject: [PATCH 18/36] Read timezone from gettimeofday() to not have to rely on an globally set timezone variable. --- src/htsp_server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/htsp_server.c b/src/htsp_server.c index a4da3279..0261e5d4 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -845,13 +845,14 @@ htsp_method_getSysTime(htsp_connection_t *htsp, htsmsg_t *in) { htsmsg_t *out; struct timeval tv; + struct timezone tz; - if(gettimeofday(&tv, NULL) == -1) + if(gettimeofday(&tv, &tz) == -1) return htsp_error("Unable to get system time"); out = htsmsg_create_map(); htsmsg_add_s32(out, "time", tv.tv_sec); - htsmsg_add_s32(out, "timezone", timezone / 60); + htsmsg_add_s32(out, "timezone", tz.tz_minuteswest / 60); return out; } From 45e1ca3b7e5ab781bbb4082e6d5eb6c2e5549679 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:25:59 +0200 Subject: [PATCH 19/36] Add missing include for "struct iovec" which is defined in sys/uio.h on FreeBSD and also on Linux. tvheadend-3.4/src/muxer/tvh/mkmux.c: In function 'mk_write_to_fd': tvheadend-3.4/src/muxer/tvh/mkmux.c:347: error: invalid application of 'sizeof' to incomplete type 'struct iovec' tvheadend-3.4/src/muxer/tvh/mkmux.c:351: error: invalid use of undefined type 'struct iovec' tvheadend-3.4/src/muxer/tvh/mkmux.c:351: error: dereferencing pointer to incomplete type tvheadend-3.4/src/muxer/tvh/mkmux.c:352: error: invalid use of undefined type 'struct iovec' tvheadend-3.4/src/muxer/tvh/mkmux.c:352: error: dereferencing pointer to incomplete type cc1: warnings being treated as errors tvheadend-3.4/src/muxer/tvh/mkmux.c:358: warning: implicit declaration of function 'writev' tvheadend-3.4/src/muxer/tvh/mkmux.c:364: error: invalid use of undefined type 'struct iovec' --- src/muxer/tvh/mkmux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/muxer/tvh/mkmux.c b/src/muxer/tvh/mkmux.c index 19880a38..947fa9f1 100644 --- a/src/muxer/tvh/mkmux.c +++ b/src/muxer/tvh/mkmux.c @@ -19,6 +19,7 @@ #include +#include #include #include #include From 38d9f2ec396eabccdcaa7d20d26e24283a02fa5f Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:30:19 +0200 Subject: [PATCH 20/36] Add missing include for FreeBSD which has AF_INET defined in sys/socket.h tvheadend-3.4/src/webui/comet.c: In function 'comet_serverIpPort': tvheadend-3.4/src/webui/comet.c:162: error: 'AF_INET' undeclared (first use in this function) tvheadend-3.4/src/webui/comet.c:162: error: (Each undeclared identifier is reported only once tvheadend-3.4/src/webui/comet.c:162: error: for each function it appears in.) tvheadend-3.4/src/webui/comet.c:164: error: 'AF_INET6' undeclared (first use in this function) --- src/webui/comet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webui/comet.c b/src/webui/comet.c index aaf42ae0..aee51b78 100644 --- a/src/webui/comet.c +++ b/src/webui/comet.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "htsmsg.h" From 3158494a5eab3259acaaec742ef45fc892b08dd1 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:32:57 +0200 Subject: [PATCH 21/36] Add missing include for FreeBSD which has AF_INET and AF_INET6 defined in sys/socket.h tvheadend-3.4/src/webui/extjs.c: In function 'service_update_iptv': tvheadend-3.4/src/webui/extjs.c:1748: error: 'AF_INET' undeclared (first use in this function) tvheadend-3.4/src/webui/extjs.c:1748: error: (Each undeclared identifier is reported only once tvheadend-3.4/src/webui/extjs.c:1748: error: for each function it appears in.) tvheadend-3.4/src/webui/extjs.c:1749: error: 'AF_INET6' undeclared (first use in this function) tvheadend-3.4/src/webui/extjs.c: In function 'build_record_iptv': tvheadend-3.4/src/webui/extjs.c:1776: error: 'AF_INET' undeclared (first use in this function) tvheadend-3.4/src/webui/extjs.c:1780: error: 'AF_INET6' undeclared (first use in this function) --- src/webui/extjs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webui/extjs.c b/src/webui/extjs.c index dd2b07d1..9478725d 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -23,6 +23,7 @@ #include #include #include +#include #include From 252a15f7285cdce689ba4ce8895ffec505418601 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:57:29 +0200 Subject: [PATCH 22/36] Dumping NGREG in traphandler only if it is supported by the platform. --- src/trap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/trap.c b/src/trap.c index b0fe543b..7a731d30 100644 --- a/src/trap.c +++ b/src/trap.c @@ -134,14 +134,18 @@ add2lineresolve(const char *binary, void *addr, char *buf0, size_t buflen) static void traphandler(int sig, siginfo_t *si, void *UC) { +#ifdef NGREG ucontext_t *uc = UC; +#endif #if ENABLE_EXECINFO char buf[200]; static void *frames[MAXFRAMES]; int nframes = backtrace(frames, MAXFRAMES); Dl_info dli; #endif +#if defined(NGREG) || defined(ENABLE_EXECINFO) int i; +#endif const char *reason = NULL; tvhlog_spawn(LOG_ALERT, "CRASH", "Signal: %d in %s ", sig, line1); @@ -165,6 +169,7 @@ traphandler(int sig, siginfo_t *si, void *UC) si->si_addr, reason ?: "N/A"); tvhlog_spawn(LOG_ALERT, "CRASH", "Loaded libraries: %s ", libs); +#ifdef NGREG snprintf(tmpbuf, sizeof(tmpbuf), "Register dump [%d]: ", NGREG); for(i = 0; i < NGREG; i++) { @@ -174,6 +179,7 @@ traphandler(int sig, siginfo_t *si, void *UC) sappend(tmpbuf, sizeof(tmpbuf), "%08x ", uc->uc_mcontext.gregs[i]); #endif } +#endif tvhlog_spawn(LOG_ALERT, "CRASH", "%s", tmpbuf); #if ENABLE_EXECINFO From 0fdc4fc19373b6a7c19f89ca37fbca32d1be78a4 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 14:59:52 +0200 Subject: [PATCH 23/36] stime(2) is only available on Linux so make it optional. --- src/tvhtime.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tvhtime.c b/src/tvhtime.c index e19d6c8d..589840af 100644 --- a/src/tvhtime.c +++ b/src/tvhtime.c @@ -99,7 +99,11 @@ tvhtime_update ( struct tm *tm ) if (tvhtime_update_enabled) { if (llabs(t2 - t1) > tvhtime_tolerance) { tvhlog(LOG_DEBUG, "time", "updated system clock"); +#ifdef stime stime(&now); +#else + tvhlog(LOG_NOTICE, "time", "stime(2) not implemented"); +#endif } } From f24ea24b26bc702a052eb24765f7adbbd55815ee Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 15:08:14 +0200 Subject: [PATCH 24/36] Add sendfile(2) support for FreeBSD. --- src/webui/webui.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index 997b8829..6cfd6993 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -29,7 +29,6 @@ #include #include -#include #include "tvheadend.h" #include "access.h" @@ -48,6 +47,14 @@ #include "imagecache.h" #include "tcp.h" +#if defined(PLATFORM_LINUX) +#include +#elif defined(PLATFORM_FREEBSD) +#include +#include +#include +#endif + /** * */ @@ -931,7 +938,11 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) if(!hc->hc_no_output) { while(content_len > 0) { chunk = MIN(1024 * 1024 * 1024, content_len); +#if defined(PLATFORM_LINUX) r = sendfile(hc->hc_fd, fd, NULL, chunk); +#elif defined(PLATFORM_FREEBSD) + sendfile(fd, hc->hc_fd, 0, chunk, NULL, &r, 0); +#endif if(r == -1) { close(fd); return -1; From 0ac56f0be8c69f0cf460e7e96c711d9b82a6eaeb Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 15:10:04 +0200 Subject: [PATCH 25/36] Use internal tvh_strdupa() because strdupa() is GNU only. --- src/webui/webui.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index 6cfd6993..eb0ff965 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -647,7 +647,7 @@ http_stream_service(http_connection_t *hc, service_t *service) hc->hc_username, http_arg_get(&hc->hc_args, "User-Agent")); if(s) { - name = strdupa(service->s_ch ? + name = tvh_strdupa(service->s_ch ? service->s_ch->ch_name : service->s_nicename); pthread_mutex_unlock(&global_lock); http_stream_run(hc, &sq, name, mc); @@ -685,7 +685,7 @@ http_stream_tdmi(http_connection_t *hc, th_dvb_mux_instance_t *tdmi) addrbuf, hc->hc_username, http_arg_get(&hc->hc_args, "User-Agent")); - name = strdupa(tdmi->tdmi_identifier); + name = tvh_strdupa(tdmi->tdmi_identifier); pthread_mutex_unlock(&global_lock); http_stream_run(hc, &sq, name, MC_RAW); pthread_mutex_lock(&global_lock); @@ -761,7 +761,7 @@ http_stream_channel(http_connection_t *hc, channel_t *ch) http_arg_get(&hc->hc_args, "User-Agent")); if(s) { - name = strdupa(ch->ch_name); + name = tvh_strdupa(ch->ch_name); pthread_mutex_unlock(&global_lock); http_stream_run(hc, &sq, name, mc); pthread_mutex_lock(&global_lock); From 2d6c12222c39495b79b0dfe80125cdd157ee99f9 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 15:30:48 +0200 Subject: [PATCH 26/36] __u8 is not available on FreeBSD so use u_int8_t instead tvheadend-3.4/src/dvb/diseqc.h:10: error: expected declaration specifiers or '...' before '__u8' tvheadend-3.4/src/dvb/diseqc.h:11: error: expected declaration specifiers or '...' before '__u8' --- src/dvb/diseqc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dvb/diseqc.h b/src/dvb/diseqc.h index 852a7948..a0d443aa 100644 --- a/src/dvb/diseqc.h +++ b/src/dvb/diseqc.h @@ -4,6 +4,10 @@ #include #include +#if defined(PLATFORM_FREEBSD) +#define __u8 u_int8_t +#endif + /** * set up the switch to position/voltage/tone */ From cf74b5f1c9efaedd19bbb17d94f87717d45272e5 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 16:34:03 +0200 Subject: [PATCH 27/36] Fix IPv4 multicasting on FreeBSD and make IPv6 multicasting optional because it's not yet supported on FreeBSD. --- src/iptv_input.c | 78 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/src/iptv_input.c b/src/iptv_input.c index 6c39a866..7ca96f6d 100644 --- a/src/iptv_input.c +++ b/src/iptv_input.c @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include "tvheadend.h" #include "htsmsg.h" @@ -41,6 +41,17 @@ #include "psi.h" #include "settings.h" +#if defined(PLATFORM_LINUX) +#include +#elif defined(PLATFORM_FREEBSD) +# include +# include +# ifndef IPV6_ADD_MEMBERSHIP +# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +# endif +#endif + static int iptv_thread_running; static int iptv_epollfd; static pthread_mutex_t iptv_recvmutex; @@ -202,6 +213,7 @@ iptv_service_start(service_t *t, unsigned int weight, int force_start) { pthread_t tid; int fd; + int solip; char straddr[INET6_ADDRSTRLEN]; struct ip_mreqn m; struct ipv6_mreq m6; @@ -260,9 +272,23 @@ iptv_service_start(service_t *t, unsigned int weight, int force_start) memset(&m, 0, sizeof(m)); m.imr_multiaddr.s_addr = t->s_iptv_group.s_addr; m.imr_address.s_addr = 0; +#if defined(PLATFORM_LINUX) m.imr_ifindex = ifr.ifr_ifindex; +#elif defined(PLATFORM_FREEBSD) + m.imr_ifindex = ifr.ifr_index; +#endif - if(setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, &m, +#ifdef SOL_IP + solip = SOL_IP; +#else + { + struct protoent *pent; + pent = getprotobyname("ip"); + solip = (pent != NULL) ? pent->p_proto : 0; + } +#endif + + if(setsockopt(fd, solip, IP_ADD_MEMBERSHIP, &m, sizeof(struct ip_mreqn)) == -1) { tvhlog(LOG_ERR, "IPTV", "\"%s\" cannot join %s -- %s", t->s_identifier, inet_ntoa(m.imr_multiaddr), strerror(errno)); @@ -287,8 +313,13 @@ iptv_service_start(service_t *t, unsigned int weight, int force_start) /* Join IPv6 group */ memset(&m6, 0, sizeof(m6)); m6.ipv6mr_multiaddr = t->s_iptv_group6; +#if defined(PLATFORM_LINUX) m6.ipv6mr_interface = ifr.ifr_ifindex; +#elif defined(PLATFORM_FREEBSD) + m6.ipv6mr_interface = ifr.ifr_index; +#endif +#ifdef SOL_IPV6 if(setsockopt(fd, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &m6, sizeof(struct ipv6_mreq)) == -1) { inet_ntop(AF_INET6, m6.ipv6mr_multiaddr.s6_addr, @@ -298,6 +329,12 @@ iptv_service_start(service_t *t, unsigned int weight, int force_start) close(fd); return -1; } +#else + tvhlog(LOG_ERR, "IPTV", "IPv6 multicast not supported on your platform"); + + close(fd); + return -1; +#endif } @@ -342,6 +379,7 @@ iptv_service_refresh(service_t *t) static void iptv_service_stop(service_t *t) { + int solip; struct ifreq ifr; pthread_mutex_lock(&iptv_recvmutex); @@ -366,33 +404,51 @@ iptv_service_stop(service_t *t) /* Leave multicast group */ m.imr_multiaddr.s_addr = t->s_iptv_group.s_addr; m.imr_address.s_addr = 0; +#if defined(PLATFORM_LINUX) m.imr_ifindex = ifr.ifr_ifindex; - - if(setsockopt(t->s_iptv_fd, SOL_IP, IP_DROP_MEMBERSHIP, &m, +#elif defined(PLATFORM_FREEBSD) + m.imr_ifindex = ifr.ifr_index; +#endif + +#ifdef SOL_IP + solip = SOL_IP; +#else + { + struct protoent *pent; + pent = getprotobyname("ip"); + solip = (pent != NULL) ? pent->p_proto : 0; + } +#endif + + if(setsockopt(t->s_iptv_fd, solip, IP_DROP_MEMBERSHIP, &m, sizeof(struct ip_mreqn)) == -1) { tvhlog(LOG_ERR, "IPTV", "\"%s\" cannot leave %s -- %s", t->s_identifier, inet_ntoa(m.imr_multiaddr), strerror(errno)); } } else { - char straddr[INET6_ADDRSTRLEN]; - struct ipv6_mreq m6; memset(&m6, 0, sizeof(m6)); m6.ipv6mr_multiaddr = t->s_iptv_group6; +#if defined(PLATFORM_LINUX) m6.ipv6mr_interface = ifr.ifr_ifindex; +#elif defined(PLATFORM_FREEBSD) + m6.ipv6mr_interface = ifr.ifr_index; +#endif +#ifdef SOL_IPV6 if(setsockopt(t->s_iptv_fd, SOL_IPV6, IPV6_DROP_MEMBERSHIP, &m6, sizeof(struct ipv6_mreq)) == -1) { + char straddr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, m6.ipv6mr_multiaddr.s6_addr, straddr, sizeof(straddr)); tvhlog(LOG_ERR, "IPTV", "\"%s\" cannot leave %s -- %s", t->s_identifier, straddr, strerror(errno)); } - - - +#else + tvhlog(LOG_ERR, "IPTV", "IPv6 multicast not supported on your platform"); +#endif } close(t->s_iptv_fd); // Automatically removes fd from epoll set @@ -408,7 +464,9 @@ iptv_service_save(service_t *t) { htsmsg_t *m = htsmsg_create_map(); char abuf[INET_ADDRSTRLEN]; +#ifdef SOL_IPV6 char abuf6[INET6_ADDRSTRLEN]; +#endif lock_assert(&global_lock); @@ -427,10 +485,12 @@ iptv_service_save(service_t *t) inet_ntop(AF_INET, &t->s_iptv_group, abuf, sizeof(abuf)); htsmsg_add_str(m, "group", abuf); } +#ifdef SOL_IPV6 if(IN6_IS_ADDR_MULTICAST(t->s_iptv_group6.s6_addr) ) { inet_ntop(AF_INET6, &t->s_iptv_group6, abuf6, sizeof(abuf6)); htsmsg_add_str(m, "group", abuf6); } +#endif if(t->s_ch != NULL) { htsmsg_add_str(m, "channelname", t->s_ch->ch_name); htsmsg_add_u32(m, "mapped", 1); From 04199db013725683b2c8ef9f11e7572bc4eef61e Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 13:56:24 +0200 Subject: [PATCH 28/36] Add kqueue option and allow to disable epoll. --- configure | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure b/configure index 6e4577fb..d7f5ec0e 100755 --- a/configure +++ b/configure @@ -29,6 +29,8 @@ OPTIONS=( "inotify:auto" "bundle:no" "dvbcsa:no" + "epoll:yes" + "kqueue:no" ) # @@ -196,6 +198,20 @@ if enabled linuxdvb && enabled dvbscan; then echo "ok" fi +# +# epoll +# +if [ ${PLATFORM} != "linux" ]; then + disable epoll +fi + +# +# kqueue +# +if [ ${PLATFORM} = "freebsd" ]; then + enable kqueue +fi + # ########################################################################### # Write config # ########################################################################### From f22d3e0fb2bbcd079a193d7248cbb0e4423c6925 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sun, 5 May 2013 14:49:47 +0200 Subject: [PATCH 29/36] Add missing include for ssize_t on FreeBSD. src/tvhlog.h:48: error: expected declaration specifiers or '...' before 'ssize_t' src/tvhlog.c:244: error: conflicting types for '_tvhlog_hexdump' src/tvhlog.h:48: error: previous declaration of '_tvhlog_hexdump' was here --- src/tvhlog.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tvhlog.h b/src/tvhlog.h index cc4b3011..f657df24 100644 --- a/src/tvhlog.h +++ b/src/tvhlog.h @@ -18,6 +18,7 @@ #ifndef __TVH_LOGGING_H__ #define __TVH_LOGGING_H__ +#include #include #include #include From d137cc0073a96054448a0efee7b8e4302503b62e Mon Sep 17 00:00:00 2001 From: User Decke Date: Mon, 6 May 2013 13:05:58 +0200 Subject: [PATCH 30/36] Fix sendfile() call on FreeBSD/i386 src/webui/webui.c:885: warning: passing argument 6 of 'sendfile' from incompatible pointer type --- src/webui/webui.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/webui/webui.c b/src/webui/webui.c index eb0ff965..8628fe6b 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -857,7 +857,11 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) char range_buf[255]; char disposition[256]; off_t content_len, file_start, file_end, chunk; +#if defined(PLATFORM_LINUX) ssize_t r; +#elif defined(PLATFORM_FREEBSD) + off_t r; +#endif if(remain == NULL) return 404; From 138e73eb26f7174ec610c6e3355bced4f00474bb Mon Sep 17 00:00:00 2001 From: User Decke Date: Mon, 6 May 2013 15:57:14 +0200 Subject: [PATCH 31/36] Fix printf format modifier to build properly with CLANG. src/htsp_server.c:485:55: error: format specifies type 'short' but the argument has type 'int' [-Werror,-Wformat] p += snprintf(url+p, sizeof(url)-p, "%s%s%s:%hd%s", ~~^ %d --- src/htsp_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/htsp_server.c b/src/htsp_server.c index 0261e5d4..1931fb83 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -527,7 +527,7 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp) tcp_get_ip_str((struct sockaddr*)&addr, buf, 50); strcpy(url, "http://"); p = strlen(url); - p += snprintf(url+p, sizeof(url)-p, "%s%s%s:%hd%s", + p += snprintf(url+p, sizeof(url)-p, "%s%s%s:%d%s", (addr.ss_family == AF_INET6)?"[":"", buf, (addr.ss_family == AF_INET6)?"]":"", From 9a0d477acd645976d50aa5df5d6e77aecb78b024 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Fri, 24 May 2013 21:34:53 +0200 Subject: [PATCH 32/36] Fix warning because of wrong time_t format specifier on FreeBSD i386 and fix places where format specifier is hardcoded for time_t and correctly use PRItime_t instead. src/epg.c:1412: warning: format '%ld' expects type 'long int', but argument 7 has type 'time_t' src/dvr/dvr_rec.c:596: warning: format '%ld' expects type 'long int', but argument 4 has type 'time_t' src/epggrab/module/eit.c:536: warning: format '%lu' expects type 'long unsigned int', but argument 8 has type 'time_t' --- src/dvr/dvr_rec.c | 4 ++-- src/epggrab/module/eit.c | 2 +- src/tvheadend.h | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dvr/dvr_rec.c b/src/dvr/dvr_rec.c index c48eafff..c5726b01 100644 --- a/src/dvr/dvr_rec.c +++ b/src/dvr/dvr_rec.c @@ -593,8 +593,8 @@ dvr_spawn_postproc(dvr_entry_t *de, const char *dvr_postproc) } fbasename = strdup(de->de_filename); - snprintf(start, sizeof(start), "%ld", de->de_start - de->de_start_extra); - snprintf(stop, sizeof(stop), "%ld", de->de_stop + de->de_stop_extra); + snprintf(start, sizeof(start), "%"PRItime_t, de->de_start - de->de_start_extra); + snprintf(stop, sizeof(stop), "%"PRItime_t, de->de_stop + de->de_stop_extra); memset(fmap, 0, sizeof(fmap)); fmap['f'] = de->de_filename; /* full path to recoding */ diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index c20c32d5..c2e54610 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -533,7 +533,7 @@ static int _eit_process_event /* Find broadcast */ ebc = epg_broadcast_find_by_time(svc->s_ch, start, stop, eid, 1, &save2); - tvhtrace("eit", "eid=%5d, start=%lu, stop=%lu, ebc=%p", + tvhtrace("eit", "eid=%5d, start=%"PRItime_t", stop=%"PRItime_t", ebc=%p", eid, start, stop, ebc); if (!ebc) return dllen + 12; diff --git a/src/tvheadend.h b/src/tvheadend.h index 4bc951dc..9586a063 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -561,7 +561,11 @@ char *regexp_escape ( const char *str ); #define PRIulongword_t "lu" #define PRIsize_t PRIuword_t #define PRIssize_t PRIsword_t +#if __WORDSIZE == 32 && defined(PLATFORM_FREEBSD) +#define PRItime_t PRIsword_t +#else #define PRItime_t PRIslongword_t +#endif #if _FILE_OFFSET_BITS == 64 #define PRIoff_t PRId64 #else From ee5d2171d52de9b3d16efabb3f504bb401e313ae Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Wed, 29 May 2013 23:39:42 +0100 Subject: [PATCH 33/36] tvhpoll: new epoll/kqueue wrapper API This is to ease some of the BSD porting work that has been done and keep the core code cleaner. Credit to Bernhard Froehlich , for the original kqueue code that was #if'd inline with epoll code (now hidden as a result of tidying up commits). --- Makefile | 3 +- src/tvhpoll.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/tvhpoll.h | 47 +++++++++++++ 3 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 src/tvhpoll.c create mode 100644 src/tvhpoll.h diff --git a/Makefile b/Makefile index b3a6a7ae..1ae7e9ef 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,8 @@ SRCS = src/version.c \ src/lang_codes.c \ src/lang_str.c \ src/imagecache.c \ - src/tvhtime.c + src/tvhtime.c \ + src/tvhpoll.c SRCS += src/epggrab/module.c\ src/epggrab/channel.c\ diff --git a/src/tvhpoll.c b/src/tvhpoll.c new file mode 100644 index 00000000..6b7e92df --- /dev/null +++ b/src/tvhpoll.c @@ -0,0 +1,181 @@ +/* + * TVheadend - poll/select wrapper + * + * Copyright (C) 2013 Adam Sutton + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#define ENABLE_EPOLL 1 + +#include "tvheadend.h" +#include "tvhpoll.h" + +#include +#include +#include +#include +#include +#if ENABLE_EPOLL +#include +#elif ENABLE_KQUEUE +#include +#include +#endif + +#if ENABLE_EPOLL +#define EV_SIZE sizeof(struct epoll_event) +#elif ENABLE_KQUEUE +#define EV_SIZE sizeof(struct kevent) +#endif + +struct tvhpoll +{ +#if ENABLE_EPOLL + int fd; + struct epoll_event *ev; + int nev; +#elif ENABLE_KQUEUE + int fd; + struct kevent *ev; + int nev; +#else +#endif +}; + +static void +tvhpoll_alloc ( tvhpoll_t *tp, int n ) +{ +#if ENABLE_EPOLL || ENABLE_KQUEUE + if (n > tp->nev) { + tp->ev = realloc(tp->ev, n * EV_SIZE); + tp->nev = n; + } +#else +#endif +} + +tvhpoll_t * +tvhpoll_create ( size_t n ) +{ + int fd; +#if ENABLE_EPOLL + if ((fd = epoll_create(n)) < 0) { + tvhlog(LOG_ERR, "tvhpoll", "failed to create epoll [%s]", + strerror(errno)); + return NULL; + } +#elif ENABLE_KQUEUE + if ((fd = kqueue()) < 0) { + tvhlog(LOG_ERR, "tvhpoll", "failed to create kqueue [%s]", + strerror(errno)); + return NULL; + } +#else +#endif + tvhpoll_t *tp = calloc(1, sizeof(tvhpoll_t)); + tp->fd = fd; + tvhpoll_alloc(tp, n); + return tp; +} + +void tvhpoll_destroy ( tvhpoll_t *tp ) +{ +#if ENABLE_EPOLL || ENABLE_KQUEUE + free(tp->ev); + close(tp->fd); +#endif + free(tp); +} + +int tvhpoll_add + ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num ) +{ +#if ENABLE_EPOLL + int i; + struct epoll_event ev; + for (i = 0; i < num; i++) { + memset(&ev, 0, sizeof(ev)); + ev.data.fd = evs[i].fd; + if (evs[i].events & TVHPOLL_IN) ev.events |= EPOLLIN; + if (evs[i].events & TVHPOLL_OUT) ev.events |= EPOLLOUT; + if (evs[i].events & TVHPOLL_PRI) ev.events |= EPOLLPRI; + if (evs[i].events & TVHPOLL_ERR) ev.events |= EPOLLERR; + epoll_ctl(tp->fd, EPOLL_CTL_ADD, evs[i].fd, &ev); + } +#elif ENABLE_KQUEUE + int i; + uint32_t fflags; + tvhpoll_alloc(tp, num); + for (i = 0; i < num; i++) { + if (evs[i] & TVHPOLL_OUT) fflags |= EVFILT_WRITE; + if (evs[i] & TVHPOLL_IN) fflags |= EVFILT_READ; + EV_SET(tp->ev+i, evs[i].fd, fflags, EV_ADD, 0, 0, NULL); + } + kevent(tp->fd, tp->ev, num, NULL, 0, NULL); +#else +#endif + return 0; +} + +int tvhpoll_rem + ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num ) +{ + tvhpoll_alloc(tp, num); +#if ENABLE_EPOLL + int i; + for (i = 0; i < num; i++) + epoll_ctl(tp->fd, EPOLL_CTL_DEL, evs[i].fd, NULL); +#elif ENABLE_KQUEUE + int i; + for (i = 0; i < num; i++) + EV_SET(tp->ev+i, evs[i].fd, 0, EV_DEL, 0, 0, NULL); + kevent(tp->fd, tp->ev, num, NULL, 0, NULL); +#else +#endif + return 0; +} + +int tvhpoll_wait + ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num, int ms ) +{ + int nfds = 0, i; + tvhpoll_alloc(tp, num); +#if ENABLE_EPOLL + nfds = epoll_wait(tp->fd, tp->ev, num, ms); + for (i = 0; i < nfds; i++) { + evs[i].fd = tp->ev[i].data.fd; + evs[i].events = 0; + if (tp->ev[i].events & EPOLLIN) evs[i].events |= TVHPOLL_IN; + if (tp->ev[i].events & EPOLLOUT) evs[i].events |= TVHPOLL_OUT; + if (tp->ev[i].events & EPOLLERR) evs[i].events |= TVHPOLL_ERR; + if (tp->ev[i].events & EPOLLPRI) evs[i].events |= TVHPOLL_PRI; + } +#elif ENABLE_KQUEUE + struct timespec tm, *to = NULL; + if (ms) { + tm.tv_sec = ms / 1000; + tm.tv_nsec = (ms % 1000) * 1000000LL; + to = &tm; + } + nfds = kevent(tp->fd, NULL, 0, tp->ev, num, to); + for (i = 0; i < nfds; i++) { + evs[i].fd = tp->ev[i].ident; + evs[i].events = 0; + if (tp->ev[i].ffilt & EVFILT_WRITE) evs[i].events |= TVHPOLL_OUT; + if (tp->ev[i].ffilt & EVFILT_READ) evs[i].events |= TVHPOLL_IN; + } +#else +#endif + return nfds; +} diff --git a/src/tvhpoll.h b/src/tvhpoll.h new file mode 100644 index 00000000..afdbfbc9 --- /dev/null +++ b/src/tvhpoll.h @@ -0,0 +1,47 @@ + +/* + * TVheadend - poll/select wrapper + * + * Copyright (C) 2013 Adam Sutton + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __TVH_POLL_H__ +#define __TVH_POLL_H_ + +#include + +typedef struct tvhpoll tvhpoll_t; +typedef struct tvhpoll_event +{ + int fd; + int events; +} tvhpoll_event_t; + +#define TVHPOLL_IN 0x01 +#define TVHPOLL_OUT 0x02 +#define TVHPOLL_PRI 0x04 +#define TVHPOLL_ERR 0x08 + +tvhpoll_t *tvhpoll_create ( size_t num ); +void tvhpoll_destroy ( tvhpoll_t *tp ); +int tvhpoll_add + ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num ); +int tvhpoll_rem + ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num ); +int tvhpoll_wait + ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num, int ms ); + +#endif /* __TVH_POLL_H__ */ From a2ef8e9c94d445aa50c1848ca6ad2be3f3a62120 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Fri, 31 May 2013 11:48:40 +0200 Subject: [PATCH 34/36] tvhpoll: Fix kqueue parts of the poll wrapper API --- src/tvhpoll.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tvhpoll.c b/src/tvhpoll.c index 6b7e92df..cd985222 100644 --- a/src/tvhpoll.c +++ b/src/tvhpoll.c @@ -16,7 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#define ENABLE_EPOLL 1 #include "tvheadend.h" #include "tvhpoll.h" @@ -29,6 +28,7 @@ #if ENABLE_EPOLL #include #elif ENABLE_KQUEUE +#include #include #include #endif @@ -118,8 +118,9 @@ int tvhpoll_add uint32_t fflags; tvhpoll_alloc(tp, num); for (i = 0; i < num; i++) { - if (evs[i] & TVHPOLL_OUT) fflags |= EVFILT_WRITE; - if (evs[i] & TVHPOLL_IN) fflags |= EVFILT_READ; + fflags = 0; + if (evs[i].events & TVHPOLL_OUT) fflags |= EVFILT_WRITE; + if (evs[i].events & TVHPOLL_IN) fflags |= EVFILT_READ; EV_SET(tp->ev+i, evs[i].fd, fflags, EV_ADD, 0, 0, NULL); } kevent(tp->fd, tp->ev, num, NULL, 0, NULL); @@ -139,7 +140,7 @@ int tvhpoll_rem #elif ENABLE_KQUEUE int i; for (i = 0; i < num; i++) - EV_SET(tp->ev+i, evs[i].fd, 0, EV_DEL, 0, 0, NULL); + EV_SET(tp->ev+i, evs[i].fd, 0, EV_DELETE, 0, 0, NULL); kevent(tp->fd, tp->ev, num, NULL, 0, NULL); #else #endif @@ -172,8 +173,8 @@ int tvhpoll_wait for (i = 0; i < nfds; i++) { evs[i].fd = tp->ev[i].ident; evs[i].events = 0; - if (tp->ev[i].ffilt & EVFILT_WRITE) evs[i].events |= TVHPOLL_OUT; - if (tp->ev[i].ffilt & EVFILT_READ) evs[i].events |= TVHPOLL_IN; + if (tp->ev[i].fflags & EVFILT_WRITE) evs[i].events |= TVHPOLL_OUT; + if (tp->ev[i].fflags & EVFILT_READ) evs[i].events |= TVHPOLL_IN; } #else #endif From 7d122d8dea0bab3b6ee2c8eca1e94c85ed1e4fce Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Fri, 31 May 2013 14:10:28 +0100 Subject: [PATCH 35/36] tvhpoll: corrected some mistakes and expanded usage for user data. --- src/tvhpoll.c | 23 ++++++++++++++--------- src/tvhpoll.h | 17 ++++++++++++----- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/tvhpoll.c b/src/tvhpoll.c index cd985222..f40cfa8a 100644 --- a/src/tvhpoll.c +++ b/src/tvhpoll.c @@ -106,13 +106,16 @@ int tvhpoll_add struct epoll_event ev; for (i = 0; i < num; i++) { memset(&ev, 0, sizeof(ev)); - ev.data.fd = evs[i].fd; + ev.data.u64 = evs[i].data.u64; if (evs[i].events & TVHPOLL_IN) ev.events |= EPOLLIN; if (evs[i].events & TVHPOLL_OUT) ev.events |= EPOLLOUT; if (evs[i].events & TVHPOLL_PRI) ev.events |= EPOLLPRI; if (evs[i].events & TVHPOLL_ERR) ev.events |= EPOLLERR; - epoll_ctl(tp->fd, EPOLL_CTL_ADD, evs[i].fd, &ev); + if (evs[i].events & TVHPOLL_HUP) ev.events |= EPOLLHUP; + if (epoll_ctl(tp->fd, EPOLL_CTL_ADD, evs[i].fd, &ev) != 0) + return -1; } + return 0; #elif ENABLE_KQUEUE int i; uint32_t fflags; @@ -121,12 +124,11 @@ int tvhpoll_add fflags = 0; if (evs[i].events & TVHPOLL_OUT) fflags |= EVFILT_WRITE; if (evs[i].events & TVHPOLL_IN) fflags |= EVFILT_READ; - EV_SET(tp->ev+i, evs[i].fd, fflags, EV_ADD, 0, 0, NULL); + EV_SET(tp->ev+i, evs[i].fd, fflags, EV_ADD, 0, 0, evs[i].data.u64); } - kevent(tp->fd, tp->ev, num, NULL, 0, NULL); + return kevent(tp->fd, tp->ev, num, NULL, 0, NULL); #else #endif - return 0; } int tvhpoll_rem @@ -155,12 +157,13 @@ int tvhpoll_wait #if ENABLE_EPOLL nfds = epoll_wait(tp->fd, tp->ev, num, ms); for (i = 0; i < nfds; i++) { - evs[i].fd = tp->ev[i].data.fd; - evs[i].events = 0; + evs[i].data.u64 = tp->ev[i].data.u64; + evs[i].events = 0; if (tp->ev[i].events & EPOLLIN) evs[i].events |= TVHPOLL_IN; if (tp->ev[i].events & EPOLLOUT) evs[i].events |= TVHPOLL_OUT; if (tp->ev[i].events & EPOLLERR) evs[i].events |= TVHPOLL_ERR; if (tp->ev[i].events & EPOLLPRI) evs[i].events |= TVHPOLL_PRI; + if (tp->ev[i].events & EPOLLHUP) evs[i].events |= TVHPOLL_HUP; } #elif ENABLE_KQUEUE struct timespec tm, *to = NULL; @@ -171,10 +174,12 @@ int tvhpoll_wait } nfds = kevent(tp->fd, NULL, 0, tp->ev, num, to); for (i = 0; i < nfds; i++) { - evs[i].fd = tp->ev[i].ident; - evs[i].events = 0; + evs[i].fd = tp->ev[i].ident; + evs[i].events = 0; + evs[i].data.u64 = tp->ev[i].udata; if (tp->ev[i].fflags & EVFILT_WRITE) evs[i].events |= TVHPOLL_OUT; if (tp->ev[i].fflags & EVFILT_READ) evs[i].events |= TVHPOLL_IN; + if (tp->ev[i].flags & EV_EOF) evs[i].events |= TVHPOLL_HUP; } #else #endif diff --git a/src/tvhpoll.h b/src/tvhpoll.h index afdbfbc9..981b5c49 100644 --- a/src/tvhpoll.h +++ b/src/tvhpoll.h @@ -18,22 +18,29 @@ * along with this program. If not, see . */ -#ifndef __TVH_POLL_H__ -#define __TVH_POLL_H_ +#ifndef __TVHPOLL_H__ +#define __TVHPOLL_H__ #include typedef struct tvhpoll tvhpoll_t; typedef struct tvhpoll_event { - int fd; - int events; + int fd; // input + int events; + union { + void *ptr; + uint64_t u64; + uint32_t u32; + int fd; + } data; } tvhpoll_event_t; #define TVHPOLL_IN 0x01 #define TVHPOLL_OUT 0x02 #define TVHPOLL_PRI 0x04 #define TVHPOLL_ERR 0x08 +#define TVHPOLL_HUP 0x10 tvhpoll_t *tvhpoll_create ( size_t num ); void tvhpoll_destroy ( tvhpoll_t *tp ); @@ -44,4 +51,4 @@ int tvhpoll_rem int tvhpoll_wait ( tvhpoll_t *tp, tvhpoll_event_t *evs, size_t num, int ms ); -#endif /* __TVH_POLL_H__ */ +#endif /* __TVHPOLL_H__ */ From 17b16d7a76243ac07f980c0222abe2edd1e5699e Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 16:45:51 +0200 Subject: [PATCH 36/36] tvhpoll: update all code to use new tvhpoll wrapper rather than epoll --- src/dvb/dvb.h | 3 +- src/dvb/dvb_adapter.c | 29 +++++----- src/dvb/dvb_input_filtered.c | 98 ++++++++++++++++---------------- src/iptv_input.c | 20 ++++--- src/tcp.c | 96 +++++++++++++++---------------- src/timeshift/timeshift_reader.c | 20 ++++--- 6 files changed, 136 insertions(+), 130 deletions(-) diff --git a/src/dvb/dvb.h b/src/dvb/dvb.h index 127d676f..eb6d2b79 100644 --- a/src/dvb/dvb.h +++ b/src/dvb/dvb.h @@ -24,6 +24,7 @@ #include #include "htsmsg.h" #include "psi.h" +#include "tvhpoll.h" struct service; struct th_dvb_table; @@ -204,7 +205,7 @@ typedef struct th_dvb_adapter { th_dvb_mux_instance_t *tda_mux_epg; - int tda_table_epollfd; + tvhpoll_t *tda_table_pd; uint32_t tda_enabled; diff --git a/src/dvb/dvb_adapter.c b/src/dvb/dvb_adapter.c index 00a53704..93f06cdb 100644 --- a/src/dvb/dvb_adapter.c +++ b/src/dvb/dvb_adapter.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -48,6 +47,7 @@ #include "epggrab.h" #include "diseqc.h" #include "atomic.h" +#include "tvhpoll.h" struct th_dvb_adapter_queue dvb_adapters; struct th_dvb_mux_instance_tree dvb_muxes; @@ -1020,11 +1020,11 @@ static void * dvb_adapter_input_dvr(void *aux) { th_dvb_adapter_t *tda = aux; - int fd = -1, i, r, c, efd, nfds, dmx = -1; + int fd = -1, i, r, c, nfds, dmx = -1; uint8_t tsb[188 * 10]; service_t *t; - struct epoll_event ev; - int delay = 10; + tvhpoll_t *pd; + tvhpoll_event_t ev[2]; /* Install RAW demux */ if (tda->tda_rawmode) { @@ -1040,26 +1040,25 @@ dvb_adapter_input_dvr(void *aux) return NULL; } - /* Create poll */ - efd = epoll_create(2); - memset(&ev, 0, sizeof(ev)); - ev.events = EPOLLIN; - ev.data.fd = tda->tda_dvr_pipe.rd; - epoll_ctl(efd, EPOLL_CTL_ADD, tda->tda_dvr_pipe.rd, &ev); - ev.data.fd = fd; - epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ev); + pd = tvhpoll_create(2); + memset(ev, 0, sizeof(ev)); + ev[0].data.fd = ev[0].fd = tda->tda_dvr_pipe.rd; + ev[0].events = TVHPOLL_IN; + ev[1].data.fd = ev[1].fd = fd; + ev[1].events = TVHPOLL_IN; + tvhpoll_add(pd, ev, 2); r = i = 0; while(1) { /* Wait for input */ - nfds = epoll_wait(efd, &ev, 1, delay); + nfds = tvhpoll_wait(pd, ev, 1, -1); /* No data */ if (nfds < 1) continue; /* Exit */ - if (ev.data.fd != fd) break; + if (ev[0].data.fd != fd) break; /* Read data */ c = read(fd, tsb+r, sizeof(tsb)-r); @@ -1140,7 +1139,7 @@ dvb_adapter_input_dvr(void *aux) if(dmx != -1) close(dmx); - close(efd); + tvhpoll_destroy(pd); close(fd); return NULL; } diff --git a/src/dvb/dvb_input_filtered.c b/src/dvb/dvb_input_filtered.c index a4dddf26..0de91d07 100644 --- a/src/dvb/dvb_input_filtered.c +++ b/src/dvb/dvb_input_filtered.c @@ -27,11 +27,11 @@ #include #include #include -#include #include "tvheadend.h" #include "dvb.h" #include "service.h" +#include "tvhpoll.h" /** * Install filters for a service @@ -58,9 +58,9 @@ open_service(th_dvb_adapter_t *tda, service_t *s) if(fd == -1) { st->es_demuxer_fd = -1; tvhlog(LOG_ERR, "dvb", - "\"%s\" unable to open demuxer \"%s\" for pid %d -- %s", - s->s_identifier, tda->tda_demux_path, - st->es_pid, strerror(errno)); + "\"%s\" unable to open demuxer \"%s\" for pid %d -- %s", + s->s_identifier, tda->tda_demux_path, + st->es_pid, strerror(errno)); continue; } @@ -73,9 +73,9 @@ open_service(th_dvb_adapter_t *tda, service_t *s) if(ioctl(fd, DMX_SET_PES_FILTER, &dmx_param)) { tvhlog(LOG_ERR, "dvb", - "\"%s\" unable to configure demuxer \"%s\" for pid %d -- %s", - s->s_identifier, tda->tda_demux_path, - st->es_pid, strerror(errno)); + "\"%s\" unable to configure demuxer \"%s\" for pid %d -- %s", + s->s_identifier, tda->tda_demux_path, + st->es_pid, strerror(errno)); close(fd); fd = -1; } @@ -113,7 +113,7 @@ static void open_table(th_dvb_mux_instance_t *tdmi, th_dvb_table_t *tdt) { th_dvb_adapter_t *tda = tdmi->tdmi_adapter; - struct epoll_event e; + tvhpoll_event_t ev; static int tdt_id_tally; tdt->tdt_fd = tvh_open(tda->tda_demux_path, O_RDWR, 0); @@ -122,10 +122,11 @@ open_table(th_dvb_mux_instance_t *tdmi, th_dvb_table_t *tdt) tdt->tdt_id = ++tdt_id_tally; - e.events = EPOLLIN; - e.data.u64 = ((uint64_t)tdt->tdt_fd << 32) | tdt->tdt_id; + ev.fd = tdt->tdt_fd; + ev.events = TVHPOLL_IN; + ev.data.u64 = ((uint64_t)tdt->tdt_fd << 32) | tdt->tdt_id; - if(epoll_ctl(tda->tda_table_epollfd, EPOLL_CTL_ADD, tdt->tdt_fd, &e)) { + if(tvhpoll_add(tda->tda_table_pd, &ev, 1) != 0) { close(tdt->tdt_fd); tdt->tdt_fd = -1; } else { @@ -136,13 +137,13 @@ open_table(th_dvb_mux_instance_t *tdmi, th_dvb_table_t *tdt) fp.filter.mask[0] = tdt->tdt_mask; if(tdt->tdt_flags & TDT_CRC) - fp.flags |= DMX_CHECK_CRC; + fp.flags |= DMX_CHECK_CRC; fp.flags |= DMX_IMMEDIATE_START; fp.pid = tdt->tdt_pid; if(ioctl(tdt->tdt_fd, DMX_SET_FILTER, &fp)) { - close(tdt->tdt_fd); - tdt->tdt_fd = -1; + close(tdt->tdt_fd); + tdt->tdt_fd = -1; } } } @@ -159,10 +160,12 @@ static void tdt_close_fd(th_dvb_mux_instance_t *tdmi, th_dvb_table_t *tdt) { th_dvb_adapter_t *tda = tdmi->tdmi_adapter; + tvhpoll_event_t ev; assert(tdt->tdt_fd != -1); - epoll_ctl(tda->tda_table_epollfd, EPOLL_CTL_DEL, tdt->tdt_fd, NULL); + ev.fd = tdt->tdt_fd; + tvhpoll_rem(tda->tda_table_pd, &ev, 1); close(tdt->tdt_fd); tdt->tdt_fd = -1; @@ -178,51 +181,48 @@ static void * dvb_table_input(void *aux) { th_dvb_adapter_t *tda = aux; - int r, i, tid, fd, x; - struct epoll_event ev[1]; + int r, tid, fd, x; uint8_t sec[4096]; th_dvb_mux_instance_t *tdmi; th_dvb_table_t *tdt; int64_t cycle_barrier = 0; + tvhpoll_event_t ev; while(1) { - x = epoll_wait(tda->tda_table_epollfd, ev, sizeof(ev) / sizeof(ev[0]), -1); + x = tvhpoll_wait(tda->tda_table_pd, &ev, 1, -1); + if (x != 1) continue; - for(i = 0; i < x; i++) { - - tid = ev[i].data.u64 & 0xffffffff; - fd = ev[i].data.u64 >> 32; + tid = ev.data.u64 & 0xffffffff; + fd = ev.data.u64 >> 32; - if(!(ev[i].events & EPOLLIN)) - continue; + if(!(ev.events & TVHPOLL_IN)) + continue; - if((r = read(fd, sec, sizeof(sec))) < 3) - continue; + if((r = read(fd, sec, sizeof(sec))) < 3) + continue; - pthread_mutex_lock(&global_lock); - if((tdmi = tda->tda_mux_current) != NULL) { - LIST_FOREACH(tdt, &tdmi->tdmi_tables, tdt_link) - if(tdt->tdt_id == tid) - break; + pthread_mutex_lock(&global_lock); + if((tdmi = tda->tda_mux_current) != NULL) { + LIST_FOREACH(tdt, &tdmi->tdmi_tables, tdt_link) + if(tdt->tdt_id == tid) + break; - if(tdt != NULL) { - dvb_table_dispatch(sec, r, tdt); + if(tdt != NULL) { + dvb_table_dispatch(sec, r, tdt); - /* Any tables pending (that wants a filter/fd), close this one */ - if(TAILQ_FIRST(&tdmi->tdmi_table_queue) != NULL && - cycle_barrier < getmonoclock()) { - tdt_close_fd(tdmi, tdt); - cycle_barrier = getmonoclock() + 100000; - tdt = TAILQ_FIRST(&tdmi->tdmi_table_queue); - assert(tdt != NULL); - TAILQ_REMOVE(&tdmi->tdmi_table_queue, tdt, tdt_pending_link); - - open_table(tdmi, tdt); - } - } + /* Any tables pending (that wants a filter/fd), close this one */ + if(TAILQ_FIRST(&tdmi->tdmi_table_queue) != NULL && + cycle_barrier < getmonoclock()) { + tdt_close_fd(tdmi, tdt); + cycle_barrier = getmonoclock() + 100000; + tdt = TAILQ_FIRST(&tdmi->tdmi_table_queue); + assert(tdt != NULL); + TAILQ_REMOVE(&tdmi->tdmi_table_queue, tdt, tdt_pending_link); + open_table(tdmi, tdt); + } } - pthread_mutex_unlock(&global_lock); } + pthread_mutex_unlock(&global_lock); } return NULL; } @@ -232,11 +232,13 @@ static void close_table(th_dvb_mux_instance_t *tdmi, th_dvb_table_t *tdt) { th_dvb_adapter_t *tda = tdmi->tdmi_adapter; + tvhpoll_event_t ev; if(tdt->tdt_fd == -1) { TAILQ_REMOVE(&tdmi->tdmi_table_queue, tdt, tdt_pending_link); } else { - epoll_ctl(tda->tda_table_epollfd, EPOLL_CTL_DEL, tdt->tdt_fd, NULL); + ev.fd = tdt->tdt_fd; + tvhpoll_rem(tda->tda_table_pd, &ev, 1); close(tdt->tdt_fd); } } @@ -253,7 +255,7 @@ dvb_input_filtered_setup(th_dvb_adapter_t *tda) tda->tda_close_table = close_table; pthread_t ptid; - tda->tda_table_epollfd = epoll_create(50); + tda->tda_table_pd = tvhpoll_create(50); pthread_create(&ptid, NULL, dvb_table_input, tda); } diff --git a/src/iptv_input.c b/src/iptv_input.c index 7ca96f6d..1b232e81 100644 --- a/src/iptv_input.c +++ b/src/iptv_input.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -40,6 +39,7 @@ #include "tsdemux.h" #include "psi.h" #include "settings.h" +#include "tvhpoll.h" #if defined(PLATFORM_LINUX) #include @@ -52,8 +52,8 @@ # endif #endif -static int iptv_thread_running; -static int iptv_epollfd; +static int iptv_thread_running; +static tvhpoll_t *iptv_poll; static pthread_mutex_t iptv_recvmutex; struct service_list iptv_all_services; /* All IPTV services */ @@ -137,11 +137,11 @@ iptv_thread(void *aux) { int nfds, fd, r, j, hlen; uint8_t tsb[65536], *buf; - struct epoll_event ev; + tvhpoll_event_t ev; service_t *t; while(1) { - nfds = epoll_wait(iptv_epollfd, &ev, 1, -1); + nfds = tvhpoll_wait(iptv_poll, &ev, 1, -1); if(nfds == -1) { tvhlog(LOG_ERR, "IPTV", "epoll() error -- %s, sleeping 1 second", strerror(errno)); @@ -220,13 +220,13 @@ iptv_service_start(service_t *t, unsigned int weight, int force_start) struct sockaddr_in sin; struct sockaddr_in6 sin6; struct ifreq ifr; - struct epoll_event ev; + tvhpoll_event_t ev; assert(t->s_iptv_fd == -1); if(iptv_thread_running == 0) { iptv_thread_running = 1; - iptv_epollfd = epoll_create(10); + iptv_poll = tvhpoll_create(10); pthread_create(&tid, NULL, iptv_thread, NULL); } @@ -345,9 +345,10 @@ iptv_service_start(service_t *t, unsigned int weight, int force_start) resize, strerror(errno)); memset(&ev, 0, sizeof(ev)); - ev.events = EPOLLIN; + ev.events = TVHPOLL_IN; + ev.fd = fd; ev.data.fd = fd; - if(epoll_ctl(iptv_epollfd, EPOLL_CTL_ADD, fd, &ev) == -1) { + if(tvhpoll_add(iptv_poll, &ev, 1) == -1) { tvhlog(LOG_ERR, "IPTV", "\"%s\" cannot add to epoll set -- %s", t->s_identifier, strerror(errno)); close(fd); @@ -451,6 +452,7 @@ iptv_service_stop(service_t *t) #endif } close(t->s_iptv_fd); // Automatically removes fd from epoll set + // TODO: this is an issue t->s_iptv_fd = -1; } diff --git a/src/tcp.c b/src/tcp.c index fc134e4f..a176bdac 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -34,6 +33,7 @@ #include "tcp.h" #include "tvheadend.h" +#include "tvhpoll.h" int tcp_preferred_address_family = AF_INET; @@ -144,16 +144,16 @@ tcp_connect(const char *hostname, int port, char *errbuf, size_t errbufsize, r = poll(&pfd, 1, timeout * 1000); if(r == 0) { - /* Timeout */ - snprintf(errbuf, errbufsize, "Connection attempt timed out"); - close(fd); - return -1; + /* Timeout */ + snprintf(errbuf, errbufsize, "Connection attempt timed out"); + close(fd); + return -1; } if(r == -1) { - snprintf(errbuf, errbufsize, "poll() error: %s", strerror(errno)); - close(fd); - return -1; + snprintf(errbuf, errbufsize, "poll() error: %s", strerror(errno)); + close(fd); + return -1; } getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &errlen); @@ -331,7 +331,7 @@ tcp_read_timeout(int fd, void *buf, size_t len, int timeout) x = recv(fd, buf + tot, len - tot, MSG_DONTWAIT); if(x == -1) { if(errno == EAGAIN) - continue; + continue; return errno; } @@ -373,7 +373,7 @@ tcp_get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen) /** * */ -static int tcp_server_epoll_fd; +static tvhpoll_t *tcp_server_poll; typedef struct tcp_server { tcp_server_callback_t *start; @@ -438,8 +438,8 @@ tcp_server_start(void *aux) static void * tcp_server_loop(void *aux) { - int r, i; - struct epoll_event ev[1]; + int r; + tvhpoll_event_t ev; tcp_server_t *ts; tcp_server_launch_t *tsl; pthread_attr_t attr; @@ -450,46 +450,45 @@ tcp_server_loop(void *aux) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); while(1) { - r = epoll_wait(tcp_server_epoll_fd, ev, sizeof(ev) / sizeof(ev[0]), -1); + r = tvhpoll_wait(tcp_server_poll, &ev, 1, -1); if(r == -1) { - perror("tcp_server: epoll_wait"); + perror("tcp_server: tchpoll_wait"); continue; } - for(i = 0; i < r; i++) { - ts = ev[i].data.ptr; + if (r == 0) continue; - if(ev[i].events & EPOLLHUP) { - close(ts->serverfd); - free(ts); - continue; - } + ts = ev.data.ptr; - if(ev[i].events & EPOLLIN) { - tsl = malloc(sizeof(tcp_server_launch_t)); - tsl->start = ts->start; - tsl->opaque = ts->opaque; - slen = sizeof(struct sockaddr_storage); + if(ev.events & TVHPOLL_HUP) { + close(ts->serverfd); + free(ts); + continue; + } - tsl->fd = accept(ts->serverfd, - (struct sockaddr *)&tsl->peer, &slen); - if(tsl->fd == -1) { - perror("accept"); - free(tsl); - sleep(1); - continue; - } + if(ev.events & TVHPOLL_IN) { + tsl = malloc(sizeof(tcp_server_launch_t)); + tsl->start = ts->start; + tsl->opaque = ts->opaque; + slen = sizeof(struct sockaddr_storage); + tsl->fd = accept(ts->serverfd, + (struct sockaddr *)&tsl->peer, &slen); + if(tsl->fd == -1) { + perror("accept"); + free(tsl); + sleep(1); + continue; + } - slen = sizeof(struct sockaddr_storage); - if(getsockname(tsl->fd, (struct sockaddr *)&tsl->self, &slen)) { - close(tsl->fd); - free(tsl); - continue; - } + slen = sizeof(struct sockaddr_storage); + if(getsockname(tsl->fd, (struct sockaddr *)&tsl->self, &slen)) { + close(tsl->fd); + free(tsl); + continue; + } - pthread_create(&tid, &attr, tcp_server_start, tsl); - } + pthread_create(&tid, &attr, tcp_server_start, tsl); } } return NULL; @@ -502,14 +501,14 @@ void * tcp_server_create(const char *bindaddr, int port, tcp_server_callback_t *start, void *opaque) { int fd, x; - struct epoll_event e; + tvhpoll_event_t ev; tcp_server_t *ts; struct addrinfo hints, *res, *ressave, *use = NULL; char *portBuf = (char*)malloc(6); int one = 1; int zero = 0; - memset(&e, 0, sizeof(e)); + memset(&ev, 0, sizeof(ev)); snprintf(portBuf, 6, "%d", port); @@ -570,9 +569,10 @@ tcp_server_create(const char *bindaddr, int port, tcp_server_callback_t *start, ts->start = start; ts->opaque = opaque; - e.events = EPOLLIN; - e.data.ptr = ts; - epoll_ctl(tcp_server_epoll_fd, EPOLL_CTL_ADD, fd, &e); + ev.fd = fd; + ev.events = TVHPOLL_IN; + ev.data.ptr = ts; + tvhpoll_add(tcp_server_poll, &ev, 1); return ts; } @@ -588,7 +588,7 @@ tcp_server_init(int opt_ipv6) if(opt_ipv6) tcp_preferred_address_family = AF_INET6; - tcp_server_epoll_fd = epoll_create(10); + tcp_server_poll = tvhpoll_create(10); pthread_create(&tid, NULL, tcp_server_loop, NULL); } diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index e9b3ca53..3eac00a6 100644 --- a/src/timeshift/timeshift_reader.c +++ b/src/timeshift/timeshift_reader.c @@ -21,6 +21,7 @@ #include "timeshift.h" #include "timeshift/private.h" #include "atomic.h" +#include "tvhpoll.h" #include #include @@ -399,7 +400,7 @@ static int _timeshift_flush_to_live void *timeshift_reader ( void *p ) { timeshift_t *ts = p; - int efd, nfds, end, fd = -1, run = 1, wait = -1; + int nfds, end, fd = -1, run = 1, wait = -1; timeshift_file_t *cur_file = NULL; off_t cur_off = 0; int cur_speed = 100, keyframe_mode = 0; @@ -409,13 +410,13 @@ void *timeshift_reader ( void *p ) timeshift_index_iframe_t *tsi = NULL; streaming_skip_t *skip = NULL; time_t last_status = 0; + tvhpoll_t *pd; + tvhpoll_event_t ev = { 0 }; - /* Poll */ - struct epoll_event ev = { 0 }; - efd = epoll_create(1); - ev.events = EPOLLIN; - ev.data.fd = ts->rd_pipe.rd; - epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev); + pd = tvhpoll_create(1); + ev.fd = ts->rd_pipe.rd; + ev.events = TVHPOLL_IN; + tvhpoll_add(pd, &ev, 1); /* Output */ while (run) { @@ -427,7 +428,7 @@ void *timeshift_reader ( void *p ) /* Wait for data */ if(wait) - nfds = epoll_wait(efd, &ev, 1, wait); + nfds = tvhpoll_wait(pd, &ev, 1, wait); else nfds = 0; wait = -1; @@ -438,7 +439,7 @@ void *timeshift_reader ( void *p ) /* Control */ pthread_mutex_lock(&ts->state_mutex); if (nfds == 1) { - if (_read_msg(ev.data.fd, &ctrl) > 0) { + if (_read_msg(ts->rd_pipe.rd, &ctrl) > 0) { /* Exit */ if (ctrl->sm_type == SMT_EXIT) { @@ -802,6 +803,7 @@ void *timeshift_reader ( void *p ) } /* Cleanup */ + tvhpoll_destroy(pd); if (fd != -1) close(fd); if (sm) streaming_msg_free(sm); if (ctrl) streaming_msg_free(ctrl);