comparison libmpcodecs/vd_xvid4.c @ 26754:63630c09e237

cosmetics: Remove pointless parentheses from return calls.
author diego
date Fri, 16 May 2008 00:23:02 +0000
parents 82601a38e2a7
children aa81249bfedb
comparison
equal deleted inserted replaced
26753:502f04b67653 26754:63630c09e237
84 * control - to set/get/query special features/parameters 84 * control - to set/get/query special features/parameters
85 *==========================================================================*/ 85 *==========================================================================*/
86 86
87 static int control(sh_video_t *sh,int cmd,void* arg,...) 87 static int control(sh_video_t *sh,int cmd,void* arg,...)
88 { 88 {
89 return(CONTROL_UNKNOWN); 89 return CONTROL_UNKNOWN;
90 } 90 }
91 91
92 /*============================================================================ 92 /*============================================================================
93 * init - initialize the codec 93 * init - initialize the codec
94 *==========================================================================*/ 94 *==========================================================================*/
142 cs = XVID_CSP_YVYU; 142 cs = XVID_CSP_YVYU;
143 break; 143 break;
144 default: 144 default:
145 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Unsupported out_fmt: 0x%X\n", 145 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Unsupported out_fmt: 0x%X\n",
146 sh->codec->outfmt[sh->outfmtidx]); 146 sh->codec->outfmt[sh->outfmtidx]);
147 return(0); 147 return 0;
148 } 148 }
149 149
150 /* Gather some information about the host library */ 150 /* Gather some information about the host library */
151 if(xvid_global(NULL, XVID_GBL_INFO, &xvid_gbl_info, NULL) < 0) { 151 if(xvid_global(NULL, XVID_GBL_INFO, &xvid_gbl_info, NULL) < 0) {
152 mp_msg(MSGT_MENCODER,MSGL_INFO, "xvid: could not get information about the library\n"); 152 mp_msg(MSGT_MENCODER,MSGL_INFO, "xvid: could not get information about the library\n");
158 xvid_gbl_info.build); 158 xvid_gbl_info.build);
159 } 159 }
160 160
161 /* Initialize the xvidcore library */ 161 /* Initialize the xvidcore library */
162 if(xvid_global(NULL, XVID_GBL_INIT, &xvid_ini, NULL)) 162 if(xvid_global(NULL, XVID_GBL_INIT, &xvid_ini, NULL))
163 return(0); 163 return 0;
164 164
165 /* We use 0 width and height so xvidcore will resize its buffers 165 /* We use 0 width and height so xvidcore will resize its buffers
166 * if required. That allows this vd plugin to do resize on first 166 * if required. That allows this vd plugin to do resize on first
167 * VOL encountered (don't trust containers' width and height) */ 167 * VOL encountered (don't trust containers' width and height) */
168 dec_p.width = 0; 168 dec_p.width = 0;
169 dec_p.height = 0; 169 dec_p.height = 0;
170 170
171 /* Get a decoder instance */ 171 /* Get a decoder instance */
172 if(xvid_decore(0, XVID_DEC_CREATE, &dec_p, NULL)<0) { 172 if(xvid_decore(0, XVID_DEC_CREATE, &dec_p, NULL)<0) {
173 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "XviD init failed\n"); 173 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "XviD init failed\n");
174 return(0); 174 return 0;
175 } 175 }
176 176
177 p = malloc(sizeof(priv_t)); 177 p = malloc(sizeof(priv_t));
178 p->cs = cs; 178 p->cs = cs;
179 p->hdl = dec_p.handle; 179 p->hdl = dec_p.handle;
190 default: 190 default:
191 p->img_type = MP_IMGTYPE_TEMP; 191 p->img_type = MP_IMGTYPE_TEMP;
192 break; 192 break;
193 } 193 }
194 194
195 return(1); 195 return 1;
196 } 196 }
197 197
198 /*============================================================================ 198 /*============================================================================
199 * uninit - close the codec 199 * uninit - close the codec
200 *==========================================================================*/ 200 *==========================================================================*/
219 219
220 priv_t* p = sh->context; 220 priv_t* p = sh->context;
221 221
222 222
223 if(!data || len <= 0) 223 if(!data || len <= 0)
224 return(NULL); 224 return NULL;
225 225
226 memset(&dec,0,sizeof(xvid_dec_frame_t)); 226 memset(&dec,0,sizeof(xvid_dec_frame_t));
227 memset(&stats, 0, sizeof(xvid_dec_stats_t)); 227 memset(&stats, 0, sizeof(xvid_dec_stats_t));
228 dec.version = XVID_VERSION; 228 dec.version = XVID_VERSION;
229 stats.version = XVID_VERSION; 229 stats.version = XVID_VERSION;
270 270
271 /* Decode data */ 271 /* Decode data */
272 consumed = xvid_decore(p->hdl, XVID_DEC_DECODE, &dec, &stats); 272 consumed = xvid_decore(p->hdl, XVID_DEC_DECODE, &dec, &stats);
273 if (consumed < 0) { 273 if (consumed < 0) {
274 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Decoding error\n"); 274 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Decoding error\n");
275 return(NULL); 275 return NULL;
276 } 276 }
277 277
278 /* Found a VOL information stats, if VO plugin is not initialized 278 /* Found a VOL information stats, if VO plugin is not initialized
279 * yet then do it now */ 279 * yet then do it now */
280 if (stats.type == XVID_TYPE_VOL && !p->vo_initialized) { 280 if (stats.type == XVID_TYPE_VOL && !p->vo_initialized) {
281 sh->aspect = stats2aspect(&stats); 281 sh->aspect = stats2aspect(&stats);
282 if(!mpcodecs_config_vo(sh, stats.data.vol.width, stats.data.vol.height, IMGFMT_YV12)) 282 if(!mpcodecs_config_vo(sh, stats.data.vol.width, stats.data.vol.height, IMGFMT_YV12))
283 return(NULL); 283 return NULL;
284 284
285 /* Don't take this path twice */ 285 /* Don't take this path twice */
286 p->vo_initialized = !p->vo_initialized; 286 p->vo_initialized = !p->vo_initialized;
287 } 287 }
288 288
307 mpi->stride[2] = dec.output.stride[2]; 307 mpi->stride[2] = dec.output.stride[2];
308 } 308 }
309 309
310 /* If we got out the decoding loop because the buffer was empty and there was nothing 310 /* If we got out the decoding loop because the buffer was empty and there was nothing
311 * to output yet, then just return NULL */ 311 * to output yet, then just return NULL */
312 return((stats.type == XVID_TYPE_NOTHING)? NULL: mpi); 312 return (stats.type == XVID_TYPE_NOTHING) ? NULL : mpi;
313 } 313 }
314 314
315 /***************************************************************************** 315 /*****************************************************************************
316 * Helper functions 316 * Helper functions
317 ****************************************************************************/ 317 ****************************************************************************/
366 } 366 }
367 367
368 dar = ((float)stats->data.vol.width*wpar); 368 dar = ((float)stats->data.vol.width*wpar);
369 dar /= ((float)stats->data.vol.height*hpar); 369 dar /= ((float)stats->data.vol.height*hpar);
370 370
371 return(dar); 371 return dar;
372 } 372 }
373 373
374 return(0.0f); 374 return 0.0f;
375 } 375 }
376 376
377 /***************************************************************************** 377 /*****************************************************************************
378 * Module structure definition 378 * Module structure definition
379 ****************************************************************************/ 379 ****************************************************************************/