[FFmpeg-devel] [PATCH] hevc_sei: add support for User Data Unregistered SEI messages
James Almer
jamrial at gmail.com
Sat May 6 00:09:23 EEST 2017
Based on h264_sei code.
Only print the user data for now.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/hevc_sei.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index c5054bfaab..1d40ed9371 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -232,6 +232,30 @@ static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEIContext *s, GetB
return 0;
}
+static int decode_nal_unregistered_user_data(HEVCSEIContext *h, GetBitContext *gb,
+ void *logctx, int size)
+{
+ uint8_t *user_data;
+ int i;
+
+ if (size < 16 || size >= INT_MAX - 16)
+ return AVERROR_INVALIDDATA;
+
+ user_data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!user_data)
+ return AVERROR(ENOMEM);
+
+ for (i = 0; i < size; i++)
+ user_data[i] = get_bits(gb, 8);
+
+ if (strlen(user_data + 16) > 0)
+ av_log(logctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data + 16);
+
+ av_free(user_data);
+
+ return 0;
+}
+
static int active_parameter_sets(HEVCSEIContext *s, GetBitContext *gb, void *logctx)
{
int num_sps_ids_minus1;
@@ -288,6 +312,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, HEVCSEIContext *s, const HEV
return 0;
case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
+ case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
+ return decode_nal_unregistered_user_data(s, gb, logctx, size);
default:
av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
--
2.12.1
More information about the ffmpeg-devel
mailing list