subscription: cleanup for the subscription type selection

This commit is contained in:
Jaroslav Kysela 2015-03-13 10:36:31 +01:00
parent 0eb8587510
commit 19e1ae1451
5 changed files with 33 additions and 17 deletions

View file

@ -2025,6 +2025,7 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in)
htsp->htsp_logname, channel_get_name(ch), pro->pro_name ?: "");
hs->hs_s = subscription_create_from_channel(&hs->hs_prch, NULL, weight,
htsp->htsp_logname,
SUBSCRIPTION_PACKET |
SUBSCRIPTION_STREAMING,
htsp->htsp_peername,
htsp->htsp_username,

View file

@ -735,7 +735,7 @@ profile_chain_raw_open(profile_chain_t *prch, void *id, size_t qsize, int muxer)
memset(prch, 0, sizeof(*prch));
prch->prch_id = id;
prch->prch_flags = SUBSCRIPTION_RAW_MPEGTS;
prch->prch_flags = SUBSCRIPTION_MPEGTS;
streaming_queue_init(&prch->prch_sq, SMT_PACKET, qsize);
prch->prch_sq_used = 1;
prch->prch_st = &prch->prch_sq.sq_st;
@ -833,6 +833,7 @@ profile_htsp_work(profile_chain_t *prch,
prsh->prsh_tsfix = tsfix_create(&prsh->prsh_input);
prch->prch_share = prsh->prsh_tsfix;
prch->prch_flags = SUBSCRIPTION_PACKET;
streaming_target_init(&prch->prch_input, profile_input, prch, 0);
prch->prch_st = &prch->prch_input;
return 0;
@ -915,7 +916,7 @@ static int
profile_mpegts_pass_open(profile_chain_t *prch,
muxer_config_t *m_cfg, int flags, size_t qsize)
{
prch->prch_flags = SUBSCRIPTION_RAW_MPEGTS;
prch->prch_flags = SUBSCRIPTION_MPEGTS;
prch->prch_sq.sq_st.st_reject_filter = SMT_PACKET;
prch->prch_sq.sq_maxsize = qsize;
@ -994,6 +995,7 @@ profile_matroska_open(profile_chain_t *prch,
{
streaming_target_t *dst;
prch->prch_flags = SUBSCRIPTION_PACKET;
prch->prch_sq.sq_maxsize = qsize;
dst = prch->prch_gh = globalheaders_create(&prch->prch_sq.sq_st);
@ -1066,6 +1068,7 @@ profile_libav_mpegts_open(profile_chain_t *prch,
{
int r;
prch->prch_flags = SUBSCRIPTION_PACKET;
prch->prch_sq.sq_maxsize = qsize;
r = profile_htsp_work(prch, &prch->prch_sq.sq_st, 0, 0);
@ -1146,6 +1149,7 @@ profile_libav_matroska_open(profile_chain_t *prch,
{
int r;
prch->prch_flags = SUBSCRIPTION_PACKET;
prch->prch_sq.sq_maxsize = qsize;
r = profile_htsp_work(prch, &prch->prch_sq.sq_st, 0, 0);

View file

@ -375,7 +375,9 @@ service_mapper_thread ( void *aux )
/* Subscribe */
tvhinfo("service_mapper", "checking %s", s->s_nicename);
prch.prch_id = s;
sub = subscription_create_from_service(&prch, NULL, SUBSCRIPTION_PRIO_MAPPER,
sub = subscription_create_from_service(&prch, NULL,
SUBSCRIPTION_PACKET |
SUBSCRIPTION_PRIO_MAPPER,
"service_mapper",
0, NULL, NULL, "service_mapper",
NULL);

View file

@ -584,12 +584,19 @@ subscription_create
TAILQ_INIT(&s->ths_instances);
if(flags & SUBSCRIPTION_NONE)
reject |= (SMT_TO_MASK(SMT_PACKET) | SMT_TO_MASK(SMT_MPEGTS));
else if(flags & SUBSCRIPTION_RAW_MPEGTS)
assert(flags & (SUBSCRIPTION_NONE|SUBSCRIPTION_MPEGTS|SUBSCRIPTION_PACKET));
switch (flags & SUBSCRIPTION_TYPE_MASK) {
default:
reject |= SMT_TO_MASK(SMT_PACKET) | SMT_TO_MASK(SMT_MPEGTS);
break;
case SUBSCRIPTION_MPEGTS:
reject |= SMT_TO_MASK(SMT_PACKET); // Reject parsed frames
else
break;
case SUBSCRIPTION_PACKET:
reject |= SMT_TO_MASK(SMT_MPEGTS); // Reject raw mpegts
break;
}
if (!cb) cb = subscription_input_direct;
if (!st) {

View file

@ -25,16 +25,18 @@ struct profile_chain;
extern struct th_subscription_list subscriptions;
#define SUBSCRIPTION_RAW_MPEGTS 0x001
#define SUBSCRIPTION_NONE 0x002
#define SUBSCRIPTION_STREAMING 0x004
#define SUBSCRIPTION_RESTART 0x008
#define SUBSCRIPTION_ONESHOT 0x010
#define SUBSCRIPTION_TABLES 0x020
#define SUBSCRIPTION_INITSCAN 0x040 ///< for mux subscriptions
#define SUBSCRIPTION_IDLESCAN 0x080 ///< for mux subscriptions
#define SUBSCRIPTION_USERSCAN 0x100 ///< for mux subscriptions
#define SUBSCRIPTION_EPG 0x200 ///< for mux subscriptions
#define SUBSCRIPTION_NONE 0x000
#define SUBSCRIPTION_MPEGTS 0x001
#define SUBSCRIPTION_PACKET 0x002
#define SUBSCRIPTION_TYPE_MASK 0x00f
#define SUBSCRIPTION_STREAMING 0x010
#define SUBSCRIPTION_RESTART 0x020
#define SUBSCRIPTION_ONESHOT 0x040
#define SUBSCRIPTION_TABLES 0x080
#define SUBSCRIPTION_INITSCAN 0x100 ///< for mux subscriptions
#define SUBSCRIPTION_IDLESCAN 0x200 ///< for mux subscriptions
#define SUBSCRIPTION_USERSCAN 0x400 ///< for mux subscriptions
#define SUBSCRIPTION_EPG 0x800 ///< for mux subscriptions
/* Some internal priorities */
#define SUBSCRIPTION_PRIO_KEEP 1 ///< Keep input rolling