Permalink
Browse files

Created Video Recorder plug-in which included Camera capture, (option…

…al scale & preview on LCD) and video encode.
  • Loading branch information...
1 parent 72c6103 commit 65de91dbb601cc749bb1e01c3ca0ea78c49323fa Takashi Namiki committed with Aug 28, 2009
Showing with 38 additions and 8 deletions.
  1. +11 −1 Makefile.am
  2. +5 −0 README
  3. +22 −7 cntlfile/capture.h
View
@@ -1,4 +1,4 @@
-plugin_LTLIBRARIES = libgstshvideodec.la libgstshvideodec2.la libgstshvideoenc.la
+plugin_LTLIBRARIES = libgstshvideodec.la libgstshvideodec2.la libgstshvideoenc.la libgstshvideoenc2.la
EXTRA_DIST = \
depcomp autogen.sh
@@ -8,6 +8,7 @@ ACLOCAL_AMFLAGS = -I common/m4
libgstshvideodec_la_SOURCES = gstshvideodec.c
libgstshvideodec2_la_SOURCES = gstshvideodec2.c
libgstshvideoenc_la_SOURCES = gstshvideoenc.c cntlfile/ControlFileUtil.c
+libgstshvideoenc2_la_SOURCES = gstshvideoenc2.c cntlfile/ControlFileUtil.c cntlfile/capture.c
libgstshvideodec_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
$(LIBSHCODECS_CFLAGS)
@@ -35,6 +36,15 @@ libgstshvideoenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -O2 -lrt \
-lgstvideo-0.10 -lz -lstdc++ -lgstinterfaces-0.10 -lshcodecs
libgstshvideoenc_la_LIBTOOLFLAGS = --tag=disable-static
+
+libgstshvideoenc2_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+ $(LIBSHCODECS_CFLAGS)
+libgstshvideoenc2_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
+ $(LIBSHCODECS_LIBS)
+libgstshvideoenc2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -O2 -lrt \
+ -lgstvideo-0.10 -lz -lstdc++ -lgstinterfaces-0.10 -lshcodecs -lshveu
+libgstshvideoenc2_la_LIBTOOLFLAGS = --tag=disable-static
+
noinst_HEADERS =
check-valgrind:
View
@@ -23,6 +23,11 @@ Encode file to file:
$ gst-launch filesrc location=source_video_to_encode ! gst-sh-mobile-enc \
cntl_file=encoder_control_file.ctl ! filesink location=encoded_video_file
+Encode camera to file with LCD preview:
+
+$gst-launch -v gst-sh-mobile-camera-enc cntl_file=k264-v4l2.ctl preview=1\
+ ! video/x-h264,width=640,height=480,framerate=30/1 ! filesink location=encoded_video.h264
+
Decode a file and playback on the screen:
$ gst-launch filesrc location=video_file.avi ! avidemux name=demux \
View
@@ -17,24 +17,39 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
*/
+
#ifndef __CAPTURE_H__
#define __CAPTURE_H__
-typedef void *sh_ceu;
-typedef void (*sh_process_callback) (sh_ceu * ceu, const unsigned char *frame_data,
- size_t length, void *user_data);
+typedef enum {
+ IO_METHOD_READ,
+ IO_METHOD_MMAP,
+ IO_METHOD_USERPTR,
+} io_method;
+
+typedef struct _sh_ceu {
+ const char * dev_name;
+ int fd;
+ io_method io;
+ struct buffer * buffers;
+ unsigned int n_buffers;
+ int width;
+ int height;
+ unsigned int pixel_format;
+} sh_ceu;
+
+typedef void (*sh_process_callback) (sh_ceu * ceu, const void * frame_data, size_t length, void * user_data, int buffer_number);
-sh_ceu *sh_ceu_open(const char *device_name, int width, int height);
+sh_ceu * sh_ceu_open (const char * device_name, int width, int height, io_method io);
void sh_ceu_close(sh_ceu * ceu);
void sh_ceu_start_capturing(sh_ceu * ceu);
void sh_ceu_stop_capturing(sh_ceu * ceu);
-void sh_ceu_capture_frame(sh_ceu * ceu, sh_process_callback cb,
- void *user_data);
+void sh_ceu_capture_frame(sh_ceu * ceu, sh_process_callback cb, void * user_data);
unsigned int sh_ceu_get_pixel_format(sh_ceu * ceu);
-#endif /* __CAPTURE_H__ */
+#endif /* __CAPTURE_H__ */

0 comments on commit 65de91d

Please sign in to comment.