package: v4l2test: Fix zero size file for rawdata format
This commit is contained in:
@@ -33,6 +33,25 @@ void dump_fourcc(uint32_t fourcc)
|
|||||||
fourcc >> 24);
|
fourcc >> 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int is_raw_v4l2fmt(uint32_t format)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
case V4L2_PIX_FMT_SRGGB12:
|
||||||
|
case V4L2_PIX_FMT_SGRBG12:
|
||||||
|
case V4L2_PIX_FMT_SGBRG12:
|
||||||
|
case V4L2_PIX_FMT_SBGGR12:
|
||||||
|
ret = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// convert v4l2 format to fb format
|
// convert v4l2 format to fb format
|
||||||
int v4l2fmt_to_fbfmt(uint32_t format)
|
int v4l2fmt_to_fbfmt(uint32_t format)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ extern void jpegWrite(unsigned char* img, char* jpegFilename,
|
|||||||
uint32_t width, uint32_t height, int jpegQuality);
|
uint32_t width, uint32_t height, int jpegQuality);
|
||||||
extern int write_JPEG_file(char * filename,unsigned char *image_buffer,
|
extern int write_JPEG_file(char * filename,unsigned char *image_buffer,
|
||||||
int image_width, int image_height, int quality);
|
int image_width, int image_height, int quality);
|
||||||
|
extern int is_raw_v4l2fmt(uint32_t format);
|
||||||
// inline int clip(int value, int min, int max) {
|
// inline int clip(int value, int min, int max) {
|
||||||
// return (value > max ? max : value < min ? min : value);
|
// return (value > max ? max : value < min ? min : value);
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -614,7 +614,9 @@ static void mainloop()
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gp_cfg_param->rec_fp && gp_cfg_param->jpegFilename) {
|
if (!gp_cfg_param->rec_fp &&
|
||||||
|
gp_cfg_param->jpegFilename &&
|
||||||
|
!is_raw_v4l2fmt(gp_cfg_param->v4l2_param.format)) {
|
||||||
gp_cfg_param->rec_fp = fopen(gp_cfg_param->jpegFilename, "w+");
|
gp_cfg_param->rec_fp = fopen(gp_cfg_param->jpegFilename, "w+");
|
||||||
if (!gp_cfg_param->rec_fp) {
|
if (!gp_cfg_param->rec_fp) {
|
||||||
LOG(STF_LEVEL_ERR, "can't open %s\n", gp_cfg_param->jpegFilename);
|
LOG(STF_LEVEL_ERR, "can't open %s\n", gp_cfg_param->jpegFilename);
|
||||||
|
|||||||
Reference in New Issue
Block a user