S3C6410 TVout 测试

本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2011-11/47800.htm

一.tvout_app的移植




为了测试S3C6410的电视输出,我拿了官方的tvout_app中的测试,这个做的相当初糙,好象是很老的版本,在更改了Makefile后编译,最后发现有函数未定义
/home/huisen/project/tvout/tvout_app/tv_test.c:450: undefined reference to `s3c_get_media_memory'




查看源码是这个原因造成的
  ctrl.value = POST_BUFF_BASE_ADDR;
 而这个宏是如下定义
  #define POST_BUFF_BASE_ADDR (UINT32)s3c_get_media_memory(S3C_MDEV_TV)




 这个应用程序直接调用驱动里的函数,这在LINUX是不可以的。我估计三星也没把这TVOUT当回事,直接就发布了,编译通不过也不管。虽然在培训上s3c6410用的很多,但是很多细节上来看,在花了很长时间做s3c2440后,三星匆忙推出s3c6410,然后大队人马就去搞s5p系列了。留一下一堆问题。




  一种最简单方法是扩展s3c-tvenc的驱动,增加一个VIDIOC_G_CTRL的ioctl指令,让其在驱动中调用s3c_get_media_memory.




在s3c-tvenc.c 增加如下代码:
   新增函数: s3c_tvenc_get_v4l2_control()
   在s3c_tvenc_do_ioctl()增加命令支持
  
static int s3c_tvenc_get_v4l2_control(struct v4l2_control *ctrl)


{


  switch(ctrl->id) {


      case V4L2_CID_MPEG_STREAM_PID_VIDEO:


         ctrl->value = tv_param.sp.SrcFrmSt;


         return 0;


      default:


        return -EINVAL;


    }


    return 0;


  


}






static int s3c_tvenc_do_ioctl(struct inode *inode,struct file *filp,unsigned int cmd,void *arg)


{


 // ...


 /* add by Andrew Huang */


    case VIDIOC_G_CTRL:


        {


            struct v4l2_control *ctrl = arg;


            //printk("P: VIDIOC_S_CTRL \n");


            ret = s3c_tvenc_get_v4l2_control(ctrl);


            return ret;


        }


    // ...    


}
 
修改tv_test.c 代码,增加对上述ioctl命令的调用
修改 450行,增加如下代码




//add by Andrew Huang 


#if 1


       ret = ioctl(tvout_fp, VIDIOC_G_CTRL, &ctrl);


        if(ret < 0) {


            printf("V4L2 APPL : ioctl(VIDIOC_G_CTRL) failed\n");


            goto err;


        }        


#else 


        //ctrl.value = POST_BUFF_BASE_ADDR;        // 编译通不过


#endif




  去掉一些编译警告后,可以测试了。
[root@huisen tvout_app]# make clean 
rm -f tv_test ./tv_test.o ./FrameExtractor.o ./SsbSipH264Decode.o ./H264Frames.o ./SsbSipMfcDecode.o ./SsbSipLogMsg.o 
[root@huisen tvout_app]# make 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o tv_test.o tv_test.c 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o FrameExtractor.o FrameExtractor.c 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o SsbSipH264Decode.o SsbSipH264Decode.c 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o H264Frames.o H264Frames.c 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o SsbSipMfcDecode.o SsbSipMfcDecode.c 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o SsbSipLogMsg.o SsbSipLogMsg.c 
arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -o tv_test ./tv_test.o ./FrameExtractor.o ./SsbSipH264Decode.o ./H264Frames.o ./SsbSipMfcDecode.o ./SsbSipLogMsg.o -lpthread


本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2011-11/47800.htm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值