[Arm-netbook] allwinner-a10-video EncoderDemo can not work
Hubert Liao
liao.hubertt at gmail.com
Mon Aug 13 08:02:13 BST 2012
On Sun, Aug 12, 2012 at 5:33 AM, Andrew Armenia <andrew at asquaredlabs.com> wrote:
> Hubert Liao <liao.hubertt <at> gmail.com> writes:
>
>>
>> Hi:
>>
>> I got the video source code from https://github.com/amery/allwinner-a10-video,
>> and try the EncoderDemo on Mele A1000 with a usb webcam, when I run it, the
>> output file h264.buf size is always 0.
>>
>> ./EncoderDemo
>> w: 640, h: 480, preview_left: 80, preview_top: 0, preview_h: 480,
>> preview_w : 640
>> video layer hdl:101
>> MODE: 2, format: 13
>> fb_layer hdl: 100
>> open H264Enc ok
>> to stream on
>> V4L2Camera::v4l2StartStreaming
>> V4L2Camera::v4l2StartStreaming OK
>> cru: 1586005820, last: 1586005799, 21
>> VIDIOC_DQBUF id: 0
>>
>> I found it stop at
>> g_pCedarV->encode(g_pCedarV);
>> in the while(1) loop, main.c line 139
>>
>> lack of the encode library source code, so I can not find the real stuck point
>> using gdb, maybe it stop at InitSPS @H264enclib.c
>>
>> (gdb) r
>> Starting program:
>> /root/Downloads/amery-allwinner-a10-video-9fa91df/a10_h264_encode/EncoderDemo
>> [Thread debugging using libthread_db enabled]
>> w: 640, h: 480, preview_left: 80, preview_top: 0, preview_h: 480,
>> preview_w : 640
>> video layer hdl:101
>> MODE: 2, format: 13
>> fb_layer hdl: 100
>> open H264Enc ok
>> to stream on
>> V4L2Camera::v4l2StartStreaming
>> V4L2Camera::v4l2StartStreaming OK
>> cru: -1547703669, last: -1547703690, 21
>> VIDIOC_DQBUF id: 0
>> ^C
>> Program received signal SIGINT, Interrupt.
>> 0x0000d4c0 in InitSPS (pDev=0x21090) at F20/H264encLib.c:81
>> 81 F20/H264encLib.c: No such file or directory.
>> in F20/H264encLib.c
>> (gdb) bt
>> #0 0x0000d4c0 in InitSPS (pDev=0x21090) at F20/H264encLib.c:81
>> #1 0x0000c1fc in H264EncEncode (pDev=0x21090) at F20/H264encDrv.c:843
>> #2 0x0000a4dc in main () at main.c:139
>>
>> Any help ? Thanks!
>>
>>
>
>
> On my MK802, the module clock is gated by default, preventing the H.264
> hardware from actually doing anything. I think it is getting stuck in a loop
> in InitSPS polling some hardware flag; the flag never comes due to the lack
> of clock. I threw together a small C program (included below) that will un-gate
> it; it sort of works for me but YMMV...
>
> -Andrew
>
> #include <stdio.h>
> #include <sys/mman.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <stdint.h>
>
> #define CCU_ADDR 0x01c20000
>
> int main() {
> int fd = open("/dev/mem", O_RDWR);
> volatile uint8_t *iomem;
> volatile uint32_t *reg;
>
> if (fd < 0) {
> perror("open /dev/mem");
> return 1;
> }
>
> iomem = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
> CCU_ADDR);
> reg = (uint32_t *)(iomem + 0x0064);
> fprintf(stderr, "reg was 0x%08x ", *reg);
> *reg |= 0x00000001;
> fprintf(stderr, "now 0x%08x\n", *reg);
>
> reg = (uint32_t *)(iomem + 0x013c);
> fprintf(stderr, "reg was 0x%08x ", *reg);
> *reg = 0x80050000;
> fprintf(stderr, "now 0x%08x\n", *reg);
> }
>
>
Thank you very much!
But on my mele a1000 it still can not work, I run this register modify program
before running the Encoderdemo, this time it repeat printing below
information and quit,
did not encode anything.
---
not encode, ret: -3
v4l2 should not release the same buffer twice continuous: index : 0
VIDIOC_QBUF failed, id: 0
I think this is because it can not capture video from the usb webcam,
I used the v4l2-example from
http://v4l2spec.bytesex.org/spec/capture-example.html
found in mainloop function the select( ) always timeout, it also
can't capture anything.
So, Andrew can you tell me which kernel you used and the modules?
thanks again !
>
> _______________________________________________
> arm-netbook mailing list arm-netbook at lists.phcomp.co.uk
> http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
> Send large attachments to arm-netbook at files.phcomp.co.uk
More information about the arm-netbook
mailing list