Mercurial > mplayer.hg
changeset 22865:441582f3ed87
simplified function prototypes to avoid casts but keep external API compatibility
author | ben |
---|---|
date | Sun, 01 Apr 2007 12:39:06 +0000 |
parents | e15beff67d91 |
children | 234c5f92d585 |
files | vidix/vidixlib.c vidix/vidixlib.h |
diffstat | 2 files changed, 30 insertions(+), 114 deletions(-) [+] |
line wrap: on
line diff
--- a/vidix/vidixlib.c Sun Apr 01 12:31:15 2007 +0000 +++ b/vidix/vidixlib.c Sun Apr 01 12:39:06 2007 +0000 @@ -78,11 +78,8 @@ 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 @@ 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 @@ 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; }
--- a/vidix/vidixlib.h Sun Apr 01 12:31:15 2007 +0000 +++ b/vidix/vidixlib.h Sun Apr 01 12:39:06 2007 +0000 @@ -55,7 +55,7 @@ /* 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 @@ */ 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 *);