From 86d8472fb3f169050bf07088abc5360ee8d8b54b Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 20 Jun 2008 20:17:38 +0000 Subject: renamed vidixlib.c to vidix.c git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27112 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 vidix/vidix.c (limited to 'vidix/vidix.c') diff --git a/vidix/vidix.c b/vidix/vidix.c new file mode 100644 index 0000000000..945318a804 --- /dev/null +++ b/vidix/vidix.c @@ -0,0 +1,194 @@ +/* + * VIDIX - VIDeo Interface for *niX. + * + * This interface is introduced as universal one to MPEG decoder, + * Back End Scaler (BES) and YUV2RGB hw accelerators. + * + * In the future it may be expanded up to capturing and audio things. + * Main goal of this this interface imlpementation is providing DGA + * everywhere where it's possible (unlike X11 and other). + * + * This interface is based on v4l2, fbvid.h, mga_vid.h projects + * and personally my ideas. + * + * NOTE: This interface is introduced as driver interface. + * + * Copyright (C) 2002 Nick Kurshev + * Copyright (C) 2007 Benjamin Zores + * + * This file is part of MPlayer. + * + * MPlayer 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. + * + * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include + +#include "config.h" +#include "vidix.h" +#include "drivers.h" +#include "libavutil/common.h" +#include "mpbswap.h" + +VDL_HANDLE vdlOpen(const char *name,unsigned cap,int verbose) +{ + VDXContext *ctx; + + if (!(ctx = malloc (sizeof (VDXContext)))) + return NULL; + memset (ctx, 0, sizeof (VDXContext)); + + /* register all drivers */ + vidix_register_all_drivers (); + + if (!vidix_find_driver (ctx, name, cap, verbose)) + { + free (ctx); + return NULL; + } + + if (verbose) + printf ("vidixlib: will use %s driver\n", ctx->drv->name); + + if (!ctx->drv || !ctx->drv->init) + { + if (verbose) + printf ("vidixlib: Can't init driver\n"); + free (ctx); + return NULL; + } + + if (verbose) + printf ("vidixlib: Attempt to initialize driver at: %p\n", + ctx->drv->init); + + if (ctx->drv->init () !=0) + { + if (verbose) + printf ("vidixlib: Can't init driver\n"); + free (ctx); + return NULL; + } + + if (verbose) + printf("vidixlib: '%s'successfully loaded\n", ctx->drv->name); + + return ctx; +} + +void vdlClose(VDL_HANDLE ctx) +{ + if (ctx->drv->destroy) + ctx->drv->destroy (); + + memset (ctx, 0, sizeof (VDXContext)); /* <- it's not stupid */ + free (ctx); +} + +int vdlGetCapability(VDL_HANDLE ctx, vidix_capability_t *cap) +{ + return ctx->drv->get_caps (cap); +} + +#define MPLAYER_IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8)) +#define MPLAYER_IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8)) +#define MPLAYER_IMGFMT_RGB_MASK 0xFFFFFF00 + +static uint32_t normalize_fourcc(uint32_t fourcc) +{ + if((fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_RGB|0) || + (fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_BGR|0)) + return bswap_32(fourcc); + else return fourcc; +} + +int vdlQueryFourcc(VDL_HANDLE ctx,vidix_fourcc_t *f) +{ + f->fourcc = normalize_fourcc(f->fourcc); + return ctx->drv->query_fourcc (f); +} + +int vdlConfigPlayback(VDL_HANDLE ctx,vidix_playback_t *p) +{ + p->fourcc = normalize_fourcc(p->fourcc); + return ctx->drv->config_playback (p); +} + +int vdlPlaybackOn(VDL_HANDLE ctx) +{ + return ctx->drv->playback_on (); +} + +int vdlPlaybackOff(VDL_HANDLE ctx) +{ + return ctx->drv->playback_off (); +} + +int vdlPlaybackFrameSelect(VDL_HANDLE ctx, unsigned frame_idx ) +{ + return ctx->drv->frame_sel ? ctx->drv->frame_sel (frame_idx) : ENOSYS; +} + +int vdlPlaybackGetEq(VDL_HANDLE ctx, vidix_video_eq_t * e) +{ + return ctx->drv->get_eq ? ctx->drv->get_eq (e) : ENOSYS; +} + +int vdlPlaybackSetEq(VDL_HANDLE ctx, const vidix_video_eq_t * e) +{ + return ctx->drv->set_eq ? ctx->drv->set_eq (e) : ENOSYS; +} + +int vdlPlaybackCopyFrame(VDL_HANDLE ctx, const vidix_dma_t * f) +{ + return ctx->drv->copy_frame ? ctx->drv->copy_frame (f) : ENOSYS; +} + +int vdlGetGrKeys(VDL_HANDLE ctx, vidix_grkey_t * k) +{ + return ctx->drv->get_gkey ? ctx->drv->get_gkey (k) : ENOSYS; +} + +int vdlSetGrKeys(VDL_HANDLE ctx, const vidix_grkey_t * k) +{ + return ctx->drv->set_gkey ? ctx->drv->set_gkey (k) : ENOSYS; +} + +int vdlPlaybackGetDeint(VDL_HANDLE ctx, vidix_deinterlace_t * d) +{ + return ctx->drv->get_deint ? ctx->drv->get_deint (d) : ENOSYS; +} + +int vdlPlaybackSetDeint(VDL_HANDLE ctx, const vidix_deinterlace_t * d) +{ + return ctx->drv->set_deint ? ctx->drv->set_deint (d) : ENOSYS; +} + +int vdlQueryNumOemEffects(VDL_HANDLE ctx, unsigned * number ) +{ + return ctx->drv->get_num_fx ? ctx->drv->get_num_fx (number) : ENOSYS; +} + +int vdlGetOemEffect(VDL_HANDLE ctx, vidix_oem_fx_t * f) +{ + return ctx->drv->get_fx ? ctx->drv->get_fx (f) : ENOSYS; +} + +int vdlSetOemEffect(VDL_HANDLE ctx, const vidix_oem_fx_t * f) +{ + return ctx->drv->set_fx ? ctx->drv->set_fx (f) : ENOSYS; +} -- cgit v1.2.3 From 3927b78660995121907af120a925f1193b11ea21 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 20 Jun 2008 20:19:18 +0000 Subject: remove useless 'else' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27113 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vidix/vidix.c') diff --git a/vidix/vidix.c b/vidix/vidix.c index 945318a804..6b38d15af0 100644 --- a/vidix/vidix.c +++ b/vidix/vidix.c @@ -113,7 +113,7 @@ static uint32_t normalize_fourcc(uint32_t fourcc) if((fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_RGB|0) || (fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_BGR|0)) return bswap_32(fourcc); - else return fourcc; + return fourcc; } int vdlQueryFourcc(VDL_HANDLE ctx,vidix_fourcc_t *f) -- cgit v1.2.3 From 598f6c15b96c96678fd84131c0a5689bc99ecc68 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 20 Jun 2008 20:21:31 +0000 Subject: remove some useless functions from vidix api git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27114 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'vidix/vidix.c') diff --git a/vidix/vidix.c b/vidix/vidix.c index 6b38d15af0..a68472b9d4 100644 --- a/vidix/vidix.c +++ b/vidix/vidix.c @@ -177,18 +177,3 @@ int vdlPlaybackSetDeint(VDL_HANDLE ctx, const vidix_deinterlace_t * d) { return ctx->drv->set_deint ? ctx->drv->set_deint (d) : ENOSYS; } - -int vdlQueryNumOemEffects(VDL_HANDLE ctx, unsigned * number ) -{ - return ctx->drv->get_num_fx ? ctx->drv->get_num_fx (number) : ENOSYS; -} - -int vdlGetOemEffect(VDL_HANDLE ctx, vidix_oem_fx_t * f) -{ - return ctx->drv->get_fx ? ctx->drv->get_fx (f) : ENOSYS; -} - -int vdlSetOemEffect(VDL_HANDLE ctx, const vidix_oem_fx_t * f) -{ - return ctx->drv->set_fx ? ctx->drv->set_fx (f) : ENOSYS; -} -- cgit v1.2.3 From b6697c56e6c1190ee7544b56e7186c3bae67ea8e Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 20 Jun 2008 20:24:53 +0000 Subject: cosmetic: give a coherent indentation git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27115 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'vidix/vidix.c') diff --git a/vidix/vidix.c b/vidix/vidix.c index a68472b9d4..a8f291e6d9 100644 --- a/vidix/vidix.c +++ b/vidix/vidix.c @@ -108,7 +108,7 @@ int vdlGetCapability(VDL_HANDLE ctx, vidix_capability_t *cap) #define MPLAYER_IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8)) #define MPLAYER_IMGFMT_RGB_MASK 0xFFFFFF00 -static uint32_t normalize_fourcc(uint32_t fourcc) +static uint32_t normalize_fourcc (uint32_t fourcc) { if((fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_RGB|0) || (fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_BGR|0)) @@ -116,64 +116,64 @@ static uint32_t normalize_fourcc(uint32_t fourcc) return fourcc; } -int vdlQueryFourcc(VDL_HANDLE ctx,vidix_fourcc_t *f) +int vdlQueryFourcc(VDL_HANDLE ctx, vidix_fourcc_t *f) { f->fourcc = normalize_fourcc(f->fourcc); return ctx->drv->query_fourcc (f); } -int vdlConfigPlayback(VDL_HANDLE ctx,vidix_playback_t *p) +int vdlConfigPlayback (VDL_HANDLE ctx, vidix_playback_t *p) { p->fourcc = normalize_fourcc(p->fourcc); return ctx->drv->config_playback (p); } -int vdlPlaybackOn(VDL_HANDLE ctx) +int vdlPlaybackOn (VDL_HANDLE ctx) { return ctx->drv->playback_on (); } -int vdlPlaybackOff(VDL_HANDLE ctx) +int vdlPlaybackOff (VDL_HANDLE ctx) { return ctx->drv->playback_off (); } -int vdlPlaybackFrameSelect(VDL_HANDLE ctx, unsigned frame_idx ) +int vdlPlaybackFrameSelect (VDL_HANDLE ctx, unsigned frame_idx) { return ctx->drv->frame_sel ? ctx->drv->frame_sel (frame_idx) : ENOSYS; } -int vdlPlaybackGetEq(VDL_HANDLE ctx, vidix_video_eq_t * e) +int vdlPlaybackGetEq (VDL_HANDLE ctx, vidix_video_eq_t *e) { return ctx->drv->get_eq ? ctx->drv->get_eq (e) : ENOSYS; } -int vdlPlaybackSetEq(VDL_HANDLE ctx, const vidix_video_eq_t * e) +int vdlPlaybackSetEq (VDL_HANDLE ctx, const vidix_video_eq_t *e) { return ctx->drv->set_eq ? ctx->drv->set_eq (e) : ENOSYS; } -int vdlPlaybackCopyFrame(VDL_HANDLE ctx, const vidix_dma_t * f) +int vdlPlaybackCopyFrame (VDL_HANDLE ctx, const vidix_dma_t *f) { return ctx->drv->copy_frame ? ctx->drv->copy_frame (f) : ENOSYS; } -int vdlGetGrKeys(VDL_HANDLE ctx, vidix_grkey_t * k) +int vdlGetGrKeys (VDL_HANDLE ctx, vidix_grkey_t *k) { return ctx->drv->get_gkey ? ctx->drv->get_gkey (k) : ENOSYS; } -int vdlSetGrKeys(VDL_HANDLE ctx, const vidix_grkey_t * k) +int vdlSetGrKeys (VDL_HANDLE ctx, const vidix_grkey_t *k) { return ctx->drv->set_gkey ? ctx->drv->set_gkey (k) : ENOSYS; } -int vdlPlaybackGetDeint(VDL_HANDLE ctx, vidix_deinterlace_t * d) +int vdlPlaybackGetDeint (VDL_HANDLE ctx, vidix_deinterlace_t *d) { return ctx->drv->get_deint ? ctx->drv->get_deint (d) : ENOSYS; } -int vdlPlaybackSetDeint(VDL_HANDLE ctx, const vidix_deinterlace_t * d) +int vdlPlaybackSetDeint (VDL_HANDLE ctx, const vidix_deinterlace_t *d) { return ctx->drv->set_deint ? ctx->drv->set_deint (d) : ENOSYS; } -- cgit v1.2.3 From b40e5e88d586096db2deabe901e5523f76eb7b55 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 20 Jun 2008 20:28:50 +0000 Subject: remove useless typedef againstfor VDXContext git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27116 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'vidix/vidix.c') diff --git a/vidix/vidix.c b/vidix/vidix.c index a8f291e6d9..fa371657c5 100644 --- a/vidix/vidix.c +++ b/vidix/vidix.c @@ -44,7 +44,7 @@ #include "libavutil/common.h" #include "mpbswap.h" -VDL_HANDLE vdlOpen(const char *name,unsigned cap,int verbose) +VDXContext *vdlOpen(const char *name,unsigned cap,int verbose) { VDXContext *ctx; @@ -90,7 +90,7 @@ VDL_HANDLE vdlOpen(const char *name,unsigned cap,int verbose) return ctx; } -void vdlClose(VDL_HANDLE ctx) +void vdlClose(VDXContext *ctx) { if (ctx->drv->destroy) ctx->drv->destroy (); @@ -99,7 +99,7 @@ void vdlClose(VDL_HANDLE ctx) free (ctx); } -int vdlGetCapability(VDL_HANDLE ctx, vidix_capability_t *cap) +int vdlGetCapability(VDXContext *ctx, vidix_capability_t *cap) { return ctx->drv->get_caps (cap); } @@ -116,64 +116,64 @@ static uint32_t normalize_fourcc (uint32_t fourcc) return fourcc; } -int vdlQueryFourcc(VDL_HANDLE ctx, vidix_fourcc_t *f) +int vdlQueryFourcc(VDXContext *ctx, vidix_fourcc_t *f) { f->fourcc = normalize_fourcc(f->fourcc); return ctx->drv->query_fourcc (f); } -int vdlConfigPlayback (VDL_HANDLE ctx, vidix_playback_t *p) +int vdlConfigPlayback (VDXContext *ctx, vidix_playback_t *p) { p->fourcc = normalize_fourcc(p->fourcc); return ctx->drv->config_playback (p); } -int vdlPlaybackOn (VDL_HANDLE ctx) +int vdlPlaybackOn (VDXContext *ctx) { return ctx->drv->playback_on (); } -int vdlPlaybackOff (VDL_HANDLE ctx) +int vdlPlaybackOff (VDXContext *ctx) { return ctx->drv->playback_off (); } -int vdlPlaybackFrameSelect (VDL_HANDLE ctx, unsigned frame_idx) +int vdlPlaybackFrameSelect (VDXContext *ctx, unsigned frame_idx) { return ctx->drv->frame_sel ? ctx->drv->frame_sel (frame_idx) : ENOSYS; } -int vdlPlaybackGetEq (VDL_HANDLE ctx, vidix_video_eq_t *e) +int vdlPlaybackGetEq (VDXContext *ctx, vidix_video_eq_t *e) { return ctx->drv->get_eq ? ctx->drv->get_eq (e) : ENOSYS; } -int vdlPlaybackSetEq (VDL_HANDLE ctx, const vidix_video_eq_t *e) +int vdlPlaybackSetEq (VDXContext *ctx, const vidix_video_eq_t *e) { return ctx->drv->set_eq ? ctx->drv->set_eq (e) : ENOSYS; } -int vdlPlaybackCopyFrame (VDL_HANDLE ctx, const vidix_dma_t *f) +int vdlPlaybackCopyFrame (VDXContext *ctx, const vidix_dma_t *f) { return ctx->drv->copy_frame ? ctx->drv->copy_frame (f) : ENOSYS; } -int vdlGetGrKeys (VDL_HANDLE ctx, vidix_grkey_t *k) +int vdlGetGrKeys (VDXContext *ctx, vidix_grkey_t *k) { return ctx->drv->get_gkey ? ctx->drv->get_gkey (k) : ENOSYS; } -int vdlSetGrKeys (VDL_HANDLE ctx, const vidix_grkey_t *k) +int vdlSetGrKeys (VDXContext *ctx, const vidix_grkey_t *k) { return ctx->drv->set_gkey ? ctx->drv->set_gkey (k) : ENOSYS; } -int vdlPlaybackGetDeint (VDL_HANDLE ctx, vidix_deinterlace_t *d) +int vdlPlaybackGetDeint (VDXContext *ctx, vidix_deinterlace_t *d) { return ctx->drv->get_deint ? ctx->drv->get_deint (d) : ENOSYS; } -int vdlPlaybackSetDeint (VDL_HANDLE ctx, const vidix_deinterlace_t *d) +int vdlPlaybackSetDeint (VDXContext *ctx, const vidix_deinterlace_t *d) { return ctx->drv->set_deint ? ctx->drv->set_deint (d) : ENOSYS; } -- cgit v1.2.3 From f3a13413c942e6a70bdcc996625b7ffa2aa8dac6 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 20 Jun 2008 20:38:15 +0000 Subject: cosmetic: be consistent git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27119 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vidix/vidix.c') diff --git a/vidix/vidix.c b/vidix/vidix.c index fa371657c5..f5da49da7f 100644 --- a/vidix/vidix.c +++ b/vidix/vidix.c @@ -116,7 +116,7 @@ static uint32_t normalize_fourcc (uint32_t fourcc) return fourcc; } -int vdlQueryFourcc(VDXContext *ctx, vidix_fourcc_t *f) +int vdlQueryFourcc (VDXContext *ctx, vidix_fourcc_t *f) { f->fourcc = normalize_fourcc(f->fourcc); return ctx->drv->query_fourcc (f); -- cgit v1.2.3