profile: cleanups, add profile_chain_open()

This commit is contained in:
Jaroslav Kysela 2014-10-09 15:36:26 +02:00
parent ffa68cecdb
commit 24818812ff
4 changed files with 16 additions and 10 deletions

View file

@ -78,7 +78,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
pro = de->de_config->dvr_profile;
prch = malloc(sizeof(*prch));
if (pro->pro_open(pro, prch, &de->de_config->dvr_muxcnf, 0)) {
if (profile_chain_open(pro, prch, &de->de_config->dvr_muxcnf, 0, 0)) {
tvherror("dvr", "unable to create new channel streaming chain for '%s'",
channel_get_name(de->de_channel));
return;

View file

@ -368,7 +368,7 @@ const idclass_t profile_mpegts_pass_class =
static int
profile_mpegts_pass_open(profile_t *_pro, profile_chain_t *prch,
muxer_config_t *m_cfg, size_t qsize)
muxer_config_t *m_cfg, int flags, size_t qsize)
{
profile_mpegts_t *pro = (profile_mpegts_t *)_pro;
muxer_config_t c;
@ -432,7 +432,7 @@ const idclass_t profile_matroska_class =
static int
profile_matroska_open(profile_t *_pro, profile_chain_t *prch,
muxer_config_t *m_cfg, size_t qsize)
muxer_config_t *m_cfg, int flags, size_t qsize)
{
profile_matroska_t *pro = (profile_matroska_t *)_pro;
muxer_config_t c;

View file

@ -31,6 +31,8 @@ extern const idclass_t profile_class;
extern const idclass_t profile_mpegts_pass_class;
extern const idclass_t profile_matroska_class;
#define PROFILE_TIMESHIFT (1<<0)
TAILQ_HEAD(profile_entry_queue, profile);
extern struct profile_entry_queue profiles;
@ -67,12 +69,12 @@ typedef struct profile {
char *pro_name;
char *pro_comment;
void (*pro_free)(struct profile *cac);
void (*pro_conf_changed)(struct profile *cac);
muxer_container_type_t (*pro_get_mc)(struct profile *cac);
void (*pro_free)(struct profile *pro);
void (*pro_conf_changed)(struct profile *pro);
muxer_container_type_t (*pro_get_mc)(struct profile *pro);
int (*pro_open)(struct profile *cac, profile_chain_t *prch,
muxer_config_t *m_cfg, size_t qsize);
int (*pro_open)(struct profile *pro, profile_chain_t *prch,
muxer_config_t *m_cfg, int flags, size_t qsize);
} profile_t;
void profile_register(const idclass_t *clazz, profile_builder_t builder);
@ -80,6 +82,10 @@ void profile_register(const idclass_t *clazz, profile_builder_t builder);
profile_t *profile_create
(const char *uuid, htsmsg_t *conf, int save);
static inline int
profile_chain_open(profile_t *pro, profile_chain_t *prch,
muxer_config_t *m_cfg, int flags, size_t qsize)
{ return pro->pro_open(pro, prch, m_cfg, flags, qsize); }
int profile_chain_raw_open(profile_chain_t *prch, size_t qsize);
void profile_chain_close(profile_chain_t *prch);

View file

@ -808,7 +808,7 @@ http_stream_service(http_connection_t *hc, service_t *service, int weight)
else
qsize = 1500000;
if (!pro->pro_open(pro, &prch, NULL, qsize)) {
if (!profile_chain_open(pro, &prch, NULL, 0, qsize)) {
tcp_get_ip_str((struct sockaddr*)hc->hc_peer, addrbuf, 50);
@ -920,7 +920,7 @@ http_stream_channel(http_connection_t *hc, channel_t *ch, int weight)
else
qsize = 1500000;
if (!pro->pro_open(pro, &prch, NULL, qsize)) {
if (!profile_chain_open(pro, &prch, NULL, 0, qsize)) {
tcp_get_ip_str((struct sockaddr*)hc->hc_peer, addrbuf, 50);