gst_plugins_good/ext/jpeg/smokecodec.h
changeset 27 d43ce56a1534
parent 23 29ecd5cb86b3
child 31 aec498aab1d3
equal deleted inserted replaced
23:29ecd5cb86b3 27:d43ce56a1534
     1 /* Smoke Codec
       
     2  * Copyright (C) <2004> Wim Taymans <wim@fluendo.com>
       
     3  *
       
     4  * This library is free software; you can redistribute it and/or
       
     5  * modify it under the terms of the GNU Library General Public
       
     6  * License as published by the Free Software Foundation; either
       
     7  * version 2 of the License, or (at your option) any later version.
       
     8  *
       
     9  * This library is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12  * Library General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU Library General Public
       
    15  * License along with this library; if not, write to the
       
    16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17  * Boston, MA 02111-1307, USA.
       
    18  */
       
    19 
       
    20 
       
    21 #ifndef __SMOKECODEC_H__
       
    22 #define __SMOKECODEC_H__
       
    23 
       
    24 
       
    25 #ifdef __cplusplus
       
    26 extern "C" {
       
    27 #endif /* __cplusplus */
       
    28 
       
    29 
       
    30 typedef struct _SmokeCodecInfo SmokeCodecInfo;
       
    31 
       
    32 typedef enum {
       
    33   SMOKECODEC_WRONGVERSION       = -5,
       
    34   SMOKECODEC_WRONGSIZE          = -4,
       
    35   SMOKECODEC_ERROR              = -3,
       
    36   SMOKECODEC_NOMEM              = -2,
       
    37   SMOKECODEC_NULLPTR            = -1,
       
    38   SMOKECODEC_OK                 =  0 
       
    39 } SmokeCodecResult;
       
    40         
       
    41 typedef enum {
       
    42   SMOKECODEC_KEYFRAME           = (1<<0),
       
    43   SMOKECODEC_MOTION_VECTORS     = (1<<1)
       
    44 } SmokeCodecFlags;
       
    45         
       
    46 #define SMOKECODEC_ID_STRING "smoke"
       
    47 
       
    48 typedef enum {
       
    49   SMOKECODEC_TYPE_ID            = 0x80,
       
    50   SMOKECODEC_TYPE_COMMENT       = 0x81,
       
    51   SMOKECODEC_TYPE_EXTRA         = 0x83,
       
    52   SMOKECODEC_TYPE_DATA          = 0x40 
       
    53 } SmokePacketType;
       
    54 
       
    55 /* init */
       
    56 int                     smokecodec_encode_new   (SmokeCodecInfo **info,
       
    57                                                  const unsigned int width,
       
    58                                                  const unsigned int height,
       
    59                                                  const unsigned int fps_num,
       
    60                                                  const unsigned int fps_denom);
       
    61 
       
    62 int                     smokecodec_decode_new   (SmokeCodecInfo **info);
       
    63 
       
    64 int                     smokecodec_info_free    (SmokeCodecInfo * info);
       
    65 
       
    66 /* config */
       
    67 SmokeCodecResult        smokecodec_set_quality  (SmokeCodecInfo *info,
       
    68                                                  const unsigned int min,
       
    69                                                  const unsigned int max);
       
    70 SmokeCodecResult        smokecodec_get_quality  (SmokeCodecInfo *info,
       
    71                                                  unsigned int *min,
       
    72                                                  unsigned int *max);
       
    73 
       
    74 SmokeCodecResult        smokecodec_set_threshold (SmokeCodecInfo *info,
       
    75                                                  const unsigned int threshold);
       
    76 SmokeCodecResult        smokecodec_get_threshold (SmokeCodecInfo *info,
       
    77                                                  unsigned int *threshold);
       
    78 
       
    79 SmokeCodecResult        smokecodec_set_bitrate  (SmokeCodecInfo *info,
       
    80                                                  const unsigned int bitrate);
       
    81 SmokeCodecResult        smokecodec_get_bitrate  (SmokeCodecInfo *info,
       
    82                                                  unsigned int *bitrate);
       
    83 
       
    84 /* encoding */
       
    85 SmokeCodecResult        smokecodec_encode_id    (SmokeCodecInfo *info,
       
    86                                                  unsigned char *out,
       
    87                                                  unsigned int *outsize);
       
    88 
       
    89 SmokeCodecResult        smokecodec_encode       (SmokeCodecInfo *info,
       
    90                                                  const unsigned char *in,
       
    91                                                  SmokeCodecFlags flags,
       
    92                                                  unsigned char *out,
       
    93                                                  unsigned int *outsize);
       
    94 
       
    95 /* decoding */
       
    96 SmokeCodecResult        smokecodec_parse_id     (SmokeCodecInfo *info,
       
    97                                                  const unsigned char *in,
       
    98                                                  const unsigned int insize);
       
    99 
       
   100 SmokeCodecResult        smokecodec_parse_header (SmokeCodecInfo *info,
       
   101                                                  const unsigned char *in,
       
   102                                                  const unsigned int insize,
       
   103                                                  SmokeCodecFlags *flags,
       
   104                                                  unsigned int *width,
       
   105                                                  unsigned int *height,
       
   106                                                  unsigned int *fps_num,
       
   107                                                  unsigned int *fps_denom);
       
   108 
       
   109 SmokeCodecResult        smokecodec_decode       (SmokeCodecInfo *info,
       
   110                                                  const unsigned char *in,
       
   111                                                  const unsigned int insize,
       
   112                                                  unsigned char *out);
       
   113 
       
   114 #ifdef __cplusplus
       
   115 }
       
   116 #endif /* __cplusplus */
       
   117 
       
   118 
       
   119 #endif /* __SMOKECODEC_H__ */