codec.h

00001 /*
00002  * Copyright (c) 2005-2012 by KoanLogic s.r.l. <http://www.koanlogic.com>
00003  * All rights reserved.
00004  *
00005  * This file is part of KLone, and as such it is subject to the license stated
00006  * in the LICENSE file which you have received as part of this distribution.
00007  *
00008  * $Id: codec.h,v 1.12 2006/01/09 12:38:37 tat Exp $
00009  */
00010 
00011 #ifndef _KLONE_CODEC_H_
00012 #define _KLONE_CODEC_H_
00013 
00014 #include <sys/types.h>
00015 #include <stdlib.h>
00016 #include <stdarg.h>
00017 #include <u/libu.h>
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif 
00022 
00023 enum { CODEC_FLUSH_COMPLETE, CODEC_FLUSH_CHUNK };
00024 
00025 enum { CODEC_BUFSZ = 4096 };
00026 
00027 TAILQ_HEAD(codec_chain_s, codec_s);
00028 typedef struct codec_chain_s codec_chain_t; 
00029 
00030 typedef ssize_t (*codec_transform_t) (struct codec_s *codec, 
00031     char *dst, size_t *dst_cnt, const char *src, size_t src_sz);
00032 
00033 typedef ssize_t (*codec_flush_t) (struct codec_s *codec, 
00034     char *dst, size_t *dst_cnt);
00035 
00036 typedef int (*codec_free_t) (struct codec_s *codec);
00037 
00038 typedef struct codec_s
00039 {
00040     codec_transform_t transform;
00041     codec_flush_t flush;
00042     codec_free_t free;
00043 
00044     /* codec buffer */
00045     char cbuf[CODEC_BUFSZ];
00046     size_t ccount, coff;
00047 
00048     /* chain next & prev pointer */
00049     TAILQ_ENTRY(codec_s) np; 
00050 } codec_t;
00051 
00052 int codec_free(codec_t *codec);
00053 
00054 #ifdef __cplusplus
00055 }
00056 #endif 
00057 
00058 #endif

←Products
Copyright © 2005-2012 - KoanLogic S.r.l. - All rights reserved