Ensure scan file download is properly validated and fix to cope with new PPA name due to launchpad crap!

[PR-171] Streaming queue size protection

[PR-171] Update stream queue size protection to be flexible.

The queue size limits are now configurable in the queue init function.

For now only HTTP queues are bounded, the others should not be necessary.

[PR-167] campt: support for OSCam; fixes

capmt: add oscam mode to the webui and config
capmt: add support for oscam-dvbapi (boxtype=pc)
capmt: add multiple adapter support in oscam mode
capmt: fix sending provider id in PMT data
capmt: fix handling multiple CAIDs on the same ECM pid

added source type (MPEGTS etc) to source_info.

added pmt pid to streaming_start

send the packet type to muxer along with the actual packet so we can check if the cast is correct

decoupled the muxer from the service link.

try to handle reconfiguration fo sources properly

show user-agent, username and ip in the subscription status for HTTP subscriptions

some cosmetics to the "active subscription" list when DVR is being used.

tsfix: Mask timestamps with PTS_MASK

When debugging the tsfix code a developer can now narrow PTS_MASK
to force wrap to happen much more frequently

Rename dvb_transport_ -> dvb_service_ for better consistency

Rename dvb_transport.c -> dvb_service.c

Don't have code with side effects in assert()

Including code with side effects in assert() is bad because
it won't be executed if compiled with NDEBUG

dvb: Move out PID specific stuff from dvb_service.c

Remove dmx_sct_filter_params from all over the place

dvb: Move low level DVB table reception to dvb_input_filtered.c

Add new dvb input method: raw

Receives all content from a mux and filter it in tvheadend

Remove dumpmux feature

dvb: Add table parsing when in raw mode

dvb: Add support for grabbing entire mux directly via HTTP

Fix incorrect bit arithmetic causing service restart to not correctly trig

rawtsinput: Handle stream delete

dvb: Stay with filtered hw for now

HTSP: Include video frame duration in streamingStart message

dvb: For full mux streaming, send more than one TS block in each packet

dvb: Stub the raw_setup()

dvb: Run adapters in full mux mode if we can

http: Let full mux dump use the normal straeming code

Fix some locking issues in the http streaming code

Plug some memory leaks

HTSP: Rename htsp.c to htsp_server.c

HTTP: make sure we don't send (and deref) packets before the mime type etc has been send

fix timing issues with rawtsinput (file input).

Don't pass uninitialized mem to epoll_ctl()

HTSP: Add possibility to subscribe to a channelName

Added quantal and removed hardy from latest dev builds.

Add protection to stop opentv crashing on bad title descriptor. Relates to #1367.

Fix mistake in dd_progid parsing.

Ref #1352 - check return value of setuid/setgid calls.

Also slightly changed the logic so its possible to fork as non-root, though
you must explicitly list your username and group with -u and -g as I do not
want to break built in defaults for compatibility.

Refs #1226 - remove block to creating empty channels.

Refs #1355, Refs #1356 - Fix problem with DVR dup detect.

I have completely removed global duplicate detection at this stage until
such time as I can do things properly. This means a user can ALWAYS manually
override and force a recording of a show.

For now duplicate detection only exists within the context or a series
link. So it will only record the "first?" instance of a given episode in
a give series link.

This is still a bit of a hack until I provide the user with the ability
to control the configuration and implement all the hooks properly.

[PR-172] Fix compilatioin issues on OpenWRT

Fix SHA1_* function names
Fix unused variables and functions

[PR-173] Stype fix for NET POA Cabo network

Issue #1376 - add option to manually disable full mux rx.

It appears this mode can cause problems on some systems, particulary
related to USB tuners. Can cause high CPU load.

fixed file suffix for pass-through recording

fixed a minor typo (mostly cosmetics)

Fix #1377 - check for EOVERFLOW when reading from DVB device.

This can be returned as a result of a failure to read quickly enough from
the DVR device. This appears to happen quite regularly on channel zap for
certain cards. It's non-fatal and the system will auto recover immediately.

For now I've left the exit on other error in, but have added an error
message so we know its happening (the biggest problem was this was happening
silently before).

This may also relate to #1134, so might be worth back porting to 3.2.

Minor formatting fix.

Restructure dvb adapter init to cope with configuration that is needed before we can decide whether to use full mux mode or not.

HTSP: Handle partial write()s

h264parser: Treat SPS and PPS id as unsigned

There is a change of crash otherwise if we get a corrupt bitstream

Plug memory leak

subscriptions: Plug possible memleak

service: Plug memory leak

Fix mistake in EPG episode numbering serialisation.

Tarball generation script.

Tweak to the full mux configuration, all USB is now filtered mode by default.

HTSP: Plug possible memory leak at HTSP disconnect

If subscriber is slow we will leak memory because buffered packets
will not be free'd upon HTSP session close

fix 'use after free' of the htsp logname when the connection to the client is lost.

Issue #1369 - move iptv service type store inside main tab function else it causes a 401 error for non-admin UI users.

Issue #1393 - minor aesthetic change, remove trailing slash from user config DVR directory.

Add tvh_strbegins() helper

HTSP: Add option to serve files over HTSP

Currently this is only used to serve recorded files

HTSP: Use lseek() + read() instead of pread()

Does not build out-of-the-box on lucid otherwise

dvb: Actually set tdmi_uncorrected_blocks to FEC rate

Display per-adapter status information in the Status tab in UI

dvb: Include signal status in adapter_msg if we are tuned

htsp: bump version to 7 for 3.4 release.

htsp: some re-structuring and additons to HTSP file support.

htsp: Provide recording path relative to dvr storage path.

This can be useful clients to build recording (folder) hierarchy such
as supported by XBMC.

[PR-175] capmt: ignoring removal requests, fix segfault

[PR-175] capmt: add support for on-demand sockets per service id

This commit fixes simultaneous channel decryption in capmt oscam mode.
Initial channel PMT data and PMT updates are sent to oscam via different
capmt socket connections (a socket is created per channel SID).
OScam is stopping decrypting when the socket is closed.

More details in this thread:
http://www.streamboard.tv/wbb2/thread.php?threadid=33323

Thanks to @posixx for days of testing :)

htsp: fix mistakes in fileSeek handler

make sure there is metadata available before atempting to mux it with a recording

webui: Fix mistake in previous update to iptv.js

make sure the default file descriptor for the passthrough muxer is an invalid one, not stdout.

make sure the recording has been started correctly before atempting to write packets to the muxer.

make sure the default file descriptor for the matroska muxer is an invalid one, not stdout.

HTSP: seems writer must deal with EAGAIN and EWOULDBLOCK

HTPS: Maintain a global list of HTSP connections

This is useful for post mortem debugging

Upgrade htsmsg code from Showtime's codebase

We do this to get access to floating point in JSON

Fix linking issue

dvb/fe: Use double for uncorrected bits average

Display SNR (in dB) in status tab

But only for adapters we know that support it

Fix #1397 - only load adapter config if tab is enabled.

Re-apply previous fix to JSON escape processing required by opentv config files.

make sure pvr muxer is freed

fix bug where recording stopped when the stream was reconfigured

if reconfiguration of the muxer fails, restart recording to a new file

log aspect ratio of recordings

xmltv: was incorrectly blocking symlinked scripts.

util: Added a generic makedirs replacement for the 2 diff implementations.

util: Add util function to remove an entire directory tree (dangerous?).

rawts: Remove debug.

util: Added new tvh_pipe() helper routine.

dvb: updated adapter code to use th_pipe_t

[PR-177] Added preferred CA pid support

Added prefrerred CA pid field in user interface and use field value to store ECM only from stream which is answer ok. Field could be refreshed by program or manually.

support: minor addition to the configure.inc script for cc lib checking.

[PR-54] Switch to libdvbcsa: update code word client and campt

As libdvbcsa works on packet payloads instead of full packets, I borrowed
the packet inspection code from FFdecsa.

Tested and found working with Irdeto2 CA system and OSCam's NewCamd emulation.

As the capmt code doesn't use key change notification, there might be a race
between key updates and decryption, when there is undecrypted data batched up.
This has not been tested yet, as I don't have a capmt cardserver.

[PR-54] updated code from the PR to be optional.

I have decided to include this as there is some suggestion the performance
will be better on ARM (non-x86) processors where we currently have no
optimised code.

[PR-54] fix mistake in merging of the old PR code.

Issue #1407 - skip unused ISO 8859 control codes.

This had the effect of placing unwanted spaces into various channel
names where the broadcaster was sending these control chars.

Thanks to Rene Herbrich for diagnosing this.

Issue #1407 - forgot to strip unused escapes from ISO 6937.

[PR-178] Close file pointer after the call to fb_size(fp)

[PR-180] Fixed Sony CXD2820R identification for SNR enabling

Issue #1423 - ensure that XMLTV grabber search does not crash.

It appears that if paths are duplicated in the PATH env variable the
internal search algorithm failed to detect this and could crash due to
an assert in the internal modlue registration code.

build: use AUTOBUILD_CONFIGURE_EXTRA in debian build rules.

Split recorder schedule view

Now there are two separate categories:
finished (and missed) recordings and upcoming recordings.

Add proper sort order for recording schedule

increment the pmt version on eatch reconfiguration of the passthrough muxer

htsp: add client version info in welcome message.

Fix mistake in CXD2820R check.

Split recorder schedule in three parts: upcoming, finished, failed

Differentiate recordings by icon

dvr: ensure scheduled recordings are linked to autorec rule.

Issue #1454 - Remove usage of non re-entrant strtok()

Thanks to Jaroslav Kysela <perex@perex.cz> for providing the initial fix.

Issue #1453 - Fix autorec init issue (duplicate entries)

With previous init change, the scheduled events may be duplicated. Split
the dvr_autorec_init() to two phases:

1) load the autorec list
2) update the scheduled events after dvr db is initialized

Issue #1454 - init strtok_r() state ptrs, older gcc whinges.

Issue #1454 - correct stupid typo when changing code layout in filebundle.

Issue #1458 - fix unint variable.

Issue #1403 - ensure adapter config is properly loaded.

Add new capabilities field to determine what optional features are included.

webui: add some processing of capabilities for dynamic tab inclusion.

Issue #1446 - fix --disable-cwc checks.

Issue #1446 - fix --disable-linuxdvb.

Fix #1427 - webui: Added reverse proxy support.

This includes a next webroot command line argument (using -W) and
some minor mods to the core HTTP/WebUI code to support this. Most
of the mods are pretty trivial and hopefully nothing will break
too badly.

Issue #1459 - fix removal of all autorec recordings on startup

There were 2 issues here:
- recent changes meant that recordings were purged on every startup
- long standing issue meant complete recordings were removed on
  removal of an autorec rule (which I don't think was intended).

fixed content type detection
Merge branch 'ct-fix' of https://github.com/skazi0/tvheadend into ct-fix