[MPlayer-users] Bug with x86-64

Aaron Williams aaron.m.williams at comcast.net
Sun Aug 14 00:04:17 CEST 2005


I have found some more information.  When using V4L2, mplayer attempts 
to set the V4L2 input format to default to BGR24 instead of YUY2.  
Also,  it looks like some non-initialized data is causing problems in 
the ioctl to try and set the format.

I have gotten the video capture working with the following patch:

--- tvi_v4l2.c  2005-08-06 12:45:55.000000000 -0700
+++ tvi_v4l2.c.new      2005-08-13 15:04:21.000000000 -0700
@@ -556,10 +556,11 @@
        priv->immediate_mode = 1;
        return TVI_CONTROL_TRUE;
     case TVI_CONTROL_VID_GET_FPS:
-       *(float *)arg = priv->standard.frameperiod.denominator /
-           priv->standard.frameperiod.numerator;
-       mp_msg(MSGT_TV, MSGL_V, "%s: get fps: %f\n", info.short_name,
-              *(float *)arg);
+       *(float *)arg = (float)priv->standard.frameperiod.denominator /
+                (float)priv->standard.frameperiod.numerator;
+       mp_msg(MSGT_TV, MSGL_V, "%s: get fps: %f (%d/%d)\n", 
info.short_name,
+              *(float *)arg, priv->standard.frameperiod.denominator,
+               priv->standard.frameperiod.numerator);
        return TVI_CONTROL_TRUE;
     case TVI_CONTROL_VID_GET_BITS:
        if (getfmt(priv) < 0) return TVI_CONTROL_FALSE;
@@ -578,13 +579,16 @@
               pixfmt2name(priv->format.fmt.pix.pixelformat));
        return TVI_CONTROL_TRUE;
     case TVI_CONTROL_VID_SET_FORMAT:
+        memset(&priv->format, 0, sizeof(struct v4l2_format));
        if (getfmt(priv) < 0) return TVI_CONTROL_FALSE;
        priv->format.fmt.pix.pixelformat = fcc_mp2vl(*(int *)arg);
        priv->format.fmt.pix.field = V4L2_FIELD_ANY;
-
+
        priv->mp_format = *(int *)arg;
        mp_msg(MSGT_TV, MSGL_V, "%s: set format: %s\n", info.short_name,
               pixfmt2name(priv->format.fmt.pix.pixelformat));
+        mp_msg(MSGT_TV, MSGL_V, "%s: width: %d, height: %d\n", 
info.short_name,
+               priv->format.fmt.pix.width, priv->format.fmt.pix.height);
        if (ioctl(priv->video_fd, VIDIOC_S_FMT, &priv->format) < 0) {
            mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl set format failed: %s\n",
                   info.short_name, strerror(errno));
@@ -1075,6 +1079,7 @@
     if (getfmt(priv) < 0) return 0;
     priv->format.fmt.pix.width  = 640;
     priv->format.fmt.pix.height = 480;
+    priv->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     if (ioctl(priv->video_fd, VIDIOC_S_FMT, &priv->format) < 0) {
        mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl set format failed: %s\n",
               info.short_name, strerror(errno));

This patch also fixes a problem where the frame rate comes out as 29.0 
instead of 29.97.

-Aaron


Aaron Williams wrote:
> Bug is still present in CVS as of 8/13/2005
>
> System: Athlon64 San Diego core with NForce 4 chipset and nVidia 6600 
> graphics adapter running latest nVidia graphics drivers.
>
> System: SuSE 9.3 64-bit
> Kernel: SuSE 2.6.11.4-21.8 (with preemption enabled)
> v4l and v4l2 drivers and code was backported from the stock 2.6.12.4 
> Linux kernel.
>
> glibc-2.3.4-23.4
>
> gcc -v
> Reading specs from /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/specs
> Configured with: ../configure --enable-threads=posix --prefix=/usr 
> --with-local-prefix=/usr/local --infodir=/usr/share/info 
> --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada 
> --disable-checking --libdir=/usr/lib64 --enable-libgcj 
> --with-slibdir=/lib64 --with-system-zlib --enable-shared 
> --enable-__cxa_atexit x86_64-suse-linux
> Thread model: posix
> gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
>
> ld -v
> GNU ld version 2.15.94.0.2.2 20041220 (SuSE Linux)
>
> as --version
> GNU assembler 2.15.94.0.2.2 20041220 (SuSE Linux)
>
> cat /proc/cpuinfo
> processor       : 0
> vendor_id       : AuthenticAMD
> cpu family      : 15
> model           : 39
> model name      : AMD Athlon(tm) 64 Processor 3700+
> stepping        : 1
> cpu MHz         : 2211.375
> cache size      : 1024 KB
> fpu             : yes
> fpu_exception   : yes
> cpuid level     : 1
> wp              : yes
> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
> mca cmov pat pse36 clflush mmx fxsr sse sse2 pni syscall nx mmxext 
> fxsr_opt lm 3dnowext 3dnow pni lahf_lm
> bogomips        : 1988.42
> TLB size        : 1024 4K pages
> clflush size    : 64
> cache_alignment : 64
> address sizes   : 40 bits physical, 48 bits virtual
> power management: ts fid vid ttp [4] [5]
>
> Video capture card: pcHDTV 3000
>
> (gdb) run tv:// -tv driver=v4l2
> Starting program: /home/aaronw/ftp/transcode/MPlayer-cvs/main/mplayer 
> tv:// -tv driver=v4l2
> [Thread debugging using libthread_db enabled]
> [New Thread 46912582058816 (LWP 11279)]
> Using GNU internationalization
> Original domain: messages
> Original dirname: /usr/share/locale
> Current domain: mplayer
> Current dirname: /usr/local/share/locale
>
> MPlayer dev-CVS-050813-09:09-3.3.5 (C) 2000-2005 MPlayer Team
> CPU: Advanced Micro Devices  (Family: 8, Stepping: 1)
> Detected cache-line size is 64 bytes
> CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
> Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2
>
>
> Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
> Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your 
> system startup scripts.
> Setting up LIRC support...
> mplayer: could not connect to socket
> mplayer: Connection refused
> Failed to open LIRC support.
> You will not be able to use your remote control.
> Playing tv://.
> Selected driver: v4l2
> name: Video 4 Linux 2 input
> author: Martin Olschewski <olschewski at zpr.uni-koeln.de>
> comment: first try, more to come ;-)
> Selected device: pcHDTV HD3000 HDTV
> Tuner cap: STEREO LANG2
> Tuner rxs: STEREO LANG2
> Capabilites:  video capture  VBI capture device  tuner  read/write  
> streaming
> supported norms: 0 = NTSC-M; 1 = NTSC-JP; 2 = PAL-BG; 3 = PAL-DK; 4 = 
> PAL-I; 5 = PAL-M; 6 = PAL-N; 7 = PAL-Nc; 8 = PAL-60; 9 = SECAM-L; 10 = 
> SECAM-DK;
> inputs: 0 = Television; 1 = Composite1; 2 = S-Video;
> Current input: 0
> Current format: BGR24
> v4l2: current audio mode is : MONO
> v4l2: ioctl set format failed: Invalid argument
> vo: X11 running at 1280x960 with depth 24 and 32 bpp (":0" => local 
> display)
> ========================================================================== 
>
> Opening video decoder: [raw] RAW Uncompressed Video
> VDec: vo config request - 640 x 480 (preferred csp: BGR 24-bit)
> Could not find matching colorspace - retrying with -vf scale...
> Opening video filter: [scale]
> VDec: using BGR 24-bit as output csp (no 0)
> Movie-Aspect is undefined - no prescaling applied.
> SwScaler: using unscaled BGR 24-bit -> Planar YV12 special converter
> VO: [xv] 640x480 => 640x480 Planar YV12
> Selected video codec: [rawbgr24] vfm:raw (RAW BGR24)
> ========================================================================== 
>
> Audio: no sound
> Starting playback...
> [New Thread 1075841376 (LWP 11282)]
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 46912582058816 (LWP 11279)]
> 0x0000000000559e15 in rgb24toyv12_MMX2 (src=0x2aaab02fe010 "",
>    ydst=0x2aaab04c2040 "", udst=0x2aaab051fc40 '\200' <repeats 200 
> times>...,
>    vdst=0x2aaab050d040 '\200' <repeats 200 times>...,
>    width=<value optimized out>, height=480, lumStride=640, 
> chromStride=320,
>    srcStride=1920) at rgb2rgb_template.c:2107
> 2107                            asm volatile(
> (gdb) bt
> #0  0x0000000000559e15 in rgb24toyv12_MMX2 (src=0x2aaab02fe010 "",
>    ydst=0x2aaab04c2040 "", udst=0x2aaab051fc40 '\200' <repeats 200 
> times>...,
>    vdst=0x2aaab050d040 '\200' <repeats 200 times>...,
>    width=<value optimized out>, height=480, lumStride=640, 
> chromStride=320,
>    srcStride=1920) at rgb2rgb_template.c:2107
> #1  0x000000000054ab12 in bgr24toyv12Wrapper (c=<value optimized out>,
>    src=0xba5a80, srcStride=<value optimized out>,
>    srcSliceY=<value optimized out>, srcSliceH=480, dst=<value 
> optimized out>,
>    dstStride=0xfffffd80) at swscale.c:1547
> #2  0x000000000054b9b3 in sws_scale_ordered (c=0xb95bc0,
>    src=<value optimized out>, srcStride=<value optimized out>, 
> srcSliceY=0,
>    srcSliceH=480, dst=0xba5b10, dstStride=0xba5b30) at swscale.c:2305
> #3  0x00000000004b511f in scale (sws1=<value optimized out>, 
> sws2=0xb95bc0,
>    src=<value optimized out>, src_stride=0xba5aa0, y=0, h=480, 
> dst=0xba5b10,
>    dst_stride=0xba5b30, interlaced=0) at vf_scale.c:300
> #4  0x00000000004b5247 in put_image (vf=0xb94d90, mpi=0xba5a60)
>    at vf_scale.c:330
> #5  0x000000000048d925 in decode_video (sh_video=0xb896f0,
>    start=<value optimized out>, in_size=<value optimized out>, 
> drop_frame=0)
>    at dec_video.c:334
> #6  0x000000000043d596 in main (argc=0, argv=0x7fffffffdda8) at 
> mplayer.c:2368
> (gdb) disass $pc-32 $pc+32
> Dump of assembler code from 0x559df5 to 0x559e35:
> 0x0000000000559df5 <rgb24toyv12_MMX2+181>:      mov    %eax,%eax
> 0x0000000000559df7 <rgb24toyv12_MMX2+183>:      movq   0x812c78,%mm6
> 0x0000000000559dff <rgb24toyv12_MMX2+191>:      movq   0x812c50,%mm5
> 0x0000000000559e07 <rgb24toyv12_MMX2+199>:      pxor   %mm7,%mm7
> 0x0000000000559e0a <rgb24toyv12_MMX2+202>:      lea    (%rax,%rax,2),%rbx
> 0x0000000000559e0e <rgb24toyv12_MMX2+206>:      data16
> 0x0000000000559e0f <rgb24toyv12_MMX2+207>:      nop
> 0x0000000000559e10 <rgb24toyv12_MMX2+208>:      prefetchnta 
> 0x40(%rcx,%rbx,1)
> 0x0000000000559e15 <rgb24toyv12_MMX2+213>:      movd   (%rcx,%rbx,1),%mm0
> 0x0000000000559e19 <rgb24toyv12_MMX2+217>:      movd   
> 0x3(%rcx,%rbx,1),%mm1
> 0x0000000000559e1e <rgb24toyv12_MMX2+222>:      punpcklbw %mm7,%mm0
> 0x0000000000559e21 <rgb24toyv12_MMX2+225>:      punpcklbw %mm7,%mm1
> 0x0000000000559e24 <rgb24toyv12_MMX2+228>:      movd   
> 0x6(%rcx,%rbx,1),%mm2
> 0x0000000000559e29 <rgb24toyv12_MMX2+233>:      movd   
> 0x9(%rcx,%rbx,1),%mm3
> 0x0000000000559e2e <rgb24toyv12_MMX2+238>:      punpcklbw %mm7,%mm2
> 0x0000000000559e31 <rgb24toyv12_MMX2+241>:      punpcklbw %mm7,%mm3
> 0x0000000000559e34 <rgb24toyv12_MMX2+244>:      pmaddwd %mm6,%mm0
> End of assembler dump.
> (gdb) info all-registers
> rax            0xfffffd80       4294966656
> rbx            0x2fffff880      12884899968
> rcx            0x2aaab02fe790   46912588736400
> rdx            0x2aaab04c22c0   46912590586560
> rsi            0x0      0
> rdi            0x2aaab02fe010   46912588734480
> rbp            0x2aaab04c2040   0x2aaab04c2040
> rsp            0x7fffffffc728   0x7fffffffc728
> r8             0xfffffd80       4294966656
> r9             0x780    1920
> r10            0x2aaab02fe010   46912588734480
> r11            0xfffffec0       4294966976
> r12            0x140    320
> r13            0x2aaab050d040   46912590893120
> r14            0x2aaab051fc40   46912590969920
> r15            0xf00    3840
> rip            0x559e15 0x559e15 <rgb24toyv12_MMX2+213>
> eflags         0x210246 2163270
> cs             0x33     51
> ss             0x2b     43
> ds             0x0      0
> es             0x0      0
> fs             0x0      0
> gs             0x0      0
> st0            0        (raw 0x00000000000000000000)
> st1            0        (raw 0x00000000000000000000)
> st2            0        (raw 0x00000000000000000000)
> st3            0        (raw 0x00000000000000000000)
> st4            0        (raw 0x00000000000000000000)
> st5            -nan(0x1000100010001)    (raw 0xffff0001000100010001)
> st6            -nan(0x210041000d)       (raw 0xffff000000210041000d)
> st7            <invalid float value>    (raw 0xffff0000000000000000)
> fctrl          0x37f    895
> fstat          0x0      0
> ftag           0xa955   43349
> fiseg          0x0      0
> ---Type <return> to continue, or q <return> to quit---
> fioff          0x0      0
> foseg          0x0      0
> fooff          0x0      0
> fop            0x0      0
> xmm0           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {-0, 0.415959984, 
> 0, 0}}
> xmm1           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm2           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm3           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm4           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm5           {f = {0x1, 0x0, 0x0, 0x0}}       {f = {1.33333337, 0, 
> 0, 0}}
> xmm6           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm7           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm8           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm9           {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm10          {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm11          {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm12          {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm13          {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm14          {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> xmm15          {f = {0x0, 0x0, 0x0, 0x0}}       {f = {0, 0, 0, 0}}
> mxcsr          0x1fa1   8097
>
>
> _______________________________________________
> MPlayer-users mailing list
> MPlayer-users at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-users
>
>
> !DSPAM:42fe23a8119271882950394!
>
>




More information about the MPlayer-users mailing list