add mipi camera
This commit is contained in:
parent
9979af232a
commit
c9ddc198fd
@ -6,6 +6,7 @@
|
|||||||
#include <GroupsockHelper.hh>
|
#include <GroupsockHelper.hh>
|
||||||
#include <liveMedia.hh>
|
#include <liveMedia.hh>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "CamFramedSource.h"
|
#include "CamFramedSource.h"
|
||||||
#include "CamUnicastServerMediaSubsession.h"
|
#include "CamUnicastServerMediaSubsession.h"
|
||||||
@ -67,4 +68,4 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -15,6 +15,7 @@ typedef struct
|
|||||||
int height;
|
int height;
|
||||||
int hor_stride;
|
int hor_stride;
|
||||||
int ver_stride;
|
int ver_stride;
|
||||||
|
int header_size;
|
||||||
int frame_size;
|
int frame_size;
|
||||||
int fps;
|
int fps;
|
||||||
int fix_qp;
|
int fix_qp;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
#define MPP_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
#define MPP_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
||||||
|
|
||||||
RkEncoder::RkEncoder(Encoder_Param_t param) : m_param(param)
|
RkEncoder::RkEncoder(Encoder_Param_t param) : m_param(param)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "INIReader.h"
|
#include "INIReader.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
TransCoder::TransCoder()
|
TransCoder::TransCoder()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@ -18,6 +19,7 @@ void TransCoder::init()
|
|||||||
std::list<uint32_t> formatList;
|
std::list<uint32_t> formatList;
|
||||||
v4l2IoType ioTypeIn = IOTYPE_MMAP;
|
v4l2IoType ioTypeIn = IOTYPE_MMAP;
|
||||||
MppFrameFormat mpp_fmt;
|
MppFrameFormat mpp_fmt;
|
||||||
|
v4l2_buf_type buf_type;
|
||||||
|
|
||||||
INIReader configs("./configs/config.ini");
|
INIReader configs("./configs/config.ini");
|
||||||
if (configs.ParseError() < 0) {
|
if (configs.ParseError() < 0) {
|
||||||
@ -34,12 +36,35 @@ void TransCoder::init()
|
|||||||
if (config.format == "YUY2") {
|
if (config.format == "YUY2") {
|
||||||
formatList.push_back(V4L2_PIX_FMT_YUYV);
|
formatList.push_back(V4L2_PIX_FMT_YUYV);
|
||||||
mpp_fmt = MPP_FMT_YUV422_YUYV;
|
mpp_fmt = MPP_FMT_YUV422_YUYV;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
} else if (config.format == "MJPEG") {
|
} else if (config.format == "MJPEG") {
|
||||||
formatList.push_back(V4L2_PIX_FMT_MJPEG);
|
formatList.push_back(V4L2_PIX_FMT_MJPEG);
|
||||||
mpp_fmt = MPP_FMT_YUV422P;
|
mpp_fmt = MPP_FMT_YUV422P;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
|
} else if (config.format == "NV12") {
|
||||||
|
formatList.push_back(V4L2_PIX_FMT_NV12);
|
||||||
|
mpp_fmt = MPP_FMT_YUV420SP;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
|
} else if (config.format == "NV21") {
|
||||||
|
formatList.push_back(V4L2_PIX_FMT_NV21);
|
||||||
|
mpp_fmt = MPP_FMT_YUV420SP_VU;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
|
} else if (config.format == "NV61") {
|
||||||
|
formatList.push_back(V4L2_PIX_FMT_NV16);
|
||||||
|
mpp_fmt = MPP_FMT_YUV422SP;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
|
} else if (config.format == "NV16") {
|
||||||
|
formatList.push_back(V4L2_PIX_FMT_NV61);
|
||||||
|
mpp_fmt = MPP_FMT_YUV422SP_VU;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
|
} else if (config.format == "UYVY") {
|
||||||
|
formatList.push_back(V4L2_PIX_FMT_UYVY);
|
||||||
|
mpp_fmt = MPP_FMT_YUV422_UYVY;
|
||||||
|
buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
V4L2DeviceParameters param(config.device_name.c_str(),
|
V4L2DeviceParameters param(config.device_name.c_str(),
|
||||||
formatList,
|
formatList,
|
||||||
config.width,
|
config.width,
|
||||||
@ -48,7 +73,9 @@ void TransCoder::init()
|
|||||||
ioTypeIn,
|
ioTypeIn,
|
||||||
DEBUG);
|
DEBUG);
|
||||||
|
|
||||||
capture = V4l2Capture::create(param);
|
|
||||||
|
|
||||||
|
capture = V4l2Capture::create(param, buf_type);
|
||||||
encodeData = (uint8_t *)malloc(capture->getBufferSize());
|
encodeData = (uint8_t *)malloc(capture->getBufferSize());
|
||||||
|
|
||||||
decompress = new DeCompress();
|
decompress = new DeCompress();
|
||||||
@ -85,9 +112,12 @@ void TransCoder::run()
|
|||||||
frameSize = rk_encoder->encode(yuv_buf, yuv_size, encodeData);
|
frameSize = rk_encoder->encode(yuv_buf, yuv_size, encodeData);
|
||||||
free(yuv_buf);
|
free(yuv_buf);
|
||||||
}
|
}
|
||||||
} else if (config.format == "YUY2") {
|
} else if (config.format != "MJPEG") {
|
||||||
frameSize = rk_encoder->encode(buffer, resize, encodeData);
|
frameSize = rk_encoder->encode(buffer, resize, encodeData);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(INFO, "encodeData size %d", frameSize);
|
LOG(INFO, "encodeData size %d", frameSize);
|
||||||
if (rk_encoder->startCode3(encodeData))
|
if (rk_encoder->startCode3(encodeData))
|
||||||
startCode = 3;
|
startCode = 3;
|
||||||
|
|||||||
2
thirdparty/libv4l2cc
vendored
2
thirdparty/libv4l2cc
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 86989e1caa9ce7cf895fe1ef3316a9dab41a9485
|
Subproject commit 33afc7753a1ddccc986871e7dc6403c1919e5ba8
|
||||||
Loading…
Reference in New Issue
Block a user