Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
profile: cleanups, add profile_chain_open()
  • Loading branch information
perexg committed Oct 9, 2014
1 parent ffa68ce commit 2481881
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/dvr/dvr_rec.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/profile.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 11 additions & 5 deletions src/profile.h
Expand Up @@ -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;
Expand Down Expand Up @@ -67,19 +69,23 @@ 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);

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);

Expand Down
4 changes: 2 additions & 2 deletions src/webui/webui.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 2481881

Please sign in to comment.