forked from tTh/FloatImg
		
	a few debug tools
This commit is contained in:
		
							parent
							
								
									18a5a5229f
								
							
						
					
					
						commit
						56d46d44d9
					
				@ -5,12 +5,15 @@ DEPS = ../floatimg.h  ../libfloatimg.a Makefile
 | 
			
		||||
 | 
			
		||||
all:	grabvidseq t
 | 
			
		||||
 | 
			
		||||
t:	t.c Makefile ${DEPS} funcs.o
 | 
			
		||||
	gcc ${COPT} $< funcs.o ../libfloatimg.a -o $@
 | 
			
		||||
t:	t.c Makefile ${DEPS} funcs.o v4l2_pr_structs.o
 | 
			
		||||
	gcc ${COPT} $< funcs.o v4l2_pr_structs.o ../libfloatimg.a -o $@
 | 
			
		||||
 | 
			
		||||
funcs.o:	funcs.c funcs.h Makefile
 | 
			
		||||
	gcc ${COPT} -c $<
 | 
			
		||||
 | 
			
		||||
v4l2_pr_structs.o:	v4l2_pr_structs.c v4l2_pr_structs.h Makefile
 | 
			
		||||
	gcc ${COPT} -c $<
 | 
			
		||||
 | 
			
		||||
#		---------------
 | 
			
		||||
#		external things
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								v4l2/t.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								v4l2/t.c
									
									
									
									
									
								
							@ -8,27 +8,49 @@
 | 
			
		||||
#include  <math.h>
 | 
			
		||||
#include  <string.h>
 | 
			
		||||
 | 
			
		||||
#include <linux/videodev2.h>
 | 
			
		||||
 | 
			
		||||
#include  "funcs.h"
 | 
			
		||||
#include  "../floatimg.h"
 | 
			
		||||
 | 
			
		||||
#include  "v4l2_pr_structs.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int		verbosity;
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int essai(char *dev, int k)
 | 
			
		||||
{
 | 
			
		||||
int	vfd, foo;
 | 
			
		||||
int			vfd, foo;
 | 
			
		||||
struct v4l2_format	fmt;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
 | 
			
		||||
 | 
			
		||||
vfd = open_device(dev);
 | 
			
		||||
fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
 | 
			
		||||
 | 
			
		||||
foo = init_device(0);
 | 
			
		||||
fprintf(stderr, "\tinit -> %d\n", foo);
 | 
			
		||||
memset(&fmt, 0, sizeof(fmt));
 | 
			
		||||
pr_v4l2_format("after 0", &fmt);
 | 
			
		||||
 | 
			
		||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 | 
			
		||||
fmt.fmt.pix.width       = 640;
 | 
			
		||||
fmt.fmt.pix.height      = 480;
 | 
			
		||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24;
 | 
			
		||||
fmt.fmt.pix.field       = V4L2_FIELD_INTERLACED;
 | 
			
		||||
 | 
			
		||||
pr_v4l2_format("before ioctl", &fmt);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return k;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int liste_des_devices(int K)
 | 
			
		||||
{
 | 
			
		||||
fprintf(stderr, "%s not implemented\n", __func__);
 | 
			
		||||
return -1;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
void help(int k)
 | 
			
		||||
{
 | 
			
		||||
puts("Options :");
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										64
									
								
								v4l2/v4l2_pr_structs.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								v4l2/v4l2_pr_structs.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,64 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	fonctions pour afficher les structures de V4L2
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include  <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include  <linux/videodev2.h>
 | 
			
		||||
 | 
			
		||||
#include  "v4l2_pr_structs.h"
 | 
			
		||||
 | 
			
		||||
#define		FP	(stdout)
 | 
			
		||||
 | 
			
		||||
extern int	verbosity;
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
static char *fmttype2str(int type)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
switch(type) {
 | 
			
		||||
	case 0:		return "[zero]";
 | 
			
		||||
	case 1:		return "video capture";
 | 
			
		||||
	case 2:		return "video output";
 | 
			
		||||
 | 
			
		||||
	case 13:	return "META capture";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
return "???";
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int pr_v4l2_format(char *txt, struct v4l2_format *ptr)
 | 
			
		||||
{
 | 
			
		||||
fprintf(FP, "-- v4l2_format, %-15s  %p\n", txt, ptr);
 | 
			
		||||
fprintf(FP, "   type %d   %s\n", ptr->type,/* enum v4l2_buf_type */
 | 
			
		||||
			fmttype2str(ptr->type));		
 | 
			
		||||
 | 
			
		||||
switch(ptr->type) {
 | 
			
		||||
 | 
			
		||||
	case 1:		// fputs("   Capture\n", FP);
 | 
			
		||||
			fprintf(FP, "   dims     %dx%d\n",
 | 
			
		||||
					ptr->fmt.pix.width,
 | 
			
		||||
					ptr->fmt.pix.height);
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
	default:	fputs("   ???\n", FP);		break;
 | 
			
		||||
	
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
fputs(".\n", FP);
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr)
 | 
			
		||||
{
 | 
			
		||||
fprintf(FP, "-- v4l2_requestbuffers, at %p\n", ptr);
 | 
			
		||||
fprintf(FP, "   type %d\n", ptr->type);		/* enum v4l2_buf_type */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								v4l2/v4l2_pr_structs.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								v4l2/v4l2_pr_structs.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	fonctions pour afficher les structures de V4L2
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int pr_v4l2_format(char *txt, struct v4l2_format *ptr);
 | 
			
		||||
int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr);
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user