Project

General

Profile

Bug #4595 ยป mpegts_mux_sched.patch

Joe User, 2018-11-06 15:59

View differences:

src/input/mpegts/mpegts_mux_sched.c
90 90
  htsmsg_t *m, *p;
91 91

92 92
  p = htsmsg_create_map();
93
  htsmsg_add_str (p, "class", "mpegts_mux");
93
  htsmsg_add_str (p, "class", "mpegts_service");
94 94
  htsmsg_add_bool(p, "enum",  1);
95 95

96 96
  m = htsmsg_create_map();
97 97
  htsmsg_add_str (m, "type",  "api");
98 98
  htsmsg_add_str (m, "uri",   "idnode/load");
99
  htsmsg_add_str (m, "event", "mpegts_mux");
99
  htsmsg_add_str (m, "event", "mpegts_service");
100 100
  htsmsg_add_msg (m, "params", p);
101 101
  
102 102
  return m;
......
142 142
    },
143 143
    {
144 144
      .type     = PT_STR,
145
      .id       = "mux",
146
      .name     = N_("Mux"),
147
      .desc     = N_("The mux to play when the entry is triggered."),
145
      .id       = "service",
146
      .name     = N_("Service"),
147
      .desc     = N_("The service to play when the entry is triggered."),
148 148
      .off      = offsetof(mpegts_mux_sched_t, mms_mux),
149 149
      .list     = mpegts_mux_sched_class_mux_list,
150 150
    },
......
161 161
      .type     = PT_INT,
162 162
      .id       = "timeout",
163 163
      .name     = N_("Timeout (secs)"),
164
      .desc     = N_("The length of time (in seconds) to play the mux "
164
      .desc     = N_("The length of time (in seconds) to play the service "
165 165
                     "(1 hour = 3600)."),
166 166
      .off      = offsetof(mpegts_mux_sched_t, mms_timeout),
167
      .def.i    = 600,
167 168
    },
168 169
    {
169 170
      .type     = PT_BOOL,
......
216 217
static void
217 218
mpegts_mux_sched_timer ( void *p )
218 219
{
219
  mpegts_mux_t *mm;
220
  service_t *s;
220 221
  mpegts_mux_sched_t *mms = p;
221 222
  time_t nxt;
222 223

......
228 229
  if (!mms->mms_mux)
229 230
    return;
230 231
  
231
  /* Find mux */
232
  if (!(mm = mpegts_mux_find(mms->mms_mux))) {
233
    tvhdebug(LS_MUXSCHED, "mux has been removed, delete sched entry");
232
  /* Find service */
233
  if (!(s = service_find_by_uuid(mms->mms_mux))) {
234
    tvhdebug(LS_MUXSCHED, "service has been removed, delete sched entry");
234 235
    mpegts_mux_sched_delete(mms, 1);
235 236
    return;
236 237
  }
......
241 242

242 243
    if (!mms->mms_prch)
243 244
      mms->mms_prch = calloc(1, sizeof(*mms->mms_prch));
244
    mms->mms_prch->prch_id = mm;
245
    mms->mms_prch->prch_id = s;
245 246
    mms->mms_prch->prch_st = &mms->mms_input;
246 247

247 248
    mms->mms_sub
248
      = subscription_create_from_mux(mms->mms_prch, NULL, mms->mms_weight,
249
      = subscription_create_from_service(mms->mms_prch, NULL, mms->mms_weight,
249 250
                                     mms->mms_creator ?: "",
250
                                     SUBSCRIPTION_MINIMAL,
251
                                     SUBSCRIPTION_CONTACCESS |SUBSCRIPTION_EMM,
251 252
                                     NULL, NULL, NULL, NULL);
252 253

253 254
    /* Failed (try-again soon) */
......
324 325
    idnode_load(&mms->mms_id, conf);
325 326

326 327
  /* Validate */
327
  if (!mpegts_mux_find(mms->mms_mux ?: "") ||
328
  if (!service_find_by_uuid(mms->mms_mux ?: "") ||
328 329
      !mms->mms_cronstr) {
329 330
    mpegts_mux_sched_delete(mms, 1);
330 331
    return NULL;
    (1-1/1)