Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 271933 Details for
Bug 359743
media-tv/tvtime-1.0.2-r2 won't compile against linux-headers-2.6.38 due to V4L1 removal
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes dependency on deprecated V4L1
tvtime-1.0.2-v4l1.patch (text/plain), 15.75 KB, created by
cjcart
on 2011-05-03 01:18:05 UTC
(
hide
)
Description:
Fixes dependency on deprecated V4L1
Filename:
MIME Type:
Creator:
cjcart
Created:
2011-05-03 01:18:05 UTC
Size:
15.75 KB
patch
obsolete
>--- tvtime-1.0.2.orig/src/videoinput.c 2011-04-29 17:48:16.000000000 +0100 >+++ tvtime-1.0.2/src/videoinput.c 2011-05-01 20:07:23.000000000 +0100 >@@ -35,7 +35,9 @@ > #ifdef HAVE_CONFIG_H > # include "config.h" > #endif >+#ifdef HAVE_LINUX_VIDEODEV_H > #include <linux/videodev.h> >+#endif > #include <linux/videodev2.h> > #include "videoinput.h" > #include "mixer.h" >@@ -101,7 +103,7 @@ > return 0; > } > } >- >+#ifdef HAVE_LINUX_VIDEODEV_H > static int videoinput_get_v4l1_norm( int norm ) > { > if( norm == VIDEOINPUT_NTSC ) { >@@ -122,7 +124,7 @@ > return 0; > } > } >- >+#endif > static int videoinput_get_audmode_v4l2( int mode ) > { > if( mode == VIDEOINPUT_MONO ) { >@@ -226,7 +228,9 @@ > int have_mmap; > uint8_t *map; > struct video_mmap *grab_buf; >+#ifdef HAVE_LINUX_VIDEODEV_H > struct video_mbuf gb_buffers; >+#endif > > /* V4L1 read-mode state. */ > int grab_size; >@@ -235,18 +239,18 @@ > > const char *videoinput_get_audio_mode_name( videoinput_t *vidin, int mode ) > { >- if( mode == VIDEO_SOUND_MONO ) { >+ if( mode == VIDEOINPUT_MONO ) { > return "Mono"; >- } else if( mode == VIDEO_SOUND_STEREO ) { >+ } else if( mode == VIDEOINPUT_STEREO ) { > return "Stereo"; > } else if( vidin->norm == VIDEOINPUT_NTSC ) { >- if( mode == VIDEO_SOUND_LANG2 ) { >+ if( mode == VIDEOINPUT_LANG2 ) { > return "SAP"; > } > } else { >- if( mode == VIDEO_SOUND_LANG1 ) { >+ if( mode == VIDEOINPUT_LANG1 ) { > return "Language 1"; >- } else if( mode == VIDEO_SOUND_LANG2 ) { >+ } else if( mode == VIDEOINPUT_LANG2 ) { > return "Language 2"; > } > } >@@ -302,12 +306,15 @@ > frameid, strerror( errno ) ); > } > vidin->capbuffers[ frameid ].free = 1; >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( ioctl( vidin->grab_fd, VIDIOCMCAPTURE, vidin->grab_buf + frameid ) < 0 ) { > fprintf( stderr, "videoinput: Can't free frame %d: %s\n", > frameid, strerror( errno ) ); > } > } >+#endif > } > > void videoinput_free_frame( videoinput_t *vidin, int frameid ) >@@ -327,6 +334,7 @@ > vidin->curframe = 0; > } > >+#ifdef HAVE_LINUX_VIDEODEV_H > static void wait_for_frame_v4l1( videoinput_t *vidin, int frameid ) > { > alarms = 0; >@@ -347,6 +355,7 @@ > } > alarm( 0 ); > } >+#endif > > static void wait_for_frame_v4l2( videoinput_t * vidin ) > { >@@ -394,7 +403,9 @@ > vidin->capbuffers[ cur_buf.index ].free = 0; > *frameid = cur_buf.index; > return vidin->capbuffers[ cur_buf.index ].data; >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( vidin->have_mmap ) { > uint8_t *cur; > wait_for_frame_v4l1( vidin, vidin->curframe ); >@@ -413,13 +424,16 @@ > } > } > } >+#endif >+ return 0; > } > > int videoinput_buffer_invalid( videoinput_t *vidin, int frameid ) > { > if( !vidin->isv4l2 ) { > return 0; >- } else { >+ } >+ else { > return vidin->capbuffers[ frameid ].free; > } > } >@@ -428,10 +442,12 @@ > int volume, int norm, int verbose, char *error_string ) > { > videoinput_t *vidin = malloc( sizeof( videoinput_t ) ); >+#ifdef HAVE_LINUX_VIDEODEV_H > struct video_capability caps_v4l1; >- struct v4l2_capability caps_v4l2; > struct video_picture grab_pict; > struct video_window grab_win; >+#endif >+ struct v4l2_capability caps_v4l2; > int i; > > if( capwidth & 1 ) { >@@ -497,6 +513,7 @@ > * device. > */ > if( ioctl( vidin->grab_fd, VIDIOC_QUERYCAP, &caps_v4l2 ) < 0 ) { >+#ifdef HAVE_LINUX_VIDEODEV_H > /* Can't get V4L2 capabilities, maybe this is a V4L1 device? */ > if( ioctl( vidin->grab_fd, VIDIOCGCAP, &caps_v4l1 ) < 0 ) { > fprintf( stderr, "videoinput: %s is not a video4linux device.\n", >@@ -514,6 +531,9 @@ > "%s", caps_v4l1.name ); > snprintf( vidin->shortdriver, sizeof( vidin->shortdriver ), > "%s", caps_v4l1.name ); >+#else >+ return 0; >+#endif > } else { > if( vidin->verbose ) { > fprintf( stderr, "videoinput: Using video4linux2 driver '%s', card '%s' (bus %s).\n" >@@ -553,7 +573,9 @@ > free( vidin ); > return 0; > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > /* The capabilities should tell us how many inputs this card has. */ > vidin->numinputs = caps_v4l1.channels; > if( vidin->numinputs == 0 ) { >@@ -565,7 +587,9 @@ > return 0; > } > } >+#endif > >+#ifdef HAVE_LINUX_VIDEODEV_H > /* Check if this is a bttv-based card. Code taken from xawtv. */ > #define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int) > /* dirty hack time / v4l design flaw -- works with bttv only >@@ -595,11 +619,13 @@ > return 0; > } > } >+#endif > > /* On initialization, set to input 0. This is just to start things up. */ > videoinput_set_input_num( vidin, 0 ); > >- /* Test for audio support. */ >+#ifdef HAVE_LINUX_VIDEODEV_H >+ /* Test for audio support. */ > if( !vidin->isv4l2 ) { > struct video_audio audio; > >@@ -623,9 +649,10 @@ > fprintf( stderr, "\n" ); > } > } >- >+#endif > /* Set to stereo by default. */ >- videoinput_set_audio_mode( vidin, VIDEO_SOUND_STEREO ); >+ videoinput_set_audio_mode( vidin, VIDEOINPUT_STEREO ); >+ > > /** > * Once we're here, we've set the hardware norm. Now confirm that >@@ -702,7 +729,9 @@ > } > } > >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( ioctl( vidin->grab_fd, VIDIOCGCAP, &caps_v4l1 ) < 0 ) { > fprintf( stderr, "videoinput: video4linux device '%s' refuses " > "to provide set capability information, giving up.\n", >@@ -790,6 +819,7 @@ > return 0; > } > } >+#endif > > if( vidin->isv4l2 ) { > struct v4l2_requestbuffers req; >@@ -866,7 +896,9 @@ > videoinput_start_capture_v4l2( vidin ); > > return vidin; >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > /* Try to set up mmap-based capture. */ > if( ioctl( vidin->grab_fd, VIDIOCGMBUF, &(vidin->gb_buffers) ) < 0 ) { > fprintf( stderr, "videoinput: Can't get capture buffer properties. No mmap support?\n" >@@ -931,6 +963,8 @@ > > return vidin; > } >+#endif >+ return 0; > } > > void videoinput_delete( videoinput_t *vidin ) >@@ -947,7 +981,9 @@ > for( i = 0; i < vidin->numframes; i++ ) { > munmap( vidin->capbuffers[ i ].data, vidin->capbuffers[ i ].length ); > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( vidin->have_mmap ) { > munmap( vidin->map, vidin->gb_buffers.size ); > free( vidin->grab_buf ); >@@ -955,7 +991,7 @@ > free( vidin->grab_data ); > } > } >- >+#endif > close( vidin->grab_fd ); > free( vidin ); > } >@@ -992,14 +1028,16 @@ > { > if( vidin->isv4l2 ) { > return (int) ((videoinput_get_control_v4l2( vidin, V4L2_CID_HUE ) * 100.0) + 0.5); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { > return (int) ((((double) grab_pict.hue / 65535.0) * 100.0) + 0.5); > } > } >- >+#endif > return 0; > } > >@@ -1010,7 +1048,9 @@ > > if( vidin->isv4l2 ) { > videoinput_set_control_v4l2( vidin, V4L2_CID_HUE, ((double) newhue) / 100.0 ); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { >@@ -1018,6 +1058,7 @@ > ioctl( vidin->grab_fd, VIDIOCSPICT, &grab_pict ); > } > } >+#endif > } > > void videoinput_set_hue_relative( videoinput_t *vidin, int offset ) >@@ -1032,14 +1073,16 @@ > { > if( vidin->isv4l2 ) { > return (int) ((videoinput_get_control_v4l2( vidin, V4L2_CID_BRIGHTNESS ) * 100.0) + 0.5); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { > return (int) ((((double) grab_pict.brightness / 65535.0) * 100.0) + 0.5); > } > } >- >+#endif > return 0; > } > >@@ -1050,7 +1093,9 @@ > > if( vidin->isv4l2 ) { > videoinput_set_control_v4l2( vidin, V4L2_CID_BRIGHTNESS, ((double) newbright) / 100.0 ); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { >@@ -1058,6 +1103,7 @@ > ioctl( vidin->grab_fd, VIDIOCSPICT, &grab_pict ); > } > } >+#endif > } > > void videoinput_set_brightness_relative( videoinput_t *vidin, int offset ) >@@ -1072,14 +1118,16 @@ > { > if( vidin->isv4l2 ) { > return (int) ((videoinput_get_control_v4l2( vidin, V4L2_CID_CONTRAST ) * 100.0) + 0.5); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { > return (int) ((((double) grab_pict.contrast / 65535.0) * 100.0) + 0.5); > } > } >- >+#endif > return 0; > } > >@@ -1090,7 +1138,9 @@ > > if( vidin->isv4l2 ) { > videoinput_set_control_v4l2( vidin, V4L2_CID_CONTRAST, ((double) newcont) / 100.0 ); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { >@@ -1098,6 +1148,7 @@ > ioctl( vidin->grab_fd, VIDIOCSPICT, &grab_pict ); > } > } >+#endif > } > > void videoinput_set_contrast_relative( videoinput_t *vidin, int offset ) >@@ -1112,14 +1163,16 @@ > { > if( vidin->isv4l2 ) { > return (int) ((videoinput_get_control_v4l2( vidin, V4L2_CID_SATURATION ) * 100.0) + 0.5); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { > return (int) ((((double) grab_pict.colour / 65535.0) * 100.0) + 0.5); > } > } >- >+#endif > return 0; > } > >@@ -1130,7 +1183,9 @@ > > if( vidin->isv4l2 ) { > videoinput_set_control_v4l2( vidin, V4L2_CID_SATURATION, ((double) newsaturation) / 100.0 ); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_picture grab_pict; > > if( ioctl( vidin->grab_fd, VIDIOCGPICT, &grab_pict ) >= 0 ) { >@@ -1138,6 +1193,7 @@ > ioctl( vidin->grab_fd, VIDIOCSPICT, &grab_pict ); > } > } >+#endif > } > > void videoinput_set_saturation_relative( videoinput_t *vidin, int offset ) >@@ -1166,7 +1222,9 @@ > if( !mute && vidin->volume > 0 ) { > videoinput_set_control_v4l2( vidin, V4L2_CID_AUDIO_VOLUME, ((double) vidin->volume) / 100.0 ); > } >- } else { >+ } >+ #ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_audio audio; > > if( ioctl( vidin->grab_fd, VIDIOCGAUDIO, &audio ) < 0 ) { >@@ -1190,6 +1248,7 @@ > } > } > } >+#endif > vidin->hw_muted = mute; > } > } >@@ -1219,7 +1278,9 @@ > vidin->audiomode = mode; > } > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_audio audio; > > if( ioctl( vidin->grab_fd, VIDIOCGAUDIO, &audio ) < 0 ) { >@@ -1248,6 +1309,7 @@ > } > } > } >+#endif > } > } > >@@ -1294,13 +1356,16 @@ > videoinput_free_all_frames( vidin ); > videoinput_start_capture_v4l2( vidin ); > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( ioctl( vidin->grab_fd, VIDIOCSFREQ, &frequency ) < 0 ) { > fprintf( stderr, "videoinput: Tuner present, but our request to change " > "to frequency %d failed with this error: %s.\n", freqKHz, strerror( errno ) ); > fprintf( stderr, "videoinput: Please file a bug report at " PACKAGE_BUGREPORT "\n" ); > } > } >+#endif > } > } > >@@ -1322,7 +1387,9 @@ > return 0; > } > frequency = freqinfo.frequency; >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( ioctl( vidin->grab_fd, VIDIOCGFREQ, &frequency ) < 0 ) { > fprintf( stderr, "videoinput: Tuner refuses to tell us the current frequency: %s\n", > strerror( errno ) ); >@@ -1330,7 +1397,7 @@ > return 0; > } > } >- >+#endif > if( !vidin->tunerlow ) { > frequency *= 1000; /* switch from MHz to KHz */ > } >@@ -1355,7 +1422,9 @@ > } else if( !tuner.signal ) { > return 0; > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_tuner tuner; > > if( ioctl( vidin->grab_fd, VIDIOCGTUNER, &tuner ) < 0 ) { >@@ -1367,6 +1436,7 @@ > return 0; > } > } >+#endif > } > return 1; > } >@@ -1386,7 +1456,9 @@ > } else { > vidin->tunerlow = (tuner.capability & V4L2_TUNER_CAP_LOW) ? 1 : 0; > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_tuner tuner; > int tuner_number = -1; > int found = 0; >@@ -1498,6 +1570,7 @@ > vidin->hastuner = 1; > } > } >+#endif > } > > >@@ -1560,7 +1633,9 @@ > videoinput_free_all_frames( vidin ); > videoinput_start_capture_v4l2( vidin ); > } >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > if( inputnum >= vidin->numinputs ) { > fprintf( stderr, "videoinput: Requested input number %d not valid, " > "max is %d.\n", inputnum, vidin->numinputs ); >@@ -1595,7 +1670,7 @@ > } > } > } >- >+#endif > /* Once we've set the input, go look for a tuner. */ > videoinput_find_and_set_tuner( vidin ); > } >@@ -1678,8 +1753,8 @@ > > int videoinput_get_audio_mode( videoinput_t *vidin ) > { >- if( !vidin->audiomode || vidin->audiomode > VIDEO_SOUND_LANG2 ) { >- return VIDEO_SOUND_MONO; >+ if( !vidin->audiomode || vidin->audiomode > VIDEOINPUT_LANG2 ) { >+ return VIDEOINPUT_MONO; > } else { > return vidin->audiomode; > } >@@ -1771,7 +1846,9 @@ > if( vidin->isv4l2 ) { > videoinput_set_control_v4l2( vidin, V4L2_CID_AUDIO_VOLUME, > ((double) vidin->volume) / 100.0 ); >- } else { >+ } >+#ifdef HAVE_LINUX_VIDEODEV_H >+ else { > struct video_audio audio; > > if( ioctl( vidin->grab_fd, VIDIOCGAUDIO, &audio ) < 0 ) { >@@ -1790,6 +1867,7 @@ > } > } > } >+#endif > } > } > >--- tvtime-1.0.2.orig/configure.ac 2005-09-14 22:40:44.000000000 +0100 >+++ tvtime-1.0.2/configure.ac 2011-05-01 19:58:42.000000000 +0100 >@@ -22,7 +22,7 @@ > > # Checks for header files. > AC_HEADER_STDC >-AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h langinfo.h math.h netinet/in.h pwd.h signal.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/resource.h sys/stat.h sys/time.h sys/wait.h sys/types.h unistd.h wordexp.h locale.h]) >+AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h langinfo.h math.h netinet/in.h pwd.h signal.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/resource.h sys/stat.h sys/time.h sys/wait.h sys/types.h unistd.h wordexp.h locale.h linux/videodev.h]) > > # Checks for typedefs, structures, and compiler characteristics. > AC_HEADER_TIME
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 359743
:
268043
|
271735
| 271933