comparison stream/stream_dvb.c @ 36428:7766530caa76

Add new stream control command STREAM_CTRL_GET_CURRENT_CHANNEL. This provides the name of the currently selected DVB channel. (Unsupported for analog TV though.)
author ib
date Fri, 29 Nov 2013 12:34:21 +0000
parents e89214f37501
children
comparison
equal deleted inserted replaced
36427:960593201c48 36428:7766530caa76
654 return 1; 654 return 1;
655 } 655 }
656 656
657 657
658 658
659 static int dvb_control(stream_t *stream, int cmd, void *arg)
660 {
661 dvb_priv_t *priv = stream->priv;
662 dvb_channels_list *list;
663
664 switch (cmd) {
665 case STREAM_CTRL_GET_CURRENT_CHANNEL:
666 if (priv) {
667 list = priv->list;
668 *(char **)arg = list->channels[list->current].name;
669 return STREAM_OK;
670 } else
671 return STREAM_ERROR;
672 }
673
674 return STREAM_UNSUPPORTED;
675 }
676
677
659 678
660 static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) 679 static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
661 { 680 {
662 // I don't force the file format bacause, although it's almost always TS, 681 // I don't force the file format bacause, although it's almost always TS,
663 // there are some providers that stream an IP multicast with M$ Mpeg4 inside 682 // there are some providers that stream an IP multicast with M$ Mpeg4 inside
732 return STREAM_ERROR; 751 return STREAM_ERROR;
733 } 752 }
734 753
735 stream->type = STREAMTYPE_DVB; 754 stream->type = STREAMTYPE_DVB;
736 stream->fill_buffer = dvb_streaming_read; 755 stream->fill_buffer = dvb_streaming_read;
756 stream->control = dvb_control;
737 stream->close = dvbin_close; 757 stream->close = dvbin_close;
738 m_struct_free(&stream_opts, opts); 758 m_struct_free(&stream_opts, opts);
739 759
740 *file_format = DEMUXER_TYPE_MPEG_TS; 760 *file_format = DEMUXER_TYPE_MPEG_TS;
741 761