Exemplo n.º 1
0
/*{{{  AudioRelease*/
static int AudioRelease (struct inode*  Inode,
                         struct file*   File)
{
    struct dvb_device*          DvbDevice       = (struct dvb_device*)File->private_data;
    struct DeviceContext_s*     Context         = (struct DeviceContext_s*)DvbDevice->priv;
    struct DvbContext_s*        DvbContext      = Context->DvbContext;

    DVB_DEBUG("\n");

    if ((File->f_flags & O_ACCMODE) != O_RDONLY)
    {
        mutex_lock (&(DvbContext->Lock));
        if (Context->AudioStream != NULL)
        {
            unsigned int    MutexIsLocked   = true;
            /* Discard previously injected data to free the lock. */
            StreamDrain (Context->AudioStream, true);

            if (mutex_lock_interruptible (Context->ActiveAudioWriteLock) != 0)
                MutexIsLocked       = false;

            PlaybackRemoveStream (Context->Playback, Context->AudioStream);
            Context->AudioStream    = NULL;

            if (MutexIsLocked)
                mutex_unlock (Context->ActiveAudioWriteLock);
        }

        DisplayDelete (BACKEND_AUDIO_ID, Context->Id);

        /* Check to see if video and demux have also finished so we can release the playback */
        if ((Context->VideoStream == NULL) && (Context->DemuxStream == NULL) && (Context->Playback != NULL))
        {
            /* Check to see if our playback has already been deleted by the demux context */
            if (Context->DemuxContext->Playback != NULL)
            {
                /* Try and delete playback then set our demux to Null if succesful or not.  If we fail someone else
                   is still using it but we are done. */
                if (PlaybackDelete (Context->Playback) == 0)
                    DVB_DEBUG("Playback deleted successfully\n");
            }
            Context->Playback               = NULL;
            Context->StreamType             = STREAM_TYPE_TRANSPORT;
            Context->PlaySpeed              = DVB_SPEED_NORMAL_PLAY;
            Context->PlayInterval.start     = DVB_TIME_NOT_BOUNDED;
            Context->PlayInterval.end       = DVB_TIME_NOT_BOUNDED;
            Context->SyncContext            = Context;
        }

        AudioInit (Context);

        mutex_unlock (&(DvbContext->Lock));
    }
    return dvb_generic_release (Inode, File);
}
Exemplo n.º 2
0
static int video_release(struct inode *inode, struct file *file)
{
	struct dvb_device *dvbdev = file->private_data;
	struct ngene_channel *chan = dvbdev->priv;
	struct ngene *dev = chan->dev;
	struct ngene_channel *chan0 = &chan->dev->channel[0];

	ngene_command_stream_control(dev, 0, 0, 0, 0);
	chan0->pBufferExchange = 0;

	return dvb_generic_release(inode, file);
}
Exemplo n.º 3
0
static int dvb_frontend_release (struct inode *inode, struct file *file)
{
	struct dvb_device *dvbdev = file->private_data;
	struct dvb_frontend *fe = dvbdev->priv;

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

	if ((file->f_flags & O_ACCMODE) != O_RDONLY)
		fe->release_jiffies = jiffies;

	return dvb_generic_release (inode, file);
}
Exemplo n.º 4
0
static int dvb_frontend_open (struct inode *inode, struct file *file)
{
	struct dvb_device *dvbdev = file->private_data;
	struct dvb_frontend *fe = dvbdev->priv;
	int ret;

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

	if ((ret = dvb_generic_open (inode, file)) < 0)
		return ret;

	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
		ret = dvb_frontend_start (fe);
		if (ret)
			dvb_generic_release (inode, file);

		/*  empty event queue */
		fe->events.eventr = fe->events.eventw = 0;
	}
	
	return ret;
}