S3C6410的tv out输出lcd的内容

http://blog.chinaunix.net/uid-20587912-id-2940408.html

一.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()增加命令支持
  
  1. static int s3c_tvenc_get_v4l2_control(struct v4l2_control *ctrl)
  2. {
  3.   switch(ctrl->id) {
  4.       case V4L2_CID_MPEG_STREAM_PID_VIDEO:
  5.          ctrl->value = tv_param.sp.SrcFrmSt;
  6.          return 0;
  7.       default:
  8.         return -EINVAL;
  9.     }
  10.     return 0;
  11.   
  12. }

  13. static int s3c_tvenc_do_ioctl(struct inode *inode,struct file *filp,unsigned int cmd,void *arg)
  14. {
  15.  // ...
  16.  /* add by Andrew Huang */
  17.     case VIDIOC_G_CTRL:
  18.         {
  19.             struct v4l2_control *ctrl = arg;
  20.             //printk("P: VIDIOC_S_CTRL \n");
  21.             ret = s3c_tvenc_get_v4l2_control(ctrl);
  22.             return ret;
  23.         }
  24.     // ...    
  25. }
 
修改tv_test.c 代码,增加对上述ioctl命令的调用
修改 450行,增加如下代码

  1. //add by Andrew Huang 
  2. #if 1
  3.        ret = ioctl(tvout_fp, VIDIOC_G_CTRL, &ctrl);
  4.         if(ret < 0) {
  5.             printf("V4L2 APPL : ioctl(VIDIOC_G_CTRL) failed\n");
  6.             goto err;
  7.         }        
  8. #else 
  9.         //ctrl.value = POST_BUFF_BASE_ADDR;        // 编译通不过
  10. #endif

  去掉一些编译警告后,可以测试了。
  1. [root@huisen tvout_app]# make clean
  2. rm -f tv_test ./tv_test.o ./FrameExtractor.o ./SsbSipH264Decode.o ./H264Frames.o ./SsbSipMfcDecode.o ./SsbSipLogMsg.o
  3. [root@huisen tvout_app]# make
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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

  二.测试电视电视输出
   
  你可以直接使用一个电视机,当然有时比较麻烦,有时不好找,或者用电视机盒转到VGA的显示器上.
  我使用专业一点的AV/TV 8"的监视器,这是我用用来做高清摄像头,DVR开发的,这时可以用来测试一下S3C6410的TV输出,将其输入信号变成AV信号
   
  测试1:将LCD的显示结果发送到TV上
     ./tv_test 0  
  运行时能看电视屏幕显示LCD的效果,操作LCD,TV同步更新.注意这里设备结点是(/dev/video14)


   
  三.测试H.264输出
  第一次测试,H.264失败
   
  1. [root@hxy tvout_app]# ./tv_test 1 slamtv60.264
  2. This mode works with MFC decoder
  3. SsbSipH264DecodeExe:1
  4. H.264 Decoder Configuration Failed.
   首先在Linux 2.6.28.6中有两个MFC驱动,查看.config使用的是 CONFIG_VIDEO_MFC10,即MFC 1.0的驱动

后试着换了一下三星自带两个测试视频.可以正常的电视上播放
 
  1. [root@FriendlyARM tvout_app]# ./tv_test 1 wanted.264
  2. This mode works with MFC decoder
  3. width=640 height=480.
  4. Device file open
  5. V4L2 APPL : Name of the interface is S3C TV-OUT driveTVENCODER
  6. V4L2 APPL : [1]: IN channel name Memory input (MSDMA)
  7. V4L2 APPL : DMA INPUT
  8. V4L2 APPL : [0]: OUT channel name TV-OUT
  9. V4L2 APPL : TV OUT

动画能正常播放,但是电影有点小卡.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值