diff options
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream.h | 20 | ||||
-rw-r--r-- | stream/stream_dvb.c | 20 | ||||
-rw-r--r-- | stream/stream_pvr.c | 25 | ||||
-rw-r--r-- | stream/tv.c | 54 | ||||
-rw-r--r-- | stream/tv.h | 4 |
5 files changed, 113 insertions, 10 deletions
diff --git a/stream/stream.h b/stream/stream.h index ec0059e451..ba3f6a4fe0 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -92,7 +92,19 @@ enum stream_ctrl { STREAM_CTRL_GET_BASE_FILENAME, STREAM_CTRL_GET_NAV_EVENT, // struct mp_nav_event** STREAM_CTRL_NAV_CMD, // struct mp_nav_cmd* - STREAM_CTRL_GET_DISC_NAME + STREAM_CTRL_GET_DISC_NAME, + STREAM_CTRL_TV_SET_SCAN, + STREAM_CTRL_SET_TV_FREQ, + STREAM_CTRL_GET_TV_FREQ, + STREAM_CTRL_SET_TV_COLORS, + STREAM_CTRL_GET_TV_COLORS, + STREAM_CTRL_TV_SET_NORM, + STREAM_CTRL_TV_STEP_NORM, + STREAM_CTRL_TV_SET_CHAN, + STREAM_CTRL_TV_STEP_CHAN, + STREAM_CTRL_TV_LAST_CHAN, + STREAM_CTRL_DVB_SET_CHANNEL, + STREAM_CTRL_DVB_STEP_CHANNEL, }; struct stream_lang_req { @@ -106,6 +118,12 @@ struct stream_dvd_info_req { int num_subs; }; +// for STREAM_CTRL_SET_TV_COLORS +#define TV_COLOR_BRIGHTNESS 1 +#define TV_COLOR_HUE 2 +#define TV_COLOR_SATURATION 3 +#define TV_COLOR_CONTRAST 4 + struct stream; typedef struct stream_info_st { const char *name; diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index cdf282d3ac..c1697ddebd 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -550,13 +550,26 @@ int dvb_step_channel(stream_t *stream, int dir) return 0; } - new_current = (list->NUM_CHANNELS + list->current + (dir == DVB_CHANNEL_HIGHER ? 1 : -1)) % list->NUM_CHANNELS; + new_current = (list->NUM_CHANNELS + list->current + (dir >= 0 ? 1 : -1)) % list->NUM_CHANNELS; return dvb_set_channel(stream, priv->card, new_current); } - - +static int dvbin_stream_control(struct stream *s, int cmd, void *arg) +{ + int r; + switch (cmd) { + case STREAM_CTRL_DVB_SET_CHANNEL: { + int *iarg = arg; + r = dvb_set_channel(s, iarg[1], iarg[0]); + return r ? STREAM_OK : STREAM_ERROR; + } + case STREAM_CTRL_DVB_STEP_CHANNEL: + r = dvb_step_channel(s, *(int *)arg); + return r ? STREAM_OK : STREAM_ERROR; + } + return STREAM_UNSUPPORTED; +} static void dvbin_close(stream_t *stream) { @@ -692,6 +705,7 @@ static int dvb_open(stream_t *stream) stream->type = STREAMTYPE_DVB; stream->fill_buffer = dvb_streaming_read; stream->close = dvbin_close; + stream->control = dvbin_stream_control; stream->demuxer = "lavf"; stream->lavf_type = "mpegts"; diff --git a/stream/stream_pvr.c b/stream/stream_pvr.c index e45c9005a1..c19e9f05cb 100644 --- a/stream/stream_pvr.c +++ b/stream/stream_pvr.c @@ -142,6 +142,8 @@ struct pvr_t { int stream_type; }; +static int pvr_stream_control(struct stream *s, int cmd, void *arg); + static struct pvr_t * pvr_init (void) { @@ -1608,6 +1610,7 @@ pvr_stream_open (stream_t *stream) stream->type = STREAMTYPE_PVR; stream->fill_buffer = pvr_stream_read; stream->close = pvr_stream_close; + stream->control = pvr_stream_control; return STREAM_OK; } @@ -1698,6 +1701,28 @@ pvr_force_freq_step (stream_t *stream, int step) return force_freq_step (pvr, step); } +static int pvr_stream_control(struct stream *s, int cmd, void *arg) +{ + switch (cmd) { + case STREAM_CTRL_SET_TV_FREQ: + pvr_set_freq(s, (int)(*(float *)arg + 0.5f)); + return STREAM_OK; + case STREAM_CTRL_GET_TV_FREQ: + *(float *)arg = pvr_get_current_frequency(s); + return STREAM_OK; + case STREAM_CTRL_TV_SET_CHAN: + pvr_set_channel(s, (char *)arg); + return STREAM_OK; + case STREAM_CTRL_TV_STEP_CHAN: + pvr_set_channel_step(s, *(int *)arg); + return STREAM_OK; + case STREAM_CTRL_TV_LAST_CHAN: + pvr_set_lastchannel(s); + return STREAM_OK; + } + return STREAM_UNSUPPORTED; +} + const stream_info_t stream_info_pvr = { .name = "pvr", .open = pvr_stream_open, diff --git a/stream/tv.c b/stream/tv.c index c7017f4471..c42a81fde1 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -1087,9 +1087,58 @@ int tv_step_norm(tvi_handle_t *tvh) return 1; } -int tv_step_chanlist(tvi_handle_t *tvh) +static int tv_stream_control(tvi_handle_t *tvh, int cmd, void *arg) { - return 1; + switch (cmd) { + case STREAM_CTRL_TV_SET_SCAN: + tv_start_scan(tvh, *(int *)arg); + return STREAM_OK; + case STREAM_CTRL_SET_TV_FREQ: + tv_set_freq(tvh, *(float *)arg * 16.0f); + return STREAM_OK; + case STREAM_CTRL_GET_TV_FREQ: { + unsigned long tmp = 0; + tv_get_freq(tvh, &tmp); + *(float *)arg = tmp / 16.0f; + return STREAM_OK; + } + case STREAM_CTRL_SET_TV_COLORS: + tv_set_color_options(tvh, ((int *)arg)[0], ((int *)arg)[1]); + return STREAM_OK; + case STREAM_CTRL_GET_TV_COLORS: + tv_get_color_options(tvh, ((int *)arg)[0], &((int *)arg)[1]); + return STREAM_OK; + case STREAM_CTRL_TV_SET_NORM: + tv_set_norm(tvh, (char *)arg); + return STREAM_OK; + case STREAM_CTRL_TV_STEP_NORM: + tv_step_norm(tvh); + return STREAM_OK; + case STREAM_CTRL_TV_SET_CHAN: + tv_set_channel(tvh, (char *)arg); + return STREAM_OK; + case STREAM_CTRL_TV_STEP_CHAN: + if (*(int *)arg >= 0) { + tv_step_channel(tvh, TV_CHANNEL_HIGHER); + } else { + tv_step_channel(tvh, TV_CHANNEL_LOWER); + } + return STREAM_OK; + case STREAM_CTRL_TV_LAST_CHAN: + tv_last_channel(tvh); + return STREAM_OK; + } + return STREAM_UNSUPPORTED; +} + +static int demux_tv_control(demuxer_t *demuxer, int cmd, void *arg) +{ + tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv); + if (cmd != DEMUXER_CTRL_STREAM_CTRL) + return DEMUXER_CTRL_NOTIMPL; + struct demux_ctrl_stream_ctrl *ctrl = arg; + ctrl->res = tv_stream_control(tvh, ctrl->ctrl, ctrl->arg); + return DEMUXER_CTRL_OK; } demuxer_desc_t demuxer_desc_tv = { @@ -1097,6 +1146,7 @@ demuxer_desc_t demuxer_desc_tv = { .desc = "TV card demuxer", .type = DEMUXER_TYPE_TV, .fill_buffer = demux_tv_fill_buffer, + .control = demux_tv_control, .open = demux_open_tv, .close = demux_close_tv, }; diff --git a/stream/tv.h b/stream/tv.h index 4323762139..c5e8aba91f 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -201,10 +201,6 @@ typedef struct { int tv_set_color_options(tvi_handle_t *tvh, int opt, int val); int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val); -#define TV_COLOR_BRIGHTNESS 1 -#define TV_COLOR_HUE 2 -#define TV_COLOR_SATURATION 3 -#define TV_COLOR_CONTRAST 4 int tv_step_channel_real(tvi_handle_t *tvh, int direction); int tv_step_channel(tvi_handle_t *tvh, int direction); |