Initial code for opentv module, just testing at the moment.
This commit is contained in:
parent
c3f9a11c70
commit
b8709a89e8
4 changed files with 125 additions and 1 deletions
4
Makefile
4
Makefile
|
@ -72,10 +72,12 @@ SRCS = src/main.c \
|
|||
src/rawtsinput.c \
|
||||
src/iptv_input.c \
|
||||
src/avc.c \
|
||||
src/huffman.c \
|
||||
|
||||
SRCS += src/epggrab/pyepg.c\
|
||||
src/epggrab/xmltv.c\
|
||||
src/epggrab/eit.c
|
||||
src/epggrab/eit.c \
|
||||
src/epggrab/opentv.c
|
||||
|
||||
SRCS += src/plumbing/tsfix.c \
|
||||
src/plumbing/globalheaders.c \
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "epggrab/eit.h"
|
||||
#include "epggrab/xmltv.h"
|
||||
#include "epggrab/pyepg.h"
|
||||
#include "epggrab/opentv.h"
|
||||
#include "channels.h"
|
||||
#include "spawn.h"
|
||||
#include "htsmsg_xml.h"
|
||||
|
@ -712,6 +713,7 @@ static void _epggrab_load ( void )
|
|||
eit_load();
|
||||
xmltv_load();
|
||||
pyepg_load();
|
||||
opentv_load();
|
||||
}
|
||||
|
||||
void epggrab_save ( void )
|
||||
|
@ -819,6 +821,7 @@ void epggrab_init ( void )
|
|||
eit_init(&epggrab_modules);
|
||||
xmltv_init(&epggrab_modules);
|
||||
pyepg_init(&epggrab_modules);
|
||||
opentv_init(&epggrab_modules);
|
||||
|
||||
/* Load config */
|
||||
_epggrab_load();
|
||||
|
|
92
src/epggrab/opentv.c
Normal file
92
src/epggrab/opentv.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Electronic Program Guide - eit grabber
|
||||
* Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include "tvheadend.h"
|
||||
#include "dvb/dvb.h"
|
||||
#include "channels.h"
|
||||
#include "huffman.h"
|
||||
#include "epg.h"
|
||||
#include "epggrab/opentv.h"
|
||||
#include "subscriptions.h"
|
||||
#include "service.h"
|
||||
|
||||
/* ************************************************************************
|
||||
* Module Setup
|
||||
* ***********************************************************************/
|
||||
|
||||
static epggrab_module_t _opentv_mod;
|
||||
static huffman_node_t *_opentv_dict;
|
||||
|
||||
static void* _opentv_thread ( void *p )
|
||||
{
|
||||
int err;
|
||||
th_dvb_adapter_t *tda;
|
||||
th_dvb_mux_instance_t *tdmi;
|
||||
service_t *svc = NULL;
|
||||
|
||||
pthread_mutex_lock(&global_lock);
|
||||
|
||||
printf("find service\n");
|
||||
TAILQ_FOREACH(tda, &dvb_adapters, tda_global_link) {
|
||||
LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) {
|
||||
if ((svc = dvb_transport_find(tdmi, 4152, 0, NULL))) break;
|
||||
}
|
||||
}
|
||||
|
||||
/* start */
|
||||
printf("found svc = %p\n", svc);
|
||||
if(svc) err = service_start(svc, 1, 0);
|
||||
printf("service_start = %d\n", err);
|
||||
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
|
||||
while (1) {
|
||||
sleep(10);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int _opentv_enable ( epggrab_module_t *m, uint8_t e )
|
||||
{
|
||||
pthread_t tid;
|
||||
pthread_attr_t tattr;
|
||||
pthread_attr_init(&tattr);
|
||||
pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create(&tid, &tattr, _opentv_thread, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void opentv_init ( epggrab_module_list_t *list )
|
||||
{
|
||||
_opentv_mod.id = strdup("opentv");
|
||||
_opentv_mod.name = strdup("OpenTV EPG");
|
||||
_opentv_mod.enable = _opentv_enable;
|
||||
*((uint8_t*)&_opentv_mod.flags) = EPGGRAB_MODULE_EXTERNAL; // TODO: hack
|
||||
LIST_INSERT_HEAD(list, &_opentv_mod, link);
|
||||
// Note: this is mostly ignored anyway as EIT is treated as a special case!
|
||||
}
|
||||
|
||||
void opentv_load ( void )
|
||||
{
|
||||
_opentv_dict = huffman_tree_load("epggrab/opentv/dict/skyuk");
|
||||
assert(_opentv_dict);
|
||||
tvhlog(LOG_INFO, "opentv", "huffman tree loaded");
|
||||
}
|
27
src/epggrab/opentv.h
Normal file
27
src/epggrab/opentv.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Electronic Program Guide - opentv
|
||||
* Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __TVH_EPGGRAB_OPENTV_H__
|
||||
#define __TVH_EPGGRAB_OPENTV_H__
|
||||
|
||||
#include "epggrab.h"
|
||||
|
||||
void opentv_init ( epggrab_module_list_t *list );
|
||||
void opentv_load ( void );
|
||||
|
||||
#endif /* __TVH_EPGGRAB_OPENTV_H__ */
|
Loading…
Add table
Reference in a new issue