Exemplo n.º 1
0
static int open_dvb_sel(menu_t* menu, char* args)
{
	mpriv->config = dvb_get_config();
	if(mpriv->config == NULL)
		return 0;

	menu->draw 		= menu_list_draw;
	menu->read_cmd 	= read_cmd;
	menu->close 	= close_menu;

	mpriv->card = 0;
	mpriv->level = 1;
	return fill_menu(menu);
}
Exemplo n.º 2
0
static int dvb_open(stream_t *stream, int mode)
{
	// I don't force  the file format bacause, although it's almost always TS,
	// there are some providers that stream an IP multicast with M$ Mpeg4 inside
	dvb_priv_t *priv = stream->priv;
        dvb_priv_t *p = priv;
	char *progname;
	int tuner_type = 0, i;


	if(mode != STREAM_READ)
		return STREAM_UNSUPPORTED;

	priv->fe_fd = priv->sec_fd = priv->dvr_fd = -1;
	priv->config = dvb_get_config();
	if(priv->config == NULL)
	{
		free(priv);
		mp_msg(MSGT_DEMUX, MSGL_ERR, "DVB CONFIGURATION IS EMPTY, exit\n");
		return STREAM_ERROR;
	}

	priv->card = -1;
	for(i=0; i<priv->config->count; i++)
	{
		if(priv->config->cards[i].devno+1 == p->cfg_card)
		{
			priv->card = i;
			break;
		}
	}

	if(priv->card == -1)
 	{
		free(priv);
		mp_msg(MSGT_DEMUX, MSGL_ERR, "NO CONFIGURATION FOUND FOR CARD N. %d, exit\n", p->cfg_card);
 		return STREAM_ERROR;
 	}
	priv->timeout = p->cfg_timeout;

	tuner_type = priv->config->cards[priv->card].type;

	if(tuner_type == 0)
	{
		free(priv);
		mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: UNKNOWN OR UNDETECTABLE TUNER TYPE, EXIT\n");
		return STREAM_ERROR;
	}


	priv->tuner_type = tuner_type;

	mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: prog=%s, card=%d, type=%d\n",
		p->cfg_prog, priv->card+1, priv->tuner_type);

	priv->list = priv->config->cards[priv->card].list;

	if((! strcmp(p->cfg_prog, "")) && (priv->list != NULL))
		progname = priv->list->channels[0].name;
	else
		progname = p->cfg_prog;


	if(! dvb_streaming_start(stream, tuner_type, progname))
	{
		free(stream->priv);
		stream->priv = NULL;
		return STREAM_ERROR;
	}

	stream->type = STREAMTYPE_DVB;
	stream->fill_buffer = dvb_streaming_read;
	stream->close = dvbin_close;

	stream->demuxer = "lavf";
        stream->lavf_type = "mpegts";

	return STREAM_OK;
}
Exemplo n.º 3
0
static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
{
	// I don't force  the file format bacause, although it's almost always TS,
	// there are some providers that stream an IP multicast with M$ Mpeg4 inside
	struct stream_priv_s* p = (struct stream_priv_s*)opts;
	dvb_priv_t *priv;
	char *progname;
	int tuner_type = 0, i;


	if(mode != STREAM_READ)
		return STREAM_UNSUPPORTED;

	stream->priv = calloc(1, sizeof(dvb_priv_t));
	if(stream->priv ==  NULL)
		return STREAM_ERROR;

	priv = (dvb_priv_t *)stream->priv;
	priv->stream = stream;
	dvb_config = dvb_get_config();
	if(dvb_config == NULL)
	{
		free(priv);
		mp_msg(MSGT_DEMUX, MSGL_ERR, "DVB CONFIGURATION IS EMPTY, exit\n");
		return STREAM_ERROR;
	}
	dvb_config->priv = priv;
	priv->config = dvb_config;

	priv->card = -1;
	for(i=0; i<priv->config->count; i++)
	{
		if(priv->config->cards[i].devno+1 == p->card)
		{
			priv->card = i;
			break;
		}
	}

	if(priv->card == -1)
 	{
		free(priv);
		mp_msg(MSGT_DEMUX, MSGL_ERR, "NO CONFIGURATION FOUND FOR CARD N. %d, exit\n", p->card);
 		return STREAM_ERROR;
 	}
	priv->timeout = p->timeout;
	
	tuner_type = priv->config->cards[priv->card].type;

	if(tuner_type == 0)
	{
		free(priv);
		mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: UNKNOWN OR UNDETECTABLE TUNER TYPE, EXIT\n");
		return STREAM_ERROR;
	}


	priv->tuner_type = tuner_type;

	mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: prog=%s, card=%d, type=%d, vid=%d, aid=%d\n",
		p->prog, priv->card+1, priv->tuner_type, p->vid, p->aid);

	priv->list = priv->config->cards[priv->card].list;
	
	if((! strcmp(p->prog, "")) && (priv->list != NULL))
		progname = priv->list->channels[0].name;
	else
		progname = p->prog;


	if(! dvb_streaming_start(priv, p, tuner_type, progname))
	{
		free(stream->priv);
		stream->priv = NULL;
		return STREAM_ERROR;
	}

	stream->type = STREAMTYPE_DVB;
	stream->fill_buffer = dvb_streaming_read;
	stream->close = dvbin_close;
	m_struct_free(&stream_opts, opts);
	
	*file_format = DEMUXER_TYPE_MPEG_TS;

	return STREAM_OK;
}