diff --git a/htsp.c b/htsp.c index ec85fcaa..24770a99 100644 --- a/htsp.c +++ b/htsp.c @@ -149,15 +149,15 @@ htsp_subscribe(rpc_session_t *ses, htsmsg_t *in, void *opaque) { htsp_t *htsp = opaque; channel_t *ch; - const char *txt; th_subscription_t *s; htsmsg_t *r; + uint32_t tag; - if((txt = htsmsg_get_str(in, "channel")) == NULL) - return rpc_error(ses, "missing argument: channel"); + if(htsmsg_get_u32(in, "channelTag", &tag)) + return rpc_error(ses, "missing argument: channelTag"); - if((ch = channel_find(txt, 0, NULL)) == NULL) + if((ch = channel_by_tag(tag)) == NULL) return rpc_error(ses, "Channel not found"); LIST_FOREACH(s, &htsp->htsp_subscriptions, ths_subscriber_link) { @@ -168,14 +168,10 @@ htsp_subscribe(rpc_session_t *ses, htsmsg_t *in, void *opaque) } - tag = tag_get(); - r = htsmsg_create(); - htsmsg_add_u32(r, "seq", ses->rs_seq); - htsmsg_add_u32(r, "id", tag); htsp_send_msg(htsp, r, 0); - htsp_muxer_subscribe(htsp, ch, 200, tag); + htsp_muxer_subscribe(htsp, ch, 200); return NULL; } @@ -190,8 +186,8 @@ htsp_unsubscribe(rpc_session_t *ses, htsmsg_t *in, void *opaque) htsp_t *htsp = opaque; uint32_t id; - if(htsmsg_get_u32(in, "id", &id)) - return rpc_error(ses, "missing argument: id"); + if(htsmsg_get_u32(in, "channelTag", &id)) + return rpc_error(ses, "missing argument: channelTag"); htsp_muxer_unsubscribe(htsp, id); diff --git a/htsp_muxer.c b/htsp_muxer.c index a2841112..8a2c801e 100644 --- a/htsp_muxer.c +++ b/htsp_muxer.c @@ -51,7 +51,7 @@ htsp_packet_input(void *opaque, th_muxstream_t *tms, th_pkt_t *pkt) */ htsmsg_add_str(m, "method", "muxpkt"); - htsmsg_add_u32(m, "id", s->ths_u32); + htsmsg_add_u32(m, "channelTag", s->ths_channel->ch_tag); htsmsg_add_u64(m, "stream", tms->tms_index); htsmsg_add_u64(m, "dts", pkt->pkt_dts); @@ -89,7 +89,7 @@ htsp_subscription_callback(struct th_subscription *s, m = htsmsg_create(); htsmsg_add_str(m, "method", "subscription_start"); - htsmsg_add_u32(m, "id", s->ths_u32); + htsmsg_add_u32(m, "channelTag", s->ths_channel->ch_tag); LIST_FOREACH(tms, &tm->tm_streams, tms_muxer_link0) { tms->tms_index = index++; @@ -113,7 +113,7 @@ htsp_subscription_callback(struct th_subscription *s, if(htsp->htsp_zombie == 0) { m = htsmsg_create(); htsmsg_add_str(m, "method", "subscription_stop"); - htsmsg_add_u32(m, "id", s->ths_u32); + htsmsg_add_u32(m, "channelTag", s->ths_channel->ch_tag); htsmsg_add_str(m, "reason", "unknown"); htsp_send_msg(htsp, m, 0); @@ -129,12 +129,12 @@ htsp_subscription_callback(struct th_subscription *s, * */ void -htsp_muxer_subscribe(htsp_t *htsp, channel_t *ch, int weight, uint32_t tag) +htsp_muxer_subscribe(htsp_t *htsp, channel_t *ch, int weight) { th_subscription_t *s; s = subscription_create(ch, weight, "HTSP", htsp_subscription_callback, htsp, - tag); + 0); LIST_INSERT_HEAD(&htsp->htsp_subscriptions, s, ths_subscriber_link); } @@ -159,7 +159,7 @@ htsp_muxer_unsubscribe(htsp_t *htsp, uint32_t id) th_subscription_t *s; LIST_FOREACH(s, &htsp->htsp_subscriptions, ths_subscriber_link) { - if(s->ths_u32 == id) + if(s->ths_channel->ch_tag == id) break; } diff --git a/htsp_muxer.h b/htsp_muxer.h index 0cbf0844..42965436 100644 --- a/htsp_muxer.h +++ b/htsp_muxer.h @@ -19,8 +19,7 @@ #ifndef HTSP_MUXER_H_ #define HTSP_MUXER_H_ -void htsp_muxer_subscribe(htsp_t *htsp, channel_t *ch, - int weight, uint32_t tag); +void htsp_muxer_subscribe(htsp_t *htsp, channel_t *ch, int weight); void htsp_muxer_unsubscribe(htsp_t *htsp, uint32_t id);