From 24818812ff9a662acf3640fa2048b5a2728bf883 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 9 Oct 2014 15:36:26 +0200 Subject: [PATCH] profile: cleanups, add profile_chain_open() --- src/dvr/dvr_rec.c | 2 +- src/profile.c | 4 ++-- src/profile.h | 16 +++++++++++----- src/webui/webui.c | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/dvr/dvr_rec.c b/src/dvr/dvr_rec.c index 3b8b914f..1964ed36 100644 --- a/src/dvr/dvr_rec.c +++ b/src/dvr/dvr_rec.c @@ -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; diff --git a/src/profile.c b/src/profile.c index bc2b4728..10cc96e8 100644 --- a/src/profile.c +++ b/src/profile.c @@ -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; diff --git a/src/profile.h b/src/profile.h index 6232e6bf..65574ac1 100644 --- a/src/profile.h +++ b/src/profile.h @@ -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); diff --git a/src/webui/webui.c b/src/webui/webui.c index 269eee55..00f1b04b 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -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);