Пример #1
0
void dvb_dmxdev_release(struct dmxdev *dmxdev)
{
	dvb_unregister_device(dmxdev->dvbdev);
	dvb_unregister_device(dmxdev->dvr_dvbdev);

	vfree(dmxdev->filter);
	dmxdev->filter = NULL;
	dmxdev->demux->close(dmxdev->demux);
}
Пример #2
0
static void __exit StmUnloadModule (void)
{
    int i;

    BackendDelete ();

    for (i = 0; i < DVB_MAX_DEVICES_PER_ADAPTER; i++)
    {
        struct DeviceContext_s* DeviceContext   = &DvbContext->DeviceContext[i];
        struct dvb_demux*       DvbDemux        = &DeviceContext->DvbDemux;
        struct dmxdev*          DmxDevice       = &DeviceContext->DmxDevice;

#if defined (USE_KERNEL_DEMUX)
        if (DmxDevice != NULL)
        {
            /* We don't need to unregister DmxDevice->dvr_dvbdev as this will be done by dvb_dmxdev_release */
            dvb_dmxdev_release (DmxDevice);
        }
        if (DvbDemux != NULL)
        {
            DvbDemux->dmx.remove_frontend (&DvbDemux->dmx, &DeviceContext->MemoryFrontend);
            dvb_dmx_release    (DvbDemux);
        }
#else
        dvb_unregister_device  (DeviceContext->DemuxDevice);
        dvb_unregister_device  (DeviceContext->DvrDevice);
#endif
        if (DeviceContext->AudioDevice != NULL)
            dvb_unregister_device  (DeviceContext->AudioDevice);
        if (DeviceContext->VideoDevice != NULL)
            dvb_unregister_device  (DeviceContext->VideoDevice);

        PlaybackDelete (DeviceContext->Playback);
        DeviceContext->AudioStream              = NULL;
        DeviceContext->VideoStream              = NULL;
        DeviceContext->Playback                 = NULL;
	kfree(DeviceContext->dvr_in);
	kfree(DeviceContext->dvr_out);
    }


    if (DvbContext != NULL)
    {
        dvb_unregister_adapter (&DvbContext->DvbAdapter);
        kfree (DvbContext);
    }
    DvbContext  = NULL;

    DVB_DEBUG("STM stream device unloaded\n");

    return;
}
Пример #3
0
void 
dvb_dmxdev_release(struct dmxdev *dmxdev)
{
	dvb_unregister_device(dmxdev->dvbdev);
	dvb_unregister_device(dmxdev->dvr_dvbdev);

	if (dmxdev->filter) {
		vfree(dmxdev->filter);
		dmxdev->filter=0;
	}

	if (dmxdev->dvr) {
		vfree(dmxdev->dvr);
		dmxdev->dvr=0;
	}
	dmxdev->demux->close(dmxdev->demux);
}
Пример #4
0
void dvb_netstream_release(struct dvb_netstream *ns)
{
	ns->exit=1;
	if (ns->dvbdev->users > 1) {
		wait_event(ns->dvbdev->wait_queue,
			   ns->dvbdev->users == 1);
	}
	dvb_unregister_device(ns->dvbdev);
}
Пример #5
0
void dvb_dmxdev_release(struct dmxdev *dmxdev)
{
    dmxdev->exit=1;
    if (dmxdev->dvbdev->users > 1) {
        wait_event(dmxdev->dvbdev->wait_queue,
                dmxdev->dvbdev->users==1);
    }
    if (dmxdev->dvr_dvbdev->users > 1) {
        wait_event(dmxdev->dvr_dvbdev->wait_queue,
                dmxdev->dvr_dvbdev->users==1);
    }

    dvb_unregister_device(dmxdev->dvbdev);
    dvb_unregister_device(dmxdev->dvr_dvbdev);

    vfree(dmxdev->filter);
    dmxdev->filter = NULL;
    dmxdev->demux->close(dmxdev->demux);
}
Пример #6
0
void dvb_net_release (struct dvb_net *dvbnet)
{
	int i;

	dvb_unregister_device(dvbnet->dvbdev);

	for (i=0; i<DVB_NET_DEVICES_MAX; i++) {
		if (!dvbnet->state[i])
			continue;
		dvb_net_remove_if(dvbnet, i);
	}
}
Пример #7
0
static void
dvb_unregister(struct dvb_struct * dvb)
{
	if (!dvb->registered)
		return;

	if (dvb->dvb_net)
		dvb->dvb_net->dvb_net_release(dvb->dvb_net);

	DmxDevRelease(&dvb->dmxdev);
	dvb_unregister_device(&dvb->dvb_dev);
}
Пример #8
0
int dvb_register_frontend(struct dvb_adapter* dvb,
			  struct dvb_frontend* fe)
{
	static const struct dvb_device dvbdev_template = {
		.users = ~0,
		.writers = 1,
		.readers = (~0)-1,
		.fops = &dvb_frontend_fops,
		.kernel_ioctl = dvb_frontend_ioctl
	};

	dprintk ("%s\n", __FUNCTION__);

	if (down_interruptible (&frontend_mutex))
		return -ERESTARTSYS;

	sema_init (&fe->sem, 1);
	init_waitqueue_head (&fe->wait_queue);
	init_waitqueue_head (&fe->events.wait_queue);
	sema_init (&fe->events.sem, 1);
	fe->events.eventw = fe->events.eventr = 0;
	fe->events.overflow = 0;
	fe->dvb = dvb;
	fe->inversion = INVERSION_OFF;

	printk ("DVB: registering frontend %i (%s)...\n",
		fe->dvb->num,
		fe->ops->info.name);

	dvb_register_device (fe->dvb, &fe->dvbdev, &dvbdev_template,
			     fe, DVB_DEVICE_FRONTEND);

	up (&frontend_mutex);
	return 0;
}
EXPORT_SYMBOL(dvb_register_frontend);

int dvb_unregister_frontend(struct dvb_frontend* fe)
{
	dprintk ("%s\n", __FUNCTION__);

	down (&frontend_mutex);
			dvb_unregister_device (fe->dvbdev);
			dvb_frontend_stop (fe);
	if (fe->ops->release)
		fe->ops->release(fe);
	else
		printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops->info.name);
	up (&frontend_mutex);
	return 0;
}
Пример #9
0
void av7110_ca_unregister(struct av7110 *av7110)
{
	dvb_unregister_device(av7110->ca_dev);
}
Пример #10
0
void fdtv_ca_release(struct firedtv *fdtv)
{
	if (fdtv->cadev)
		dvb_unregister_device(fdtv->cadev);
}
Пример #11
0
/*static*/ int __init StmLoadModule(void)
{
	int Result;
	int i;
	short int AdapterNumbers[] = { -1 };
	DvbContext = kzalloc(sizeof(struct DvbContext_s), GFP_KERNEL);
	if (DvbContext == NULL)
	{
		DVB_ERROR("Unable to allocate device memory\n");
		return -ENOMEM;
	}
#ifdef __TDT__
	memset(DvbContext, 0, sizeof * DvbContext);
#endif
#ifdef __TDT__
	if (swts)
		printk("swts ->routing streams from dvr0 to tsm to pti to player\n");
	else
		printk("no swts ->routing streams from dvr0 direct to the player\n");
#endif
#if DVB_API_VERSION < 5
	Result = dvb_register_adapter(&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE, NULL);
#else
	Result = dvb_register_adapter(&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE, NULL, AdapterNumbers);
#endif
	if (Result < 0)
	{
		DVB_ERROR("Failed to register adapter (%d)\n", Result);
		kfree(DvbContext);
		DvbContext = NULL;
		return -ENOMEM;
	}
	mutex_init(&(DvbContext->Lock));
	mutex_lock(&(DvbContext->Lock));
	/*{{{  Register devices*/
	for (i = 0; i < DVB_MAX_DEVICES_PER_ADAPTER; i++)
	{
		struct DeviceContext_s* DeviceContext   = &DvbContext->DeviceContext[i];
		struct dvb_demux*       DvbDemux        = &DeviceContext->DvbDemux;
		struct dmxdev*          DmxDevice       = &DeviceContext->DmxDevice;
		struct dvb_device*      DvrDevice;
#ifdef __TDT__
		//sylvester: wenn der stream vom user kommt soll WriteToDecoder nix
		//tun, da das ja hier schon passiert. keine ahnung wie man das ansonsten
		//verhindern soll;-)
		DeviceContext->dvr_write = 0;
#endif
		DeviceContext->DvbContext = DvbContext;
#if defined (USE_KERNEL_DEMUX)
		memset(DvbDemux, 0, sizeof(struct dvb_demux));
#ifdef __TDT__
		DvbDemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING | DMX_TS_DESCRAMBLING;
		/* currently only dummy to avoid EINVAL error. Later we need it for second frontend ?! */
		DvbDemux->dmx.set_source = SetSource;
#else
		DvbDemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING;
#endif
		DvbDemux->priv = DeviceContext;
		DvbDemux->filternum = 32;
		DvbDemux->feednum = 32;
		DvbDemux->start_feed = StartFeed;
		DvbDemux->stop_feed = StopFeed;
#ifdef __TDT__
		DvbDemux->write_to_decoder = WriteToDecoder;
#else
		DvbDemux->write_to_decoder = NULL;
#endif
		Result = dvb_dmx_init(DvbDemux);
		if (Result < 0)
		{
			DVB_ERROR("dvb_dmx_init failed (errno = %d)\n", Result);
			return Result;
		}
		memset(DmxDevice, 0, sizeof(struct dmxdev));
		DmxDevice->filternum = DvbDemux->filternum;
		DmxDevice->demux = &DvbDemux->dmx;
		DmxDevice->capabilities = 0;
		Result = dvb_dmxdev_init(DmxDevice, &DvbContext->DvbAdapter);
		if (Result < 0)
		{
			DVB_ERROR("dvb_dmxdev_init failed (errno = %d)\n", Result);
			dvb_dmx_release(DvbDemux);
			return Result;
		}
		DvrDevice = DvrInit(DmxDevice->dvr_dvbdev->fops);
#ifdef __TDT__
		printk("%d: DeviceContext %p, DvbDemux %p, DmxDevice %p\n", i, DeviceContext, DvbDemux, DmxDevice);
#endif
		/* Unregister the built-in dvr device and replace it with our own version */
		dvb_unregister_device(DmxDevice->dvr_dvbdev);
		dvb_register_device(&DvbContext->DvbAdapter,
							&DmxDevice->dvr_dvbdev,
							DvrDevice, DmxDevice, DVB_DEVICE_DVR);
		DeviceContext->MemoryFrontend.source = DMX_MEMORY_FE;
		Result = DvbDemux->dmx.add_frontend(&DvbDemux->dmx, &DeviceContext->MemoryFrontend);
		if (Result < 0)
		{
			DVB_ERROR("add_frontend failed (errno = %d)\n", Result);
			dvb_dmxdev_release(DmxDevice);
			dvb_dmx_release(DvbDemux);
			return Result;
		}
#else
		dvb_register_device(&DvbContext->DvbAdapter,
							&DeviceContext->DemuxDevice,
							DemuxInit(DeviceContext),
							DeviceContext, DVB_DEVICE_DEMUX);
		dvb_register_device(&DvbContext->DvbAdapter,
							&DeviceContext->DvrDevice,
							DvrInit(DeviceContext),
							DeviceContext, DVB_DEVICE_DVR);
#endif
		dvb_register_device(&DvbContext->DvbAdapter,
							&DeviceContext->AudioDevice,
							AudioInit(DeviceContext),
							DeviceContext, DVB_DEVICE_AUDIO);
#ifdef __TDT__
		/* register the CA device (e.g. CIMAX) */
		if (i < 3)
#ifndef VIP2_V1
			dvb_register_device(&DvbContext->DvbAdapter,
								&DeviceContext->CaDevice,
								CaInit(DeviceContext),
								DeviceContext, DVB_DEVICE_CA);
#endif
#else
		dvb_register_device(&DvbContext->DvbAdapter,
							&DeviceContext->CaDevice,
							CaInit(DeviceContext),
							DeviceContext, DVB_DEVICE_CA);
#endif
		dvb_register_device(&DvbContext->DvbAdapter,
							&DeviceContext->VideoDevice,
							VideoInit(DeviceContext),
							DeviceContext, DVB_DEVICE_VIDEO);
		DeviceContext->Id                       = i;
		DeviceContext->numRunningFeeds          = 0;
		DeviceContext->DemuxContext             = DeviceContext;        /* wire directly to own demux by default */
		DeviceContext->SyncContext              = DeviceContext;        /* we are our own sync group by default */
		DeviceContext->Playback                 = NULL;
		DeviceContext->StreamType               = STREAM_TYPE_TRANSPORT;
		DeviceContext->DvbContext               = DvbContext;
		DeviceContext->DemuxStream              = NULL;
		DeviceContext->VideoStream              = NULL;
		DeviceContext->AudioStream              = NULL;
		DeviceContext->PlaySpeed                = DVB_SPEED_NORMAL_PLAY;
		DeviceContext->dvr_in                   = kmalloc(65536, GFP_KERNEL); // 128Kbytes is quite a lot per device.
		DeviceContext->dvr_out                  = kmalloc(65536, GFP_KERNEL); // However allocating on each write is expensive.
		DeviceContext->EncryptionOn             = 0;
#ifdef __TDT__
		DeviceContext->VideoPlaySpeed           = DVB_SPEED_NORMAL_PLAY;
		DeviceContext->provideToDecoder         = 0;
		DeviceContext->feedPesType              = 0;
		mutex_init(&DeviceContext->injectMutex);
		if (i < 4)
		{
			ptiInit(DeviceContext);
		}
		if (i < 1)
		{
			init_e2_proc(DeviceContext);
		}
#endif
	}
	mutex_unlock(&(DvbContext->Lock));
	DvbBackendInit();
#ifndef __TDT__
#if defined (CONFIG_CPU_SUBTYPE_STX7105) // || defined (CONFIG_CPU_SUBTYPE_STX7200)
	cap_init();
#endif
#endif
	linuxdvb_v4l2_init();
	DVB_DEBUG("STM stream device loaded\n");
	return 0;
}