lunes, 14 de diciembre de 2009
uvc_video_suspend
Ahora vamos a estudiar uvc_video_suspend:
/* --------------------------------------------------------------------------
* Suspend/resume
*/
/*
* Stop streaming without disabling the video queue.
*
* To let userspace applications resume without trouble, we must not touch the
* video buffers in any way. We mark the device as frozen to make sure the URB
* completion handler won't try to cancel the queue when we kill the URBs.
*/
int uvc_video_suspend(struct uvc_streaming *stream)
{
if (!uvc_queue_streaming(&stream->queue))
return 0;
stream->frozen = 1;
uvc_uninit_video(stream, 0);
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
return 0;
}
Ahora voy a ir comentándolo para hacerlo más legible:
/* --------------------------------------------------------------------------
* Suspend/resume
*/
/**
* uvc_video_suspend - Stop streaming without disabling the video queue.
* @stream: the stream that will be suspended
*
* To let userspace applications resume without trouble, we must not touch the
* video buffers in any way. We mark the device as frozen to make sure the URB
* completion handler won't try to cancel the queue when we kill the URBs.
*/
int uvc_video_suspend(struct uvc_streaming *stream)
{
if (!uvc_queue_streaming(&stream->queue)) // if queue is STREAMING
return 0;
stream->frozen = 1; // uvc_video_device knowns if it's frozen or not
uvc_uninit_video(stream, 0); // it will kill all URBs and free them
// it will alternate to the 0 alternative setting
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
return 0;
}
No es muy complejo, pero es curioso que exista una alternativa de configuración número 0 que se use en este caso.
Etiquetas:
Alternativa de Configuración,
Desinicializar Vídeo,
Dispositivo Suspendido,
Flujo de Vídeo,
Frozen,
Pausar,
Pausar Dispositivo,
Pausar Vídeo,
Suspender,
Suspender Dispositivo,
Suspender Vídeo
Publicado por
Palmax
en
14:24
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario