aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-08-08 10:34:26 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2014-08-08 10:34:26 +0200
commiteeceb4b2e148f29fe1a46f3c25199c35fc39868b (patch)
tree088f854565eb438675543f509d9e9a68d8adfea8
parent0694075030e6290264953e48f225bc525aa6fa90 (diff)
qv4l2/v4l2-ctl: add support for 14x9 video aspect ratio.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/qv4l2/tpg-tab.cpp1
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp4
-rw-r--r--utils/v4l2-ctl/vivid-tpg.c17
-rw-r--r--utils/v4l2-ctl/vivid-tpg.h1
4 files changed, 22 insertions, 1 deletions
diff --git a/utils/qv4l2/tpg-tab.cpp b/utils/qv4l2/tpg-tab.cpp
index 2b69d633..8ef1bbe9 100644
--- a/utils/qv4l2/tpg-tab.cpp
+++ b/utils/qv4l2/tpg-tab.cpp
@@ -102,6 +102,7 @@ void ApplicationWindow::addTpgTab(int m_winWidth)
combo = new QComboBox(w);
combo->addItem("Source Width x Height");
combo->addItem("4x3");
+ combo->addItem("14x9");
combo->addItem("16x9");
combo->addItem("16x9 Anamorphic");
addWidget(grid, combo);
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 60905fe7..1c901bbb 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -97,7 +97,7 @@ void streaming_usage(void)
" <aspect> can be one of: square, ntsc, pal\n"
" --stream-out-video-aspect=<aspect\n"
" select a video aspect ratio. The default is to use the frame ratio.\n"
- " <aspect> can be one of: 4x3, 16x9, anamorphic\n"
+ " <aspect> can be one of: 4x3, 14x9, 16x9, anamorphic\n"
" --stream-out-alpha=<alpha-value>\n"
" value to use for the alpha component, range 0-255. The default is 0.\n"
" --stream-out-alpha-red-only\n"
@@ -318,6 +318,8 @@ void streaming_cmd(int ch, char *optarg)
case OptStreamOutVideoAspect:
if (!strcmp(optarg, "4x3"))
stream_out_video_aspect = TPG_VIDEO_ASPECT_4X3;
+ else if (!strcmp(optarg, "14x9"))
+ stream_out_video_aspect = TPG_VIDEO_ASPECT_14X9_CENTRE;
else if (!strcmp(optarg, "16x9"))
stream_out_video_aspect = TPG_VIDEO_ASPECT_16X9_CENTRE;
else if (!strcmp(optarg, "anamorphic"))
diff --git a/utils/v4l2-ctl/vivid-tpg.c b/utils/v4l2-ctl/vivid-tpg.c
index 5bb60c56..13b6e5f0 100644
--- a/utils/v4l2-ctl/vivid-tpg.c
+++ b/utils/v4l2-ctl/vivid-tpg.c
@@ -50,6 +50,7 @@ const char * const tpg_pattern_strings[] = {
const char * const tpg_aspect_strings[] = {
"Source Width x Height",
"4x3",
+ "14x9",
"16x9",
"16x9 Anamorphic",
NULL
@@ -832,6 +833,22 @@ static void tpg_calculate_square_border(struct tpg_data *tpg)
tpg->border.height = ((3 * w) / 4) & ~1;
tpg->border.top = (h - tpg->border.height) / 2;
break;
+ case TPG_VIDEO_ASPECT_14X9_CENTRE:
+ if (tpg->pix_aspect) {
+ tpg->border.height = tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC ? 420 : 506;
+ tpg->border.top = (h - tpg->border.height) / 2;
+ break;
+ }
+ if (9 * w >= 14 * h) {
+ tpg->border.width = ((14 * h) / 9) & ~1;
+ if (((w - tpg->border.width) / 2) & ~1)
+ tpg->border.width -= 2;
+ tpg->border.left = (w - tpg->border.width) / 2;
+ break;
+ }
+ tpg->border.height = ((9 * w) / 14) & ~1;
+ tpg->border.top = (h - tpg->border.height) / 2;
+ break;
case TPG_VIDEO_ASPECT_16X9_CENTRE:
if (tpg->pix_aspect) {
tpg->border.height = tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC ? 368 : 442;
diff --git a/utils/v4l2-ctl/vivid-tpg.h b/utils/v4l2-ctl/vivid-tpg.h
index 8ca49e46..1ac80390 100644
--- a/utils/v4l2-ctl/vivid-tpg.h
+++ b/utils/v4l2-ctl/vivid-tpg.h
@@ -92,6 +92,7 @@ enum tpg_quality {
enum tpg_video_aspect {
TPG_VIDEO_ASPECT_IMAGE,
TPG_VIDEO_ASPECT_4X3,
+ TPG_VIDEO_ASPECT_14X9_CENTRE,
TPG_VIDEO_ASPECT_16X9_CENTRE,
TPG_VIDEO_ASPECT_16X9_ANAMORPHIC,
};

Privacy Policy