[xiph-commits] r9128 - in trunk/dryice: . modules
arc at motherfish-iii.xiph.org
arc at motherfish-iii.xiph.org
Fri Apr 8 02:27:37 PDT 2005
Author: arc
Date: 2005-04-08 02:27:35 -0700 (Fri, 08 Apr 2005)
New Revision: 9128
Added:
trunk/dryice/modules/null_cam.c
Modified:
trunk/dryice/SConstruct
Log:
ok this is our first (apparently) working input module - the other is
mostly working but I've been frustrating by having bugs in multiple
places. once the null cam is working properly (encoding black theora
frames) I can work on getting the real camera input working.
Modified: trunk/dryice/SConstruct
===================================================================
--- trunk/dryice/SConstruct 2005-04-08 03:59:38 UTC (rev 9127)
+++ trunk/dryice/SConstruct 2005-04-08 09:27:35 UTC (rev 9128)
@@ -8,18 +8,23 @@
'libshout':{'libs':('shout',),
'headers':('shout/shout.h',)},
'v4l':{'headers':('linux/videodev.h',)},
- 'jpeg':{'libs':('jpeg',)}}
- # Broken, but should also: 'headers':('jpeglib.h',)
+ 'jpeg':{'libs':('jpeg',),
+ 'headers':('jpeglib.h',)}}
libs = []
cpppath = ['include']
-modules = ['v4l_jpeg']
-modulesrcs = {'v4l_jpeg':['modules/v4l_jpeg.c']}
-moduledeps = {'v4l_jpeg':('v4l', 'jpeg')}
-modulelibs = {'v4l_jpeg':[]}
+modules = ['null_cam', 'v4l_jpeg']
+modulesrcs = {'null_cam':['modules/null_cam.c'] ,
+ 'v4l_jpeg':['modules/v4l_jpeg.c']}
+moduledeps = {'null_cam':(),
+ 'v4l_jpeg':('v4l', 'jpeg')}
+modulelibs = {'null_cam':[],
+ 'v4l_jpeg':[]}
-# Shouldn't have to edit anything below this line
+#########################################################################
+# Shouldn't have to edit anything below this line #
+#########################################################################
def checkdeps(ds, l, checks):
for dep in ds :
@@ -79,7 +84,7 @@
def build():
Program('dryice', 'src/core.c', CPPPATH=cpppath, LIBS=libs)
for module in modules:
- Library(module, modulesrcs[module],
+ SharedLibrary('modules/'+module, modulesrcs[module],
CPPPATH=cpppath, LIBS=modulelibs[module])
env = Environment()
Added: trunk/dryice/modules/null_cam.c
===================================================================
--- trunk/dryice/modules/null_cam.c 2005-04-08 03:59:38 UTC (rev 9127)
+++ trunk/dryice/modules/null_cam.c 2005-04-08 09:27:35 UTC (rev 9128)
@@ -0,0 +1,78 @@
+/*
+ * null_cam.c, DryIce camera module which outputs only black frames
+ *
+ * Copyright (c) 2005 Arc Riley <arc at xiph.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * last mod: $Id: null_cam.c,v 1.2 2004/03/02 11:10:03 arc Exp $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include "dryice/dryice.h"
+
+typedef struct {
+ int frame_width;
+ int frame_height;
+ int frame_raten;
+ int frame_rated;
+ unsigned char *frame_buffer;
+} dryice_null_cam_state;
+
+static void *
+dryice_null_cam_init(dryice_video_params *dvp) {
+ int pixels;
+ dryice_null_cam_state *dncs;
+
+ dncs = malloc(sizeof(dryice_null_cam_state));
+ dncs->frame_width = dvp->frame_width;
+ dncs->frame_height = dvp->frame_height;
+ pixels = dncs->frame_width * dncs->frame_height;
+ dncs->frame_raten = dvp->framerate_numerator;
+ dncs->frame_rated = dvp->framerate_denominator;
+ dncs->frame_buffer = calloc ( sizeof(unsigned char), pixels * 1.5 );
+ return dncs;
+}
+
+int
+dryice_null_cam_get_params(dryice_null_cam_state *dncs,
+ dryice_video_params *dvp) {
+
+ dvp->frame_width = dncs->frame_width;
+ dvp->frame_height = dncs->frame_height;
+ dvp->framerate_numerator = dncs->frame_raten;
+ dvp->framerate_denominator = dncs->frame_rated;
+ return 1;
+}
+
+char *
+dryice_null_cam_get_frame(dryice_null_cam_state *dncs) {
+
+ return dncs->frame_buffer;
+}
+
+int
+dryice_null_cam_destroy(dryice_null_cam_state *dncs) {
+
+ free(dncs->frame_buffer);
+ free(dncs);
+ return 1;
+}
More information about the commits
mailing list