}
#endif
- pro = profile_find_by_list(htsp->htsp_granted_access->aa_profiles, profile_id, "htsp");
+ pro = profile_find_by_list(htsp->htsp_granted_access->aa_profiles, profile_id,
+ "htsp", SUBSCRIPTION_PACKET | SUBSCRIPTION_HTSP);
profile_chain_init(&hs->hs_prch, pro, ch);
if (profile_chain_work(&hs->hs_prch, &hs->hs_input, timeshiftPeriod, 0)) {
tvhlog(LOG_ERR, "htsp", "unable to create profile chain '%s'", pro->pro_name);
return profile_find_by_name2(name, alt, 0);
}
+/*
+ *
+ */
+static int
+profile_verify(profile_t *pro, int sflags)
+{
+ if (!pro)
+ return 0;
+ if (!pro->pro_enabled)
+ return 0;
+ if ((sflags & SUBSCRIPTION_HTSP) != 0 && !pro->pro_work)
+ return 0;
+ sflags &= pro->pro_sflags;
+ sflags &= SUBSCRIPTION_PACKET|SUBSCRIPTION_MPEGTS;
+ return sflags ? 1 : 0;
+}
+
/*
*
*/
profile_t *
-profile_find_by_list(htsmsg_t *uuids, const char *name, const char *alt)
+profile_find_by_list
+ (htsmsg_t *uuids, const char *name, const char *alt, int sflags)
{
profile_t *pro, *res = NULL;
htsmsg_field_t *f;
pro = profile_find_by_uuid(name);
if (!pro)
- pro = profile_find_by_name(name, alt);
- uuid = pro ? idnode_uuid_as_str(&pro->pro_id) : "";
+ pro = profile_find_by_name(name, alt);
+ pro = NULL;
if (uuids) {
+ uuid = pro ? idnode_uuid_as_str(&pro->pro_id) : "";
HTSMSG_FOREACH(f, uuids) {
uuid2 = htsmsg_field_get_str(f) ?: "";
- if (strcmp(uuid, uuid2) == 0)
+ if (strcmp(uuid, uuid2) == 0 && profile_verify(pro, sflags))
return pro;
if (!res) {
res = profile_find_by_uuid(uuid2);
- if (!res->pro_enabled)
+ if (!profile_verify(res, sflags))
res = NULL;
}
}
profile_htsp_builder(void)
{
profile_t *pro = calloc(1, sizeof(*pro));
+ pro->pro_sflags = SUBSCRIPTION_PACKET;
pro->pro_work = profile_htsp_work;
pro->pro_get_mc = profile_htsp_get_mc;
return pro;
profile_mpegts_pass_builder(void)
{
profile_mpegts_t *pro = calloc(1, sizeof(*pro));
+ pro->pro_sflags = SUBSCRIPTION_MPEGTS;
pro->pro_reopen = profile_mpegts_pass_reopen;
pro->pro_open = profile_mpegts_pass_open;
pro->pro_get_mc = profile_mpegts_pass_get_mc;
profile_matroska_builder(void)
{
profile_matroska_t *pro = calloc(1, sizeof(*pro));
+ pro->pro_sflags = SUBSCRIPTION_PACKET;
pro->pro_reopen = profile_matroska_reopen;
pro->pro_open = profile_matroska_open;
pro->pro_get_mc = profile_matroska_get_mc;
profile_libav_mpegts_builder(void)
{
profile_libav_mpegts_t *pro = calloc(1, sizeof(*pro));
+ pro->pro_sflags = SUBSCRIPTION_PACKET;
pro->pro_reopen = profile_libav_mpegts_reopen;
pro->pro_open = profile_libav_mpegts_open;
pro->pro_get_mc = profile_libav_mpegts_get_mc;
profile_libav_matroska_builder(void)
{
profile_libav_matroska_t *pro = calloc(1, sizeof(*pro));
+ pro->pro_sflags = SUBSCRIPTION_PACKET;
pro->pro_reopen = profile_libav_matroska_reopen;
pro->pro_open = profile_libav_matroska_open;
pro->pro_get_mc = profile_libav_matroska_get_mc;
profile_transcode_builder(void)
{
profile_transcode_t *pro = calloc(1, sizeof(*pro));
+ pro->pro_sflags = SUBSCRIPTION_PACKET;
pro->pro_free = profile_transcode_free;
pro->pro_work = profile_transcode_work;
pro->pro_reopen = profile_transcode_reopen;
LIST_HEAD(,dvr_config) pro_dvr_configs;
LIST_HEAD(,access_entry) pro_accesses;
+ int pro_sflags;
int pro_enabled;
int pro_shield;
char *pro_name;
static inline profile_t *profile_find_by_uuid(const char *uuid)
{ return (profile_t*)idnode_find(uuid, &profile_class, NULL); }
profile_t *profile_find_by_name(const char *name, const char *alt);
-profile_t *profile_find_by_list(htsmsg_t *uuids, const char *name, const char *alt);
+profile_t *profile_find_by_list(htsmsg_t *uuids, const char *name,
+ const char *alt, int sflags);
htsmsg_t * profile_class_get_list(void *o);
if(!(pro = profile_find_by_list(hc->hc_access->aa_profiles,
http_arg_get(&hc->hc_req_args, "profile"),
- "service")))
+ "service",
+ SUBSCRIPTION_PACKET | SUBSCRIPTION_MPEGTS)))
return HTTP_STATUS_NOT_ALLOWED;
if((tcp_id = http_stream_preop(hc)) == NULL)
if(!(pro = profile_find_by_list(hc->hc_access->aa_profiles,
http_arg_get(&hc->hc_req_args, "profile"),
- "channel")))
+ "channel",
+ SUBSCRIPTION_PACKET | SUBSCRIPTION_MPEGTS)))
return HTTP_STATUS_NOT_ALLOWED;
if((tcp_id = http_stream_preop(hc)) == NULL)