static int Control (access_t *access, int query, va_list args) { access_sys_t *sys = access->p_sys; dvb_device_t *dev = sys->dev; switch (query) { case ACCESS_CAN_SEEK: case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_PAUSE: case ACCESS_CAN_CONTROL_PACE: *va_arg (args, bool *) = false; break; case ACCESS_GET_PTS_DELAY: { int64_t *v = va_arg (args, int64_t *); *v = var_InheritInteger (access, "live-caching") * INT64_C(1000); break; } case ACCESS_GET_CONTENT_TYPE: *va_arg (args, char **) = strdup ("video/MP2T"); break; case ACCESS_GET_SIGNAL: /* Fetch the signal levels only every so often to avoid stressing * the device bus. */ if ((sys->signal_poll++)) return VLC_EGENERIC; *va_arg (args, double *) = dvb_get_snr (dev); *va_arg (args, double *) = dvb_get_signal_strength (dev); return VLC_SUCCESS; case ACCESS_SET_PRIVATE_ID_STATE: { unsigned pid = va_arg (args, unsigned); bool add = va_arg (args, unsigned); if (unlikely(pid > 0x1FFF)) return VLC_EGENERIC; if (add) { if (dvb_add_pid (dev, pid)) return VLC_EGENERIC; } else dvb_remove_pid (dev, pid); break; } #ifdef HAVE_DVBPSI case ACCESS_SET_PRIVATE_ID_CA: { struct dvbpsi_pmt_s *pmt = va_arg (args, struct dvbpsi_pmt_s *); dvb_set_ca_pmt (dev, pmt); break; } #endif /*case ACCESS_GET_PRIVATE_ID_STATE: TODO? */ default: return VLC_EGENERIC; } return VLC_SUCCESS; }
static int Control (access_t *access, int query, va_list args) { access_sys_t *sys = access->p_sys; dvb_device_t *dev = sys->dev; switch (query) { case ACCESS_CAN_SEEK: case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_PAUSE: case ACCESS_CAN_CONTROL_PACE: { bool *v = va_arg (args, bool *); *v = false; return VLC_SUCCESS; } case ACCESS_GET_PTS_DELAY: { int64_t *v = va_arg (args, int64_t *); *v = var_InheritInteger (access, "live-caching") * INT64_C(1000); return VLC_SUCCESS; } case ACCESS_GET_TITLE_INFO: case ACCESS_GET_META: return VLC_EGENERIC; case ACCESS_GET_CONTENT_TYPE: { char **pt = va_arg (args, char **); *pt = strdup ("video/MP2T"); return VLC_SUCCESS; } case ACCESS_SET_PAUSE_STATE: case ACCESS_SET_TITLE: case ACCESS_SET_SEEKPOINT: return VLC_EGENERIC; case ACCESS_GET_SIGNAL: *va_arg (args, double *) = dvb_get_snr (dev); *va_arg (args, double *) = dvb_get_signal_strength (dev); return VLC_SUCCESS; case ACCESS_SET_PRIVATE_ID_STATE: { unsigned pid = va_arg (args, unsigned); bool add = va_arg (args, unsigned); if (unlikely(pid > 0x1FFF)) return VLC_EGENERIC; if (add) { if (dvb_add_pid (dev, pid)) return VLC_EGENERIC; } else dvb_remove_pid (dev, pid); return VLC_SUCCESS; } case ACCESS_SET_PRIVATE_ID_CA: #ifdef HAVE_DVBPSI { struct dvbpsi_pmt_s *pmt = va_arg (args, struct dvbpsi_pmt_s *); dvb_set_ca_pmt (dev, pmt); return VLC_SUCCESS; } #endif case ACCESS_GET_PRIVATE_ID_STATE: return VLC_EGENERIC; } msg_Warn (access, "unimplemented query %d in control", query); return VLC_EGENERIC; }