• Home
  • Raw
  • Download

Lines Matching refs:s

47 	struct ivtv_stream *s = &itv->streams[type];  in ivtv_claim_stream()  local
51 if (test_and_set_bit(IVTV_F_S_CLAIMED, &s->s_flags)) { in ivtv_claim_stream()
53 if (s->fh == &id->fh) { in ivtv_claim_stream()
57 if (s->fh == NULL && (type == IVTV_DEC_STREAM_TYPE_VBI || in ivtv_claim_stream()
62 s->fh = &id->fh; in ivtv_claim_stream()
70 s->fh = &id->fh; in ivtv_claim_stream()
103 void ivtv_release_stream(struct ivtv_stream *s) in ivtv_release_stream() argument
105 struct ivtv *itv = s->itv; in ivtv_release_stream()
108 s->fh = NULL; in ivtv_release_stream()
109 if ((s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type == IVTV_ENC_STREAM_TYPE_VBI) && in ivtv_release_stream()
110 test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { in ivtv_release_stream()
114 if (!test_and_clear_bit(IVTV_F_S_CLAIMED, &s->s_flags)) { in ivtv_release_stream()
115 IVTV_DEBUG_WARN("Release stream %s not in use!\n", s->name); in ivtv_release_stream()
119 ivtv_flush_queues(s); in ivtv_release_stream()
122 if (s->type == IVTV_DEC_STREAM_TYPE_VBI) in ivtv_release_stream()
128 if (s->type == IVTV_DEC_STREAM_TYPE_MPG) in ivtv_release_stream()
130 else if (s->type == IVTV_ENC_STREAM_TYPE_MPG) in ivtv_release_stream()
205 static struct ivtv_buffer *ivtv_get_buffer(struct ivtv_stream *s, int non_block, int *err) in ivtv_get_buffer() argument
207 struct ivtv *itv = s->itv; in ivtv_get_buffer()
214 if (s->type == IVTV_ENC_STREAM_TYPE_MPG) { in ivtv_get_buffer()
240 buf = ivtv_dequeue(s, &s->q_io); in ivtv_get_buffer()
245 buf = ivtv_dequeue(s, &s->q_full); in ivtv_get_buffer()
250 if (s->type == IVTV_ENC_STREAM_TYPE_MPG) in ivtv_get_buffer()
253 else if (s->type != IVTV_DEC_STREAM_TYPE_VBI) { in ivtv_get_buffer()
255 ivtv_process_vbi_data(itv, buf, s->dma_pts, s->type); in ivtv_get_buffer()
261 if (s->type != IVTV_DEC_STREAM_TYPE_VBI && !test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { in ivtv_get_buffer()
262 IVTV_DEBUG_INFO("EOS %s\n", s->name); in ivtv_get_buffer()
274 prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE); in ivtv_get_buffer()
276 if (!s->q_full.buffers) in ivtv_get_buffer()
278 finish_wait(&s->waitq, &wait); in ivtv_get_buffer()
282 IVTV_DEBUG_INFO("User stopped %s\n", s->name); in ivtv_get_buffer()
298 static size_t ivtv_copy_buf_to_user(struct ivtv_stream *s, struct ivtv_buffer *buf, in ivtv_copy_buf_to_user() argument
301 struct ivtv *itv = s->itv; in ivtv_copy_buf_to_user()
305 if (itv->vbi.insert_mpeg && s->type == IVTV_ENC_STREAM_TYPE_MPG && in ivtv_copy_buf_to_user()
346 IVTV_DEBUG_WARN("copy %zd bytes to user failed for %s\n", len, s->name); in ivtv_copy_buf_to_user()
353 if (s->type == IVTV_ENC_STREAM_TYPE_MPG && buf != &itv->vbi.sliced_mpeg_buf) in ivtv_copy_buf_to_user()
358 static ssize_t ivtv_read(struct ivtv_stream *s, char __user *ubuf, size_t tot_count, int non_block) in ivtv_read() argument
360 struct ivtv *itv = s->itv; in ivtv_read()
364 if (atomic_read(&itv->capturing) == 0 && s->fh == NULL) { in ivtv_read()
366 IVTV_DEBUG_WARN("Stream %s not initialized before read\n", s->name); in ivtv_read()
372 if (s->type == IVTV_DEC_STREAM_TYPE_VBI || in ivtv_read()
373 (s->type == IVTV_ENC_STREAM_TYPE_VBI && !ivtv_raw_vbi(itv))) in ivtv_read()
380 buf = ivtv_get_buffer(s, non_block, &rc); in ivtv_read()
388 clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); in ivtv_read()
389 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_read()
390 ivtv_release_stream(s); in ivtv_read()
395 rc = ivtv_copy_buf_to_user(s, buf, ubuf + tot_written, tot_count - tot_written); in ivtv_read()
397 ivtv_enqueue(s, buf, (buf->readpos == buf->bytesused) ? &s->q_free : &s->q_io); in ivtv_read()
415 static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t count, in ivtv_read_pos() argument
418 ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0; in ivtv_read_pos()
419 struct ivtv *itv = s->itv; in ivtv_read_pos()
421 IVTV_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc); in ivtv_read_pos()
430 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_start_capture() local
433 if (s->type == IVTV_ENC_STREAM_TYPE_RAD || in ivtv_start_capture()
434 s->type == IVTV_DEC_STREAM_TYPE_MPG || in ivtv_start_capture()
435 s->type == IVTV_DEC_STREAM_TYPE_YUV || in ivtv_start_capture()
436 s->type == IVTV_DEC_STREAM_TYPE_VOUT) { in ivtv_start_capture()
442 if (ivtv_claim_stream(id, s->type)) in ivtv_start_capture()
446 if (s->type == IVTV_DEC_STREAM_TYPE_VBI) { in ivtv_start_capture()
447 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_start_capture()
453 …if (test_bit(IVTV_F_S_STREAMOFF, &s->s_flags) || test_and_set_bit(IVTV_F_S_STREAMING, &s->s_flags)… in ivtv_start_capture()
454 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_start_capture()
460 if (s->type == IVTV_ENC_STREAM_TYPE_MPG && in ivtv_start_capture()
471 clear_bit(IVTV_F_S_STREAMING, &s->s_flags); in ivtv_start_capture()
473 ivtv_release_stream(s); in ivtv_start_capture()
480 if (!ivtv_start_v4l2_encode_stream(s)) { in ivtv_start_capture()
482 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_start_capture()
490 IVTV_DEBUG_WARN("Failed to start capturing for stream %s\n", s->name); in ivtv_start_capture()
495 if (s->type == IVTV_ENC_STREAM_TYPE_MPG && in ivtv_start_capture()
500 clear_bit(IVTV_F_S_STREAMING, &s->s_flags); in ivtv_start_capture()
501 ivtv_release_stream(s); in ivtv_start_capture()
509 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_v4l2_read() local
512 IVTV_DEBUG_HI_FILE("read %zd bytes from %s\n", count, s->name); in ivtv_v4l2_read()
518 rc = ivtv_read_pos(s, buf, count, pos, filp->f_flags & O_NONBLOCK); in ivtv_v4l2_read()
526 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_start_decoding() local
530 if (ivtv_claim_stream(id, s->type)) { in ivtv_start_decoding()
535 rc = ivtv_start_v4l2_decode_stream(s, 0); in ivtv_start_decoding()
538 rc = ivtv_start_v4l2_decode_stream(s, 0); in ivtv_start_decoding()
543 if (s->type == IVTV_DEC_STREAM_TYPE_MPG) in ivtv_start_decoding()
552 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_write() local
561 IVTV_DEBUG_HI_FILE("write %zd bytes to %s\n", count, s->name); in ivtv_write()
563 if (s->type != IVTV_DEC_STREAM_TYPE_MPG && in ivtv_write()
564 s->type != IVTV_DEC_STREAM_TYPE_YUV && in ivtv_write()
565 s->type != IVTV_DEC_STREAM_TYPE_VOUT) in ivtv_write()
570 if (ivtv_claim_stream(id, s->type)) in ivtv_write()
574 if (s->type == IVTV_DEC_STREAM_TYPE_VOUT) { in ivtv_write()
577 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_write()
582 mode = s->type == IVTV_DEC_STREAM_TYPE_MPG ? OUT_MPG : OUT_YUV; in ivtv_write()
585 ivtv_release_stream(s); in ivtv_write()
589 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_write()
594 IVTV_DEBUG_WARN("Failed start decode stream %s\n", s->name); in ivtv_write()
597 clear_bit(IVTV_F_S_STREAMING, &s->s_flags); in ivtv_write()
598 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_write()
605 if (mode == OUT_YUV && s->q_full.length == 0 && itv->dma_data_req_size) { in ivtv_write()
617 IVTV_DEBUG_HI_FILE("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused); in ivtv_write()
624 while (q.length - q.bytesused < count && (buf = ivtv_dequeue(s, &s->q_io))) in ivtv_write()
625 ivtv_enqueue(s, buf, &q); in ivtv_write()
626 while (q.length - q.bytesused < count && (buf = ivtv_dequeue(s, &s->q_free))) { in ivtv_write()
627 ivtv_enqueue(s, buf, &q); in ivtv_write()
634 prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE); in ivtv_write()
636 if (!s->q_free.buffers) in ivtv_write()
638 finish_wait(&s->waitq, &wait); in ivtv_write()
641 IVTV_DEBUG_INFO("User stopped %s\n", s->name); in ivtv_write()
647 while ((buf = ivtv_dequeue(s, &q))) { in ivtv_write()
650 if (s->type == IVTV_DEC_STREAM_TYPE_YUV && in ivtv_write()
652 rc = ivtv_buf_copy_from_user(s, buf, user_buf, in ivtv_write()
655 rc = ivtv_buf_copy_from_user(s, buf, user_buf, count); in ivtv_write()
659 ivtv_queue_move(s, &q, NULL, &s->q_free, 0); in ivtv_write()
666 if (s->type == IVTV_DEC_STREAM_TYPE_YUV) { in ivtv_write()
670 ivtv_enqueue(s, buf, &s->q_full); in ivtv_write()
676 if (buf->bytesused != s->buf_size) { in ivtv_write()
678 ivtv_enqueue(s, buf, &s->q_io); in ivtv_write()
682 if (s->type == IVTV_DEC_STREAM_TYPE_MPG) in ivtv_write()
684 ivtv_enqueue(s, buf, &s->q_full); in ivtv_write()
687 if (test_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags)) { in ivtv_write()
688 if (s->q_full.length >= itv->dma_data_req_size) { in ivtv_write()
697 test_bit(IVTV_F_S_DMA_PENDING, &s->s_flags)) { in ivtv_write()
703 IVTV_DEBUG_INFO("User interrupted %s\n", s->name); in ivtv_write()
707 clear_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags); in ivtv_write()
708 ivtv_queue_move(s, &s->q_full, NULL, &s->q_predma, itv->dma_data_req_size); in ivtv_write()
709 ivtv_dma_stream_dec_prepare(s, itv->dma_data_req_offset + IVTV_DECODER_OFFSET, 1); in ivtv_write()
716 IVTV_DEBUG_HI_FILE("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused); in ivtv_write()
737 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_v4l2_dec_poll() local
754 poll_wait(filp, &s->waitq, wait); in ivtv_v4l2_dec_poll()
762 if (s->q_free.buffers) in ivtv_v4l2_dec_poll()
772 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_v4l2_enc_poll() local
773 int eof = test_bit(IVTV_F_S_STREAMOFF, &s->s_flags); in ivtv_v4l2_enc_poll()
777 if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) && in ivtv_v4l2_enc_poll()
778 s->type != IVTV_ENC_STREAM_TYPE_RAD && in ivtv_v4l2_enc_poll()
787 s->name, rc); in ivtv_v4l2_enc_poll()
795 poll_wait(filp, &s->waitq, wait); in ivtv_v4l2_enc_poll()
801 if (s->q_full.length || s->q_io.length) in ivtv_v4l2_enc_poll()
811 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_stop_capture() local
813 IVTV_DEBUG_FILE("close() of %s\n", s->name); in ivtv_stop_capture()
818 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { in ivtv_stop_capture()
832 test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { in ivtv_stop_capture()
834 s->fh = NULL; in ivtv_stop_capture()
837 ivtv_stop_v4l2_encode_stream(s, gop_end); in ivtv_stop_capture()
841 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_stop_capture()
842 clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); in ivtv_stop_capture()
843 ivtv_release_stream(s); in ivtv_stop_capture()
850 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_stop_decoding() local
852 IVTV_DEBUG_FILE("close() of %s\n", s->name); in ivtv_stop_decoding()
861 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { in ivtv_stop_decoding()
864 ivtv_stop_v4l2_decode_stream(s, flags, pts); in ivtv_stop_decoding()
867 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags); in ivtv_stop_decoding()
868 clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); in ivtv_stop_decoding()
875 ivtv_release_stream(s); in ivtv_stop_decoding()
883 struct ivtv_stream *s = &itv->streams[id->type]; in ivtv_v4l2_close() local
885 IVTV_DEBUG_FILE("close %s\n", s->name); in ivtv_v4l2_close()
918 if (s->fh != &id->fh) in ivtv_v4l2_close()
923 if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { in ivtv_v4l2_close()
946 struct ivtv_stream *s = video_get_drvdata(vdev); local
947 struct ivtv *itv = s->itv;
951 IVTV_DEBUG_FILE("open %s\n", s->name);
976 if (s->type == IVTV_DEC_STREAM_TYPE_MPG &&
980 if (s->type == IVTV_DEC_STREAM_TYPE_YUV &&
984 if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {
998 v4l2_fh_init(&item->fh, &s->vdev);
1000 item->type = s->type;
1034 if (s->type == IVTV_DEC_STREAM_TYPE_MPG) {
1036 } else if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {