diff options
author | Simon Ser <simon.ser@intel.com> | 2019-07-19 17:11:09 +0300 |
---|---|---|
committer | Simon Ser <simon.ser@intel.com> | 2019-08-15 15:00:08 +0300 |
commit | f34d6dd8a0243c66198a111866e9107dc8ed5e43 (patch) | |
tree | 1363f1a1a3643871e2d789067bdf5e7ee8924567 /lib/igt_infoframe.c | |
parent | 87209d8421ea3ec3ca2207100f4897c4168011b8 (diff) |
lib/igt_infoframe: add support for AVI InfoFrames
This commit adds partial support for AVI InfoFrames. Only bytes 1 and 2 of the
InfoFrame payload are parsed.
These bytes contain (among other things) information about the aspect ratio of
the frames.
Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_infoframe.c')
-rw-r--r-- | lib/igt_infoframe.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/igt_infoframe.c b/lib/igt_infoframe.c index 7e4fb458..2e14fe70 100644 --- a/lib/igt_infoframe.c +++ b/lib/igt_infoframe.c @@ -27,6 +27,7 @@ #include <string.h> +#include "igt_core.h" #include "igt_infoframe.h" /** @@ -61,6 +62,35 @@ static const int sample_sizes[] = { static const size_t sample_sizes_len = sizeof(sample_sizes) / sizeof(sample_sizes[0]); +bool infoframe_avi_parse(struct infoframe_avi *infoframe, int version, + const uint8_t *buf, size_t buf_size) +{ + memset(infoframe, 0, sizeof(*infoframe)); + + switch (version) { + case 2: + case 3: + case 4: + break; /* supported */ + default: + igt_debug("Unsuppported AVI InfoFrame version: %d\n", version); + return false; + } + + if (buf_size < 13) + return false; + + infoframe->rgb_ycbcr = buf[0] >> 5; + infoframe->scan = buf[0] & 0x3; + + infoframe->colorimetry = buf[1] >> 6; + infoframe->picture_aspect_ratio = (buf[1] >> 4) & 0x3; + infoframe->active_aspect_ratio = buf[1] & 0xF; + infoframe->vic = buf[3]; + + return true; +} + bool infoframe_audio_parse(struct infoframe_audio *infoframe, int version, const uint8_t *buf, size_t buf_size) { |