[MPlayer-cvslog] r22883 - in trunk/vidix: vidixlib.c vidixlib.h
ben
subversion at mplayerhq.hu
Sun Apr 1 14:39:06 CEST 2007
Author: ben
Date: Sun Apr 1 14:39:06 2007
New Revision: 22883
Modified:
trunk/vidix/vidixlib.c
trunk/vidix/vidixlib.h
Log:
simplified function prototypes to avoid casts but keep external API compatibility
Modified: trunk/vidix/vidixlib.c
==============================================================================
--- trunk/vidix/vidixlib.c (original)
+++ trunk/vidix/vidixlib.c Sun Apr 1 14:39:06 2007
@@ -78,11 +78,8 @@ VDL_HANDLE vdlOpen(const char *path,cons
return ctx;
}
-void vdlClose(VDL_HANDLE stream)
+void vdlClose(VDL_HANDLE ctx)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) stream;
if (ctx->drv->destroy)
ctx->drv->destroy ();
@@ -90,11 +87,8 @@ void vdlClose(VDL_HANDLE stream)
free (ctx);
}
-int vdlGetCapability(VDL_HANDLE handle, vidix_capability_t *cap)
+int vdlGetCapability(VDL_HANDLE ctx, vidix_capability_t *cap)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
return ctx->drv->get_caps (cap);
}
@@ -110,157 +104,79 @@ static uint32_t normalize_fourcc(uint32_
else return fourcc;
}
-int vdlQueryFourcc(VDL_HANDLE handle,vidix_fourcc_t *f)
+int vdlQueryFourcc(VDL_HANDLE ctx,vidix_fourcc_t *f)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
f->fourcc = normalize_fourcc(f->fourcc);
return ctx->drv->query_fourcc (f);
}
-int vdlConfigPlayback(VDL_HANDLE handle,vidix_playback_t *p)
+int vdlConfigPlayback(VDL_HANDLE ctx,vidix_playback_t *p)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
p->fourcc = normalize_fourcc(p->fourcc);
return ctx->drv->config_playback (p);
}
-int vdlPlaybackOn(VDL_HANDLE handle)
+int vdlPlaybackOn(VDL_HANDLE ctx)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
return ctx->drv->playback_on ();
}
-int vdlPlaybackOff(VDL_HANDLE handle)
+int vdlPlaybackOff(VDL_HANDLE ctx)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
return ctx->drv->playback_off ();
}
-int vdlPlaybackFrameSelect(VDL_HANDLE handle, unsigned frame_idx )
+int vdlPlaybackFrameSelect(VDL_HANDLE ctx, unsigned frame_idx )
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->frame_sel)
- return ctx->drv->frame_sel (frame_idx);
-
- return ENOSYS;
+ return (ctx->drv->frame_sel) ? ctx->drv->frame_sel (frame_idx) : ENOSYS;
}
-int vdlPlaybackGetEq(VDL_HANDLE handle, vidix_video_eq_t * e)
+int vdlPlaybackGetEq(VDL_HANDLE ctx, vidix_video_eq_t * e)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->get_eq)
- return ctx->drv->get_eq (e);
-
- return ENOSYS;
+ return (ctx->drv->get_eq) ? ctx->drv->get_eq (e) : ENOSYS;
}
-int vdlPlaybackSetEq(VDL_HANDLE handle, const vidix_video_eq_t * e)
+int vdlPlaybackSetEq(VDL_HANDLE ctx, const vidix_video_eq_t * e)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->set_eq)
- return ctx->drv->set_eq (e);
-
- return ENOSYS;
+ return (ctx->drv->set_eq) ? ctx->drv->set_eq (e) : ENOSYS;
}
-int vdlPlaybackCopyFrame(VDL_HANDLE handle, const vidix_dma_t * f)
+int vdlPlaybackCopyFrame(VDL_HANDLE ctx, const vidix_dma_t * f)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->copy_frame)
- return ctx->drv->copy_frame (f);
-
- return ENOSYS;
+ return (ctx->drv->copy_frame) ? ctx->drv->copy_frame (f) : ENOSYS;
}
-int vdlGetGrKeys(VDL_HANDLE handle, vidix_grkey_t * k)
+int vdlGetGrKeys(VDL_HANDLE ctx, vidix_grkey_t * k)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->get_gkey)
- return ctx->drv->get_gkey (k);
-
- return ENOSYS;
+ return (ctx->drv->get_gkey) ? ctx->drv->get_gkey (k) : ENOSYS;
}
-int vdlSetGrKeys(VDL_HANDLE handle, const vidix_grkey_t * k)
+int vdlSetGrKeys(VDL_HANDLE ctx, const vidix_grkey_t * k)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->set_gkey)
- return ctx->drv->set_gkey (k);
-
- return ENOSYS;
+ return (ctx->drv->set_gkey) ? ctx->drv->set_gkey (k) : ENOSYS;
}
-int vdlPlaybackGetDeint(VDL_HANDLE handle, vidix_deinterlace_t * d)
+int vdlPlaybackGetDeint(VDL_HANDLE ctx, vidix_deinterlace_t * d)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->get_deint)
- return ctx->drv->get_deint (d);
-
- return ENOSYS;
+ return (ctx->drv->get_deint) ? ctx->drv->get_deint (d) : ENOSYS;
}
-int vdlPlaybackSetDeint(VDL_HANDLE handle, const vidix_deinterlace_t * d)
+int vdlPlaybackSetDeint(VDL_HANDLE ctx, const vidix_deinterlace_t * d)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->set_deint)
- return ctx->drv->set_deint (d);
-
- return ENOSYS;
+ return (ctx->drv->set_deint) ? ctx->drv->set_deint (d) : ENOSYS;
}
-int vdlQueryNumOemEffects(VDL_HANDLE handle, unsigned * number )
+int vdlQueryNumOemEffects(VDL_HANDLE ctx, unsigned * number )
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->get_num_fx)
- return ctx->drv->get_num_fx (number);
-
- return ENOSYS;
+ return (ctx->drv->get_num_fx) ? ctx->drv->get_num_fx (number) : ENOSYS;
}
-int vdlGetOemEffect(VDL_HANDLE handle, vidix_oem_fx_t * f)
+int vdlGetOemEffect(VDL_HANDLE ctx, vidix_oem_fx_t * f)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->get_fx)
- return ctx->drv->get_fx (f);
-
- return ENOSYS;
+ return (ctx->drv->get_fx) ? ctx->drv->get_fx (f) : ENOSYS;
}
-int vdlSetOemEffect(VDL_HANDLE handle, const vidix_oem_fx_t * f)
+int vdlSetOemEffect(VDL_HANDLE ctx, const vidix_oem_fx_t * f)
{
- VDXContext *ctx;
-
- ctx = (VDXContext *) handle;
- if (ctx->drv->set_fx)
- return ctx->drv->set_fx (f);
-
- return ENOSYS;
+ return (ctx->drv->set_fx) ? ctx->drv->set_fx (f) : ENOSYS;
}
Modified: trunk/vidix/vidixlib.h
==============================================================================
--- trunk/vidix/vidixlib.h (original)
+++ trunk/vidix/vidixlib.h Sun Apr 1 14:39:06 2007
@@ -55,7 +55,7 @@ typedef struct VDXContext {
/* might be filled in by much more info later on */
} VDXContext;
-typedef void * VDL_HANDLE;
+typedef VDXContext * VDL_HANDLE;
/* returns library version */
unsigned vdlGetVersion( void );
@@ -70,7 +70,7 @@ unsigned vdlGetVersion( void );
*/
VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose);
/* Closes stream and corresponded driver. */
-void vdlClose(VDL_HANDLE stream);
+void vdlClose(VDL_HANDLE ctx);
/* Queries driver capabilities. Return 0 if ok else errno */
int vdlGetCapability(VDL_HANDLE, vidix_capability_t *);
More information about the MPlayer-cvslog
mailing list