From d728b4a2fec9ae5f5baef90729376c8c36b34e49 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 24 Dec 2001 21:43:31 +0000 Subject: [PATCH] Minor updates Original commit message from CVS: Minor updates --- sys/v4l/Makefile.am | 21 ++++++++++----------- sys/v4l/README | 3 +-- sys/v4l/TODO | 3 --- sys/v4l/gstv4lmjpegsrc.c | 2 +- sys/v4l/gstv4lmjpegsrc.h | 2 +- sys/v4l/v4lmjpegsrc_calls.c | 10 +++++++--- sys/v4l/v4lmjpegsrc_calls.h | 31 +++++++++++++++++++++++-------- sys/v4l/v4lsrc_calls.c | 6 +++++- 8 files changed, 48 insertions(+), 30 deletions(-) diff --git a/sys/v4l/Makefile.am b/sys/v4l/Makefile.am index 914df99..7d7be08 100644 --- a/sys/v4l/Makefile.am +++ b/sys/v4l/Makefile.am @@ -1,8 +1,7 @@ filterdir = $(libdir)/gst filter_LTLIBRARIES = libv4lelement.la libv4lsrc.la \ - libv4lmjpegsrc.la -#libv4lmjpegsink.la + libv4lmjpegsrc.la libv4lmjpegsink.la libv4lelement_la_SOURCES = \ gstv4lelement.c \ @@ -26,15 +25,15 @@ libv4lmjpegsrc_la_LIBADD = \ libv4lmjpegsrc_la_CFLAGS = \ $(GST_CFLAGS) -#libv4lmjpegsink_la_SOURCED = \ -# gstv4lmjpegsink.c \ -# v4lmjpegsikn_calls.c -#libv4lmjpegsink_la_LIBADD = \ -# libv4lelement.la -#libv4lmjpegsink_la_CFLAGS = \ -# $(GST_CFLAGS) +libv4lmjpegsink_la_SOURCES = \ + gstv4lmjpegsink.c \ + v4lmjpegsink_calls.c +libv4lmjpegsink_la_LIBADD = \ + libv4lelement.la +libv4lmjpegsink_la_CFLAGS = \ + $(GST_CFLAGS) noinst_HEADERS = gstv4lelement.h v4l_calls.h \ gstv4lsrc.h v4lsrc_calls.h \ - gstv4lmjpegsrc.h v4lmjpegsrc_calls.h -#gstv4lmjpegsink.h v4lmjpegsink_calls.h + gstv4lmjpegsrc.h v4lmjpegsrc_calls.h \ + gstv4lmjpegsink.h v4lmjpegsink_calls.h diff --git a/sys/v4l/README b/sys/v4l/README index 59016db..275e18c 100644 --- a/sys/v4l/README +++ b/sys/v4l/README @@ -11,8 +11,7 @@ v4l_calls.[ch] \ \ v4lmjpegsrc_calls.[ch] \ v4lmjpegsink_calls.[ch] I.e., all the files on the right are child classes of -the v4lelement 'parent' on the left. mjpegsink is still -todo. +the v4lelement 'parent' on the left. * v4lelement handles generic v4l stuff (picture settings, audio, norm/input setting, open()/close()) diff --git a/sys/v4l/TODO b/sys/v4l/TODO index c6a24f1..b616d58 100644 --- a/sys/v4l/TODO +++ b/sys/v4l/TODO @@ -2,9 +2,6 @@ TODO list (short term): ======================= * v4lmjpegsrc: integrate input/norm autodetection * libgstrec: build (a library for video recording) -* v4lmjpegsink: build (based on liblavplay (mjpegtools) and MJPEG/V4L API) -* v4lsrc: threaded sync() (done?) -* v4lsrc: threaded wait-for-sync()-until-queue() (done?) TODO list (long term): ====================== diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c index eca922b..e15eb0d 100644 --- a/sys/v4l/gstv4lmjpegsrc.c +++ b/sys/v4l/gstv4lmjpegsrc.c @@ -187,7 +187,7 @@ gst_v4lmjpegsrc_init (GstV4lMjpegSrc *v4lmjpegsrc) v4lmjpegsrc->quality = 50; v4lmjpegsrc->numbufs = 64; - v4lmjpegsrc->bufsize = 256 * 1024; + v4lmjpegsrc->bufsize = 256; v4lmjpegsrc->init = TRUE; } diff --git a/sys/v4l/gstv4lmjpegsrc.h b/sys/v4l/gstv4lmjpegsrc.h index e05a58d..f250daa 100644 --- a/sys/v4l/gstv4lmjpegsrc.h +++ b/sys/v4l/gstv4lmjpegsrc.h @@ -68,7 +68,7 @@ struct _GstV4lMjpegSrc { gint quality; gint numbufs; - gint bufsize; + gint bufsize; /* in KB */ gboolean init; }; diff --git a/sys/v4l/v4lmjpegsrc_calls.c b/sys/v4l/v4lmjpegsrc_calls.c index 345ae8e..ddd738a 100644 --- a/sys/v4l/v4lmjpegsrc_calls.c +++ b/sys/v4l/v4lmjpegsrc_calls.c @@ -189,14 +189,14 @@ gst_v4lmjpegsrc_set_buffer (GstV4lMjpegSrc *v4lmjpegsrc, gint bufsize) { #ifdef DEBUG - fprintf(stderr, "V4LMJPEGSRC: gst_v4lmjpegsrc_set_buffer(), numbufs = %d, bufsize = %d\n", + fprintf(stderr, "V4LMJPEGSRC: gst_v4lmjpegsrc_set_buffer(), numbufs = %d, bufsize = %d KB\n", numbufs, bufsize); #endif GST_V4L_CHECK_OPEN(GST_V4LELEMENT(v4lmjpegsrc)); GST_V4L_CHECK_NOT_ACTIVE(GST_V4LELEMENT(v4lmjpegsrc)); - v4lmjpegsrc->breq.size = bufsize; + v4lmjpegsrc->breq.size = bufsize * 1024; v4lmjpegsrc->breq.count = numbufs; return TRUE; @@ -515,7 +515,11 @@ gst_v4lmjpegsrc_get_buffer (GstV4lMjpegSrc *v4lmjpegsrc, num); #endif - if (!GST_V4L_IS_ACTIVE(GST_V4LELEMENT(v4lmjpegsrc))) + if (!GST_V4L_IS_ACTIVE(GST_V4LELEMENT(v4lmjpegsrc)) || + !GST_V4L_IS_OPEN(GST_V4LELEMENT(v4lmjpegsrc))) + return NULL; + + if (num < 0 || num >= v4lmjpegsrc->breq.count) return NULL; return GST_V4LELEMENT(v4lmjpegsrc)->buffer+(v4lmjpegsrc->breq.size*num); diff --git a/sys/v4l/v4lmjpegsrc_calls.h b/sys/v4l/v4lmjpegsrc_calls.h index f8572e5..9b5919a 100644 --- a/sys/v4l/v4lmjpegsrc_calls.h +++ b/sys/v4l/v4lmjpegsrc_calls.h @@ -39,19 +39,34 @@ extern char *input_name[]; /* set input/norm (includes autodetection, norm = VIDEO_MODE_{PAL|NTSC|SECAM|AUTO}) */ -gboolean gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc, GstV4lMjpegInputType input, gint norm); +gboolean gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc, + GstV4lMjpegInputType input, + gint norm); /* frame grabbing/capture */ -gboolean gst_v4lmjpegsrc_set_buffer (GstV4lMjpegSrc *v4lmjpegsrc, gint numbufs, gint bufsize); -gboolean gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc *v4lmjpegsrc, gint decimation, gint quality); +gboolean gst_v4lmjpegsrc_set_buffer (GstV4lMjpegSrc *v4lmjpegsrc, + gint numbufs, + gint bufsize); +gboolean gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc *v4lmjpegsrc, + gint decimation, + gint quality); gboolean gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc *v4lmjpegsrc, - gint x_offset, gint y_offset, gint width, gint height, - gint h_decimation, gint v_decimation, gint quality); + gint x_offset, + gint y_offset, + gint width, + gint height, + gint h_decimation, + gint v_decimation, + gint quality); gboolean gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc *v4lmjpegsrc); gboolean gst_v4lmjpegsrc_capture_start (GstV4lMjpegSrc *v4lmjpegsrc); -gboolean gst_v4lmjpegsrc_grab_frame (GstV4lMjpegSrc *v4lmjpegsrc, gint *num, gint *size); -guint8 * gst_v4lmjpegsrc_get_buffer (GstV4lMjpegSrc *v4lmjpegsrc, gint num); -gboolean gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc *v4lmjpegsrc, gint num); +gboolean gst_v4lmjpegsrc_grab_frame (GstV4lMjpegSrc *v4lmjpegsrc, + gint *num, + gint *size); +guint8 * gst_v4lmjpegsrc_get_buffer (GstV4lMjpegSrc *v4lmjpegsrc, + gint num); +gboolean gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc *v4lmjpegsrc, + gint num); gboolean gst_v4lmjpegsrc_capture_stop (GstV4lMjpegSrc *v4lmjpegsrc); gboolean gst_v4lmjpegsrc_capture_deinit (GstV4lMjpegSrc *v4lmjpegsrc); diff --git a/sys/v4l/v4lsrc_calls.c b/sys/v4l/v4lsrc_calls.c index de7d1b9..0f3565f 100644 --- a/sys/v4l/v4lsrc_calls.c +++ b/sys/v4l/v4lsrc_calls.c @@ -386,7 +386,11 @@ gst_v4lsrc_get_buffer (GstV4lSrc *v4lsrc, gint num) num); #endif - if (!GST_V4L_IS_ACTIVE(GST_V4LELEMENT(v4lsrc))) + if (!GST_V4L_IS_ACTIVE(GST_V4LELEMENT(v4lsrc)) || + !GST_V4L_IS_OPEN(GST_V4LELEMENT(v4lsrc))) + return NULL; + + if (num < 0 || num >= v4lsrc->mbuf.frames) return NULL; return GST_V4LELEMENT(v4lsrc)->buffer+v4lsrc->mbuf.offsets[num]; -- 2.7.4