Mercurial > mplayer.hg
comparison vidix/ivtv_vid.c @ 26753:502f04b67653
cosmetics: Remove useless parentheses from return statements.
author | diego |
---|---|
date | Fri, 16 May 2008 00:13:03 +0000 |
parents | 3abd1629658b |
children | df448e1248b2 |
comparison
equal
deleted
inserted
replaced
26752:65f61607e32f | 26753:502f04b67653 |
---|---|
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 if(ivtv_verbose) | 268 if(ivtv_verbose) |
269 printf(IVTV_MSG"Can't find chip\n"); | 269 printf(IVTV_MSG"Can't find chip\n"); |
270 return(ENXIO); | 270 return ENXIO; |
271 | 271 |
272 card_found: | 272 card_found: |
273 | 273 |
274 device_name = getenv("FRAMEBUFFER"); | 274 device_name = getenv("FRAMEBUFFER"); |
275 if(NULL == device_name) { | 275 if(NULL == device_name) { |
281 fbdev = open(device_name, O_RDWR); | 281 fbdev = open(device_name, O_RDWR); |
282 if(-1 != fbdev) { | 282 if(-1 != fbdev) { |
283 if(ioctl(fbdev, FBIOGET_VSCREENINFO, &vinfo) < 0) { | 283 if(ioctl(fbdev, FBIOGET_VSCREENINFO, &vinfo) < 0) { |
284 printf(IVTV_MSG"Unable to read screen info\n"); | 284 printf(IVTV_MSG"Unable to read screen info\n"); |
285 close(fbdev); | 285 close(fbdev); |
286 return(ENXIO); | 286 return ENXIO; |
287 } else { | 287 } else { |
288 fb_width = vinfo.xres; | 288 fb_width = vinfo.xres; |
289 fb_height = vinfo.yres; | 289 fb_height = vinfo.yres; |
290 if(2 == ivtv_verbose) { | 290 if(2 == ivtv_verbose) { |
291 printf(IVTV_MSG"framebuffer width : %3.0f\n",fb_width); | 291 printf(IVTV_MSG"framebuffer width : %3.0f\n",fb_width); |
297 alpha_disable = 1; | 297 alpha_disable = 1; |
298 } | 298 } |
299 } | 299 } |
300 } else { | 300 } else { |
301 printf(IVTV_MSG"Failed to open /dev/fb%u\n", fb_number); | 301 printf(IVTV_MSG"Failed to open /dev/fb%u\n", fb_number); |
302 return(ENXIO); | 302 return ENXIO; |
303 } | 303 } |
304 | 304 |
305 /* Try to find YUV device */ | 305 /* Try to find YUV device */ |
306 unsigned char yuv_device_number = 48, yuv_device = 48 + fb_number; | 306 unsigned char yuv_device_number = 48, yuv_device = 48 + fb_number; |
307 char yuv_device_name[] = "/dev/videoXXX\0"; | 307 char yuv_device_name[] = "/dev/videoXXX\0"; |
316 } else { | 316 } else { |
317 if(ivtv_verbose) | 317 if(ivtv_verbose) |
318 printf(IVTV_MSG"YUV device not found: /dev/video%u\n", yuv_device); | 318 printf(IVTV_MSG"YUV device not found: /dev/video%u\n", yuv_device); |
319 } | 319 } |
320 } while(yuv_device-- > yuv_device_number); | 320 } while(yuv_device-- > yuv_device_number); |
321 return(ENXIO); | 321 return ENXIO; |
322 | 322 |
323 yuv_found: | 323 yuv_found: |
324 if(0 == alpha_disable) { | 324 if(0 == alpha_disable) { |
325 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) | 325 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
326 if(ioctl(fbdev, IVTVFB_IOCTL_GET_STATE, &fb_state_old) < 0) { | 326 if(ioctl(fbdev, IVTVFB_IOCTL_GET_STATE, &fb_state_old) < 0) { |
327 printf(IVTV_MSG"Unable to read fb state\n"); | 327 printf(IVTV_MSG"Unable to read fb state\n"); |
328 close(yuvdev); | 328 close(yuvdev); |
329 close(fbdev); | 329 close(fbdev); |
330 return(ENXIO); | 330 return ENXIO; |
331 } else { | 331 } else { |
332 if(ivtv_verbose) { | 332 if(ivtv_verbose) { |
333 printf(IVTV_MSG"old alpha : %ld\n",fb_state_old.alpha); | 333 printf(IVTV_MSG"old alpha : %ld\n",fb_state_old.alpha); |
334 printf(IVTV_MSG"old status: 0x%lx\n",fb_state_old.status); | 334 printf(IVTV_MSG"old status: 0x%lx\n",fb_state_old.status); |
335 } | 335 } |
341 format_old.type = format_hide.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; | 341 format_old.type = format_hide.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; |
342 if(ioctl(yuvdev, VIDIOC_G_FMT , &format_old) < 0) { | 342 if(ioctl(yuvdev, VIDIOC_G_FMT , &format_old) < 0) { |
343 printf(IVTV_MSG"Unable to read fb state\n"); | 343 printf(IVTV_MSG"Unable to read fb state\n"); |
344 close(yuvdev); | 344 close(yuvdev); |
345 close(fbdev); | 345 close(fbdev); |
346 return(ENXIO); | 346 return ENXIO; |
347 } else { | 347 } else { |
348 if(ivtv_verbose) { | 348 if(ivtv_verbose) { |
349 printf(IVTV_MSG"old alpha : %d\n",format_old.fmt.win.global_alpha); | 349 printf(IVTV_MSG"old alpha : %d\n",format_old.fmt.win.global_alpha); |
350 } | 350 } |
351 memcpy(&format_hide, &format_old, sizeof(format_old)); | 351 memcpy(&format_hide, &format_old, sizeof(format_old)); |
352 format_hide.fmt.win.global_alpha = 0; | 352 format_hide.fmt.win.global_alpha = 0; |
353 } | 353 } |
354 #endif | 354 #endif |
355 } | 355 } |
356 probed = 1; | 356 probed = 1; |
357 return(0); | 357 return 0; |
358 } | 358 } |
359 | 359 |
360 int ivtv_init(const char *args __attribute__ ((unused))) | 360 int ivtv_init(const char *args __attribute__ ((unused))) |
361 { | 361 { |
362 if(ivtv_verbose) | 362 if(ivtv_verbose) |
363 printf(IVTV_MSG"init\n"); | 363 printf(IVTV_MSG"init\n"); |
364 | 364 |
365 if (!probed) { | 365 if (!probed) { |
366 if(ivtv_verbose) | 366 if(ivtv_verbose) |
367 printf(IVTV_MSG"Driver was not probed but is being initialized\n"); | 367 printf(IVTV_MSG"Driver was not probed but is being initialized\n"); |
368 return(EINTR); | 368 return EINTR; |
369 } | 369 } |
370 outbuf = malloc((IVTVMAXHEIGHT * IVTVMAXWIDTH) + (IVTVMAXHEIGHT * IVTVMAXWIDTH / 2)); | 370 outbuf = malloc((IVTVMAXHEIGHT * IVTVMAXWIDTH) + (IVTVMAXHEIGHT * IVTVMAXWIDTH / 2)); |
371 if(NULL == outbuf) { | 371 if(NULL == outbuf) { |
372 if(ivtv_verbose) | 372 if(ivtv_verbose) |
373 printf(IVTV_MSG"Not enough memory availabe!\n"); | 373 printf(IVTV_MSG"Not enough memory availabe!\n"); |
374 return(EINTR); | 374 return EINTR; |
375 } | 375 } |
376 return(0); | 376 return 0; |
377 } | 377 } |
378 | 378 |
379 void ivtv_destroy(void) | 379 void ivtv_destroy(void) |
380 { | 380 { |
381 if(ivtv_verbose) | 381 if(ivtv_verbose) |
393 int ivtv_get_caps(vidix_capability_t *to) | 393 int ivtv_get_caps(vidix_capability_t *to) |
394 { | 394 { |
395 if(ivtv_verbose) | 395 if(ivtv_verbose) |
396 printf(IVTV_MSG"GetCap\n"); | 396 printf(IVTV_MSG"GetCap\n"); |
397 memcpy(to, &ivtv_cap, sizeof(vidix_capability_t)); | 397 memcpy(to, &ivtv_cap, sizeof(vidix_capability_t)); |
398 return(0); | 398 return 0; |
399 } | 399 } |
400 | 400 |
401 int ivtv_query_fourcc(vidix_fourcc_t *to) | 401 int ivtv_query_fourcc(vidix_fourcc_t *to) |
402 { | 402 { |
403 if(ivtv_verbose) | 403 if(ivtv_verbose) |
413 supports = 0; | 413 supports = 0; |
414 } | 414 } |
415 | 415 |
416 if(!supports) { | 416 if(!supports) { |
417 to->depth = to->flags = 0; | 417 to->depth = to->flags = 0; |
418 return(ENOTSUP); | 418 return ENOTSUP; |
419 } | 419 } |
420 to->depth = VID_DEPTH_12BPP | | 420 to->depth = VID_DEPTH_12BPP | |
421 VID_DEPTH_15BPP | VID_DEPTH_16BPP | | 421 VID_DEPTH_15BPP | VID_DEPTH_16BPP | |
422 VID_DEPTH_24BPP | VID_DEPTH_32BPP; | 422 VID_DEPTH_24BPP | VID_DEPTH_32BPP; |
423 to->flags = 0; | 423 to->flags = 0; |
424 return(0); | 424 return 0; |
425 } | 425 } |
426 | 426 |
427 int ivtv_config_playback(vidix_playback_t *info) | 427 int ivtv_config_playback(vidix_playback_t *info) |
428 { | 428 { |
429 if(ivtv_verbose) | 429 if(ivtv_verbose) |
450 info->offset.v = info->offset.u + ((info->src.w * info->src.h)/4); | 450 info->offset.v = info->offset.u + ((info->src.w * info->src.h)/4); |
451 info->dga_addr = memBase = malloc(info->num_frames*info->frame_size); | 451 info->dga_addr = memBase = malloc(info->num_frames*info->frame_size); |
452 if(ivtv_verbose) | 452 if(ivtv_verbose) |
453 printf(IVTV_MSG"frame_size: %d, dga_addr: %p\n", | 453 printf(IVTV_MSG"frame_size: %d, dga_addr: %p\n", |
454 info->frame_size, info->dga_addr); | 454 info->frame_size, info->dga_addr); |
455 return(0); | 455 return 0; |
456 } | 456 } |
457 | 457 |
458 int ivtv_playback_on(void) | 458 int ivtv_playback_on(void) |
459 { | 459 { |
460 if(ivtv_verbose) | 460 if(ivtv_verbose) |
471 if (ioctl(yuvdev, VIDIOC_S_FMT, &format_hide) < 0) | 471 if (ioctl(yuvdev, VIDIOC_S_FMT, &format_hide) < 0) |
472 printf (IVTV_MSG"Failed to set fb state\n"); | 472 printf (IVTV_MSG"Failed to set fb state\n"); |
473 } | 473 } |
474 #endif | 474 #endif |
475 } | 475 } |
476 return(0); | 476 return 0; |
477 } | 477 } |
478 | 478 |
479 int ivtv_playback_off(void) | 479 int ivtv_playback_off(void) |
480 { | 480 { |
481 if(ivtv_verbose) | 481 if(ivtv_verbose) |
492 if (ioctl(yuvdev, VIDIOC_S_FMT, &format_old) < 0) | 492 if (ioctl(yuvdev, VIDIOC_S_FMT, &format_old) < 0) |
493 printf (IVTV_MSG"Failed to restore fb state\n"); | 493 printf (IVTV_MSG"Failed to restore fb state\n"); |
494 } | 494 } |
495 #endif | 495 #endif |
496 } | 496 } |
497 return(0); | 497 return 0; |
498 } | 498 } |
499 | 499 |
500 int ivtv_frame_sel(unsigned int frame) | 500 int ivtv_frame_sel(unsigned int frame) |
501 { | 501 { |
502 | 502 |
546 #else | 546 #else |
547 if(ioctl(yuvdev, IVTV_IOC_DMA_FRAME, &args) == -1) { | 547 if(ioctl(yuvdev, IVTV_IOC_DMA_FRAME, &args) == -1) { |
548 #endif | 548 #endif |
549 printf("Ioctl IVTV_IOC_DMA_FRAME returned failed Error\n"); | 549 printf("Ioctl IVTV_IOC_DMA_FRAME returned failed Error\n"); |
550 } | 550 } |
551 return(0); | 551 return 0; |
552 } | 552 } |
553 | 553 |
554 VDXDriver ivtv_drv = { | 554 VDXDriver ivtv_drv = { |
555 "ivtv", | 555 "ivtv", |
556 NULL, | 556 NULL, |