• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/usb/gadget/

Lines Matching refs:video

30 uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf,
34 data[1] = UVC_STREAM_EOH | video->fid;
36 if (buf->buf.bytesused - video->queue.buf_used <= len - 2)
43 uvc_video_encode_data(struct uvc_video *video, struct uvc_buffer *buf,
46 struct uvc_video_queue *queue = &video->queue;
50 /* Copy video data to the USB buffer. */
61 uvc_video_encode_bulk(struct usb_request *req, struct uvc_video *video,
65 int len = video->req_size;
69 if (video->payload_size == 0) {
70 ret = uvc_video_encode_header(video, buf, mem, len);
71 video->payload_size += ret;
76 /* Process video data. */
77 len = min((int)(video->max_payload_size - video->payload_size), len);
78 ret = uvc_video_encode_data(video, buf, mem, len);
80 video->payload_size += ret;
83 req->length = video->req_size - len;
84 req->zero = video->payload_size == video->max_payload_size;
86 if (buf->buf.bytesused == video->queue.buf_used) {
87 video->queue.buf_used = 0;
89 uvc_queue_next_buffer(&video->queue, buf);
90 video->fid ^= UVC_STREAM_FID;
92 video->payload_size = 0;
95 if (video->payload_size == video->max_payload_size ||
96 buf->buf.bytesused == video->queue.buf_used)
97 video->payload_size = 0;
101 uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video,
105 int len = video->req_size;
109 ret = uvc_video_encode_header(video, buf, mem, len);
113 /* Process video data. */
114 ret = uvc_video_encode_data(video, buf, mem, len);
117 req->length = video->req_size - len;
119 if (buf->buf.bytesused == video->queue.buf_used) {
120 video->queue.buf_used = 0;
122 uvc_queue_next_buffer(&video->queue, buf);
123 video->fid ^= UVC_STREAM_FID;
136 * if a video buffer is available.
139 * the handler will start streaming if a video buffer is available and if
140 * video is not currently streaming.
142 * - V4L2 buffer queueing: the driver will start streaming if video is not
148 * The "video currently streaming" condition can't be detected by the irqqueue
159 * handler will restart the video stream.
164 struct uvc_video *video = req->context;
183 spin_lock_irqsave(&video->queue.irqlock, flags);
184 buf = uvc_queue_head(&video->queue);
186 spin_unlock_irqrestore(&video->queue.irqlock, flags);
190 video->encode(req, video, buf);
195 spin_unlock_irqrestore(&video->queue.irqlock, flags);
198 spin_unlock_irqrestore(&video->queue.irqlock, flags);
203 spin_lock_irqsave(&video->req_lock, flags);
204 list_add_tail(&req->list, &video->req_free);
205 spin_unlock_irqrestore(&video->req_lock, flags);
209 uvc_video_free_requests(struct uvc_video *video)
214 if (video->req[i]) {
215 usb_ep_free_request(video->ep, video->req[i]);
216 video->req[i] = NULL;
219 if (video->req_buffer[i]) {
220 kfree(video->req_buffer[i]);
221 video->req_buffer[i] = NULL;
225 INIT_LIST_HEAD(&video->req_free);
226 video->req_size = 0;
231 uvc_video_alloc_requests(struct uvc_video *video)
236 BUG_ON(video->req_size);
239 video->req_buffer[i] = kmalloc(video->ep->maxpacket, GFP_KERNEL);
240 if (video->req_buffer[i] == NULL)
243 video->req[i] = usb_ep_alloc_request(video->ep, GFP_KERNEL);
244 if (video->req[i] == NULL)
247 video->req[i]->buf = video->req_buffer[i];
248 video->req[i]->length = 0;
249 video->req[i]->dma = DMA_ADDR_INVALID;
250 video->req[i]->complete = uvc_video_complete;
251 video->req[i]->context = video;
253 list_add_tail(&video->req[i]->list, &video->req_free);
256 video->req_size = video->ep->maxpacket;
260 uvc_video_free_requests(video);
269 * uvc_video_pump - Pump video data into the USB requests
272 * video data from the queued buffers.
275 uvc_video_pump(struct uvc_video *video)
287 spin_lock_irqsave(&video->req_lock, flags);
288 if (list_empty(&video->req_free)) {
289 spin_unlock_irqrestore(&video->req_lock, flags);
292 req = list_first_entry(&video->req_free, struct usb_request,
295 spin_unlock_irqrestore(&video->req_lock, flags);
297 /* Retrieve the first available video buffer and fill the
298 * request, protected by the video queue irqlock.
300 spin_lock_irqsave(&video->queue.irqlock, flags);
301 buf = uvc_queue_head(&video->queue);
303 spin_unlock_irqrestore(&video->queue.irqlock, flags);
307 video->encode(req, video, buf);
310 if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
312 usb_ep_set_halt(video->ep);
313 spin_unlock_irqrestore(&video->queue.irqlock, flags);
316 spin_unlock_irqrestore(&video->queue.irqlock, flags);
319 spin_lock_irqsave(&video->req_lock, flags);
320 list_add_tail(&req->list, &video->req_free);
321 spin_unlock_irqrestore(&video->req_lock, flags);
326 * Enable or disable the video stream.
329 uvc_video_enable(struct uvc_video *video, int enable)
334 if (video->ep == NULL) {
342 usb_ep_dequeue(video->ep, video->req[i]);
344 uvc_video_free_requests(video);
345 uvc_queue_enable(&video->queue, 0);
349 if ((ret = uvc_queue_enable(&video->queue, 1)) < 0)
352 if ((ret = uvc_video_alloc_requests(video)) < 0)
355 if (video->max_payload_size) {
356 video->encode = uvc_video_encode_bulk;
357 video->payload_size = 0;
359 video->encode = uvc_video_encode_isoc;
361 return uvc_video_pump(video);
365 * Initialize the UVC video stream.
368 uvc_video_init(struct uvc_video *video)
370 INIT_LIST_HEAD(&video->req_free);
371 spin_lock_init(&video->req_lock);
373 video->fcc = V4L2_PIX_FMT_YUYV;
374 video->bpp = 16;
375 video->width = 320;
376 video->height = 240;
377 video->imagesize = 320 * 240 * 2;
379 /* Initialize the video buffers queue. */
380 uvc_queue_init(&video->queue, V4L2_BUF_TYPE_VIDEO_OUTPUT);