资源简介
基于S5PV210芯片,实时采集摄像头数据,经过H.264编码后,通过RTP协议发送,可在电脑端通过VLC播放器实时播放开发板的摄像头视频。

代码片段和文件信息
#include
#include
#include
#include
#include /* getopt_long() */
#include /* low-level i/o */
#include
#include
#include
#include
#include
#include
#include
#include /* for videodev2.h */
#include
#include “camera.h“
#include “videodev2_samsung.h“
void Camera::DecodeYUV420SP(unsigned int* rgbBuf unsigned char* yuv420sp int width int height) {
int frameSize = width * height;
int i = 0 y = 0;
int uvp = 0 u = 0 v = 0;
int y1192 = 0 r = 0 g = 0 b = 0;
unsigned int xrgb8888;
int xrgb8888Index = 0;
for (int j = 0 yp = 0; j < height; j++) {
uvp = frameSize + (j >> 1) * width;
u = 0;
v = 0;
for (i = 0; i < width; i++ yp++) {
y = (0xff & ((int) yuv420sp[yp])) - 16;
if (y < 0) y = 0;
if ((i & 1) == 0) {
v = (0xff & yuv420sp[uvp++]) - 128;
u = (0xff & yuv420sp[uvp++]) - 128;
}
y1192 = 1192 * y;
r = (y1192 + 1634 * u);
g = (y1192 - 833 * u - 400 * v);
b = (y1192 + 2066 * v);
if (r < 0) r = 0; else if (r > 262143) r = 262143;
if (g < 0) g = 0; else if (g > 262143) g = 262143;
if (b < 0) b = 0; else if (b > 262143) b = 262143;
r = (unsigned char)(r >> 10);
g = (unsigned char)(g >> 10);
b = (unsigned char)(b >> 10);
xrgb8888 = (unsigned int)((r << 16) | (g << 8) | b);
rgbBuf[xrgb8888Index++] = xrgb8888;
}
}
}
Camera::Camera(char *DEV_NAME int w int h)
{
memcpy(dev_nameDEV_NAMEstrlen(DEV_NAME));
io = IO_METHOD_MMAP;//IO_METHOD_READ;//IO_METHOD_MMAP;
cap_image_size=0;
width=w;
height=h;
}
Camera::~Camera(){
}
unsigned int Camera::getImageSize(){
return cap_image_size;
}
void Camera::CloseDevice() {
stop_capturing();
uninit_device();
close_device();
}
void Camera::errno_exit(const char * s) {
fprintf(stderr “%s error %d %s\n“ s errno strerror(errno));
exit(EXIT_FAILURE);
}
int Camera::xioctl(int fd int request void * arg) {
int r;
do
r = ioctl(fd request arg);
while (-1 == r && EINTR == errno);
return r;
}
int Camera::read_frame(unsigned char *image) {
struct v4l2_buffer buf;
//CLEAR (buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
if (-1 == xioctl(fd VIDIOC_DQBUF &buf)) {
switch (errno) {
case EAGAIN:
return 0;
case EIO:
/* Could ignore EIO see spec. */
/* fall through */
default:
errno_exit(“VIDIOC_DQBUF“);
}
}
assert(buf.index < CAPTURE_BUFFER_NUMBER);
memcpy(imagebuffers[buf.index].startcap_image_size);
if (-1 == xioctl(fd
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 101 2016-01-18 16:38 pla
目录 0 2016-01-19 11:44 RTP\
文件 6472 2016-01-15 13:24 RTP\.cproject
文件 831 2016-01-15 13:24 RTP\.project
目录 0 2016-01-15 13:24 RTP\.settings\
文件 1096 2016-01-15 13:24 RTP\.settings\language.settings.xm
文件 9702 2016-01-05 10:44 RTP\camera.cpp
文件 1355 2016-01-05 10:30 RTP\camera.h
文件 8928 2016-01-19 11:44 RTP\camera.o
文件 2533 2016-01-19 10:42 RTP\h264.h
文件 1986 2016-01-18 16:28 RTP\main.cpp
文件 4512 2016-01-19 11:44 RTP\main.o
文件 709 2016-01-18 14:41 RTP\Makefile
文件 4644 2016-01-18 16:15 RTP\mfc.cpp
文件 702 2016-01-05 10:16 RTP\mfc.h
文件 3644 2016-01-19 11:44 RTP\mfc.o
文件 18495 2015-12-04 11:47 RTP\mfc_interface.h
文件 92 2016-01-15 14:00 RTP\rtpRecv.cpp
文件 4860 2016-01-19 11:41 RTP\rtpSend.cpp
文件 3764 2016-01-19 11:44 RTP\rtpSend.o
文件 29732 2016-01-19 11:44 RTP\rtp_vlc
文件 16207 2015-12-04 11:45 RTP\SsbSipMfcApi.h
文件 26275 2016-01-05 10:49 RTP\SsbSipMfcEncAPI.c
文件 9252 2016-01-19 11:44 RTP\SsbSipMfcEncAPI.o
文件 21041 2012-06-13 15:37 RTP\videodev2_samsung.h
- 上一篇:数字逻辑电路红绿灯设计
- 下一篇:ZigBee 协议在Linux上的实现
相关资源
- MT6771T_LTE-A_Smartphone_Application_Processor
- 在QT中使用RTP进行视频的采集和传输
- 流媒体相关协议标准RTP/RTSP/RTCP PDF文档
- 海思rtp封包发送
- smartprinter3.6免注册
- RtspRtcpRtpLoad_h264.tar.gz
- 简单的RTSP RTP RTCP推送H264码流服务器实
- rtsp 服务器代码,VC可编译使用,RTS
- DDS-RTPS 实时发布订阅协议 DDS互操作协
- h264码流rtp传输demo
- linux 使用jrtplib收发h.264视频文件
- live555 RTSP RTCP RTP。live555类关系图,
- udp码流接收录制工具
- H264流媒体RTP打包源代码和相关资料
- SmartPrinter3.6破解版(附带命令行与批
- linux+QT下基于RTP协议的实时视频传输客
- 基于ARM的嵌入式网络视频监控系统的
- 微积分_Stewart_第六版Calculus6th edition
- 接收RTP包保存为h264文件
- H264编解码rtp发送
- onvif协议源码rtsp,rtp,gb28181等等协议
- 使用jrtplib发送和接收网络流支持解码
- 使用jrtplib发送和接收的--PlayStream V1
- ffmpegjrtplib.zip
- Linux 下RTP实时打包发送H.264码流
- live555-20181214基于ARM-linux从网络摄像机
- ScreenReceiver46接收rtp流解析并解码播放
- GES SRTP OPC Server
- Qt基于RTP打包H.264
- 岳维功 ortp-realease.pdf
评论
共有 条评论