Skip to content

Commit

Permalink
[libuvc] split v4l2 and dshow
Browse files Browse the repository at this point in the history
  • Loading branch information
gozfree committed Mar 3, 2019
1 parent 10b54e5 commit 8e128ea
Show file tree
Hide file tree
Showing 6 changed files with 579 additions and 448 deletions.
2 changes: 1 addition & 1 deletion libuvc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TGT_LIB_SO = $(LIBNAME).so
TGT_LIB_SO_VER = $(TGT_LIB_SO).${VER}
TGT_UNIT_TEST = test_$(LIBNAME)

OBJS_LIB = $(LIBNAME).o
OBJS_LIB = $(LIBNAME).o v4l2.o
OBJS_UNIT_TEST = test_$(LIBNAME).o

###############################################################################
Expand Down
49 changes: 49 additions & 0 deletions libuvc/Makefile.nmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
###############################################################################
# common
###############################################################################
#ARCH: linux/pi/android/ios/win
LD = link
AR = lib
RM = del

###############################################################################
# target and object
###############################################################################
LIBNAME = libuvc
TGT_LIB_A = $(LIBNAME).lib
TGT_LIB_SO = $(LIBNAME).dll
TGT_UNIT_TEST = test_$(LIBNAME).exe

OBJS_LIB = $(LIBNAME).obj dshow.obj
OBJS_UNIT_TEST = test_$(LIBNAME).obj

###############################################################################
# cflags and ldflags
###############################################################################
CFLAGS = /Iinclude /I../libposix4win/ /I.
CFLAGS = $(CFLAGS) /Od /W3 /Zi

LDFLAGS = /LIBPATH:../libposix4win/ /LIBPATH:./

###############################################################################
# target
###############################################################################
TGT = $(TGT_LIB_A) $(TGT_LIB_SO) $(TGT_UNIT_TEST)

OBJS = $(OBJS_LIB) $(OBJS_UNIT_TEST)

all: $(TGT)

$(TGT_LIB_A): $(OBJS_LIB)
$(AR) $(OBJS_LIB) $(LIBS) /o:$(TGT_LIB_A)

$(TGT_LIB_SO): $(OBJS_LIB)
$(LD) $(LDFLAGS) /Dll $(OBJS_LIB) $(LIBS) /o:$(TGT_LIB_SO)

$(TGT_UNIT_TEST): $(OBJS_UNIT_TEST)
$(CC) $(TGT_LIB_A) $(OBJS_UNIT_TEST) /o $(TGT_UNIT_TEST) /link $(LDFLAGS)

clean:
$(RM) $(OBJS)
$(RM) $(TGT)
$(RM) $(TGT_LIB_SO)*
30 changes: 30 additions & 0 deletions libuvc/dshow.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

#include "libuvc.h"
#include <stdio.h>
#include <stdlib.h>
#include "libposix4win.h"

struct dshow_ctx {
int fd;

};

static struct dshow_ctx *dshow_open(struct uvc_ctx *uvc, const char *dev, int width, int height)
{
struct dshow_ctx *dc = calloc(1, sizeof(struct dshow_ctx));
if (!dc) {
printf("malloc dshow_ctx failed!\n");
return NULL;
}

return dc;
}

struct uvc_ops dshow_ops = {
dshow_open,
NULL,
NULL,
NULL,
NULL,
NULL,
};
Loading

0 comments on commit 8e128ea

Please sign in to comment.