comparison vcr1.c @ 7784:e3f2d90a2295 libavcodec

Disable encoders by undefining CONFIG_FOO_ENCODER once instead of littering the code with preprocessor directives.
author diego
date Wed, 03 Sep 2008 12:43:18 +0000
parents 12a25666f1e4
children 7a463923ecd1
comparison
equal deleted inserted replaced
7783:12a25666f1e4 7784:e3f2d90a2295
27 #include "avcodec.h" 27 #include "avcodec.h"
28 #include "dsputil.h" 28 #include "dsputil.h"
29 29
30 //#undef NDEBUG 30 //#undef NDEBUG
31 //#include <assert.h> 31 //#include <assert.h>
32
33 /* Disable the encoder. */
34 #undef CONFIG_VCR1_ENCODER
32 35
33 typedef struct VCR1Context{ 36 typedef struct VCR1Context{
34 AVCodecContext *avctx; 37 AVCodecContext *avctx;
35 AVFrame picture; 38 AVFrame picture;
36 int delta[16]; 39 int delta[16];
111 emms_c(); 114 emms_c();
112 115
113 return buf_size; 116 return buf_size;
114 } 117 }
115 118
116 #if 0
117 #ifdef CONFIG_VCR1_ENCODER 119 #ifdef CONFIG_VCR1_ENCODER
118 static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ 120 static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
119 VCR1Context * const a = avctx->priv_data; 121 VCR1Context * const a = avctx->priv_data;
120 AVFrame *pict = data; 122 AVFrame *pict = data;
121 AVFrame * const p= (AVFrame*)&a->picture; 123 AVFrame * const p= (AVFrame*)&a->picture;
135 size= get_bit_count(&a->pb)/32; 137 size= get_bit_count(&a->pb)/32;
136 138
137 return size*4; 139 return size*4;
138 } 140 }
139 #endif 141 #endif
140 #endif
141 142
142 static av_cold void common_init(AVCodecContext *avctx){ 143 static av_cold void common_init(AVCodecContext *avctx){
143 VCR1Context * const a = avctx->priv_data; 144 VCR1Context * const a = avctx->priv_data;
144 145
145 avctx->coded_frame= (AVFrame*)&a->picture; 146 avctx->coded_frame= (AVFrame*)&a->picture;
153 avctx->pix_fmt= PIX_FMT_YUV410P; 154 avctx->pix_fmt= PIX_FMT_YUV410P;
154 155
155 return 0; 156 return 0;
156 } 157 }
157 158
158 #if 0
159 #ifdef CONFIG_VCR1_ENCODER 159 #ifdef CONFIG_VCR1_ENCODER
160 static av_cold int encode_init(AVCodecContext *avctx){ 160 static av_cold int encode_init(AVCodecContext *avctx){
161 161
162 common_init(avctx); 162 common_init(avctx);
163 163
164 return 0; 164 return 0;
165 } 165 }
166 #endif
167 #endif 166 #endif
168 167
169 AVCodec vcr1_decoder = { 168 AVCodec vcr1_decoder = {
170 "vcr1", 169 "vcr1",
171 CODEC_TYPE_VIDEO, 170 CODEC_TYPE_VIDEO,
176 NULL, 175 NULL,
177 decode_frame, 176 decode_frame,
178 CODEC_CAP_DR1, 177 CODEC_CAP_DR1,
179 .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), 178 .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
180 }; 179 };
181 #if 0 180
182 #ifdef CONFIG_VCR1_ENCODER 181 #ifdef CONFIG_VCR1_ENCODER
183 AVCodec vcr1_encoder = { 182 AVCodec vcr1_encoder = {
184 "vcr1", 183 "vcr1",
185 CODEC_TYPE_VIDEO, 184 CODEC_TYPE_VIDEO,
186 CODEC_ID_VCR1, 185 CODEC_ID_VCR1,
189 encode_frame, 188 encode_frame,
190 //encode_end, 189 //encode_end,
191 .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), 190 .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
192 }; 191 };
193 #endif 192 #endif
194 #endif