remove (the unused) plugin framework
This commit is contained in:
parent
364f88f3f3
commit
ab6b9e229e
4 changed files with 1 additions and 207 deletions
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
|||
-include ../config.mak
|
||||
|
||||
SRCS = main.c dispatch.c channels.c transports.c teletext.c psi.c \
|
||||
subscriptions.c tsmux.c tsdemux.c pes.c buffer.c tcp.c plugin.c \
|
||||
subscriptions.c tsmux.c tsdemux.c pes.c buffer.c tcp.c \
|
||||
resolver.c
|
||||
|
||||
SRCS += http.c htmlui.c
|
||||
|
|
142
plugin.c
142
plugin.c
|
@ -1,142 +0,0 @@
|
|||
/*
|
||||
* tvheadend, Plugin framework
|
||||
* Copyright (C) 2007 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
|
||||
* 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 <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "tvhead.h"
|
||||
#include "plugin.h"
|
||||
|
||||
struct th_plugin_list th_plugins;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void *
|
||||
plugin_aux_create(struct pluginaux_list *h, struct th_plugin *p, size_t siz)
|
||||
{
|
||||
pluginaux_t *pa;
|
||||
|
||||
pa = calloc(1, siz);
|
||||
pa->pa_plugin = p;
|
||||
LIST_INSERT_HEAD(h, pa, pa_link);
|
||||
return pa;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void *
|
||||
plugin_aux_find(struct pluginaux_list *h, struct th_plugin *p)
|
||||
{
|
||||
pluginaux_t *pa;
|
||||
|
||||
LIST_FOREACH(pa, h, pa_link)
|
||||
if(pa->pa_plugin == p)
|
||||
break;
|
||||
|
||||
return pa;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
plugin_aux_destroy(void *pa)
|
||||
{
|
||||
pluginaux_t *pa0 = pa;
|
||||
LIST_REMOVE(pa0, pa_link);
|
||||
free(pa);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
th_plugin_t *
|
||||
plugin_alloc(const char *name, void *opaque, size_t minsiz)
|
||||
{
|
||||
th_plugin_t *p;
|
||||
|
||||
if(sizeof(th_plugin_t) < minsiz)
|
||||
return NULL;
|
||||
|
||||
p = calloc(1, sizeof(th_plugin_t));
|
||||
|
||||
p->thp_name = strdup(name);
|
||||
p->thp_opaque = opaque;
|
||||
|
||||
LIST_INSERT_HEAD(&th_plugins, p, thp_link);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
plugin_init(void)
|
||||
{
|
||||
const char *path;
|
||||
char file[400];
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
char *c;
|
||||
void *h;
|
||||
|
||||
void (*ini)(void);
|
||||
|
||||
if((path = config_get_str("plugins", NULL)) == NULL)
|
||||
return;
|
||||
|
||||
if((dir = opendir(path)) == NULL)
|
||||
return;
|
||||
|
||||
while((d = readdir(dir)) != NULL) {
|
||||
if(d->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
if((c = strrchr(d->d_name, '.')) == NULL)
|
||||
continue;
|
||||
|
||||
if(strcmp(c, ".so"))
|
||||
continue;
|
||||
|
||||
snprintf(file, sizeof(file), "%s/%s", path, d->d_name);
|
||||
|
||||
h = dlopen(file, RTLD_NOW | RTLD_LOCAL);
|
||||
if(h == NULL) {
|
||||
syslog(LOG_ERR, "%s", dlerror());
|
||||
continue;
|
||||
}
|
||||
|
||||
ini = dlsym(h, "plugin_init");
|
||||
if(ini == NULL) {
|
||||
syslog(LOG_ERR, "Plugin \"%s\" lacks init function", file);
|
||||
continue;
|
||||
}
|
||||
|
||||
ini();
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
63
plugin.h
63
plugin.h
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* tvheadend, Plugin framework
|
||||
* Copyright (C) 2007 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
|
||||
* 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 PLUGIN_H_
|
||||
#define PLUGIN_H_
|
||||
|
||||
#include "tvhead.h"
|
||||
|
||||
LIST_HEAD(th_plugin_list, th_plugin);
|
||||
|
||||
extern struct th_plugin_list th_plugins;
|
||||
struct th_plugin;
|
||||
|
||||
typedef struct th_plugin {
|
||||
|
||||
LIST_ENTRY(th_plugin) thp_link;
|
||||
|
||||
void *thp_opaque;
|
||||
|
||||
const char *thp_name;
|
||||
|
||||
void (*thp_transport_start)(struct th_plugin *p, struct pluginaux_list *h,
|
||||
th_transport_t *t);
|
||||
|
||||
void (*thp_transport_stop)(struct th_plugin *p, struct pluginaux_list *h,
|
||||
th_transport_t *t);
|
||||
|
||||
void (*thp_psi_table)(struct th_plugin *p, struct pluginaux_list *h,
|
||||
th_transport_t *t, struct th_stream *st,
|
||||
const uint8_t *data, size_t len);
|
||||
|
||||
int (*thp_tsb_process)(pluginaux_t *pa, th_transport_t *t,
|
||||
struct th_stream *st, uint8_t *tsb);
|
||||
|
||||
} th_plugin_t;
|
||||
|
||||
void *plugin_aux_create(struct pluginaux_list *h, struct th_plugin *p,
|
||||
size_t siz);
|
||||
|
||||
void *plugin_aux_find(struct pluginaux_list *h, struct th_plugin *p);
|
||||
|
||||
void plugin_aux_destroy(void *pa);
|
||||
|
||||
th_plugin_t *plugin_alloc(const char *name, void *opaque, size_t minsiz);
|
||||
|
||||
void plugin_init(void);
|
||||
|
||||
#endif /* PLUGIN_H_ */
|
|
@ -48,7 +48,6 @@
|
|||
#include "psi.h"
|
||||
#include "buffer.h"
|
||||
#include "tsdemux.h"
|
||||
#include "plugin.h"
|
||||
|
||||
static int
|
||||
ts_reassembly_pes(th_transport_t *t, th_stream_t *st, uint8_t *data, int len)
|
||||
|
|
Loading…
Add table
Reference in a new issue