aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-08-01 15:39:44 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-08-01 15:45:50 +0200
commit979cb55103fa8e8274806e496901203742c686d1 (patch)
tree69d6b003fc8ebfd0f85a635bb2e20af4add04ca5
parent043f46f5741e1a5caedf55d788e1a72aae3b7605 (diff)
downloadffmpeg-979cb55103fa8e8274806e496901203742c686d1.tar.gz
hevc: Split the sei parsing in 3 functions
-rw-r--r--libavcodec/hevc_sei.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 873899a9c6..590d9fd53a 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -118,6 +118,38 @@ static int decode_nal_sei_display_orientation(HEVCContext *s)
return 0;
}
+static int decode_nal_sei_prefix(HEVCContext *s, int type, int size)
+{
+ GetBitContext *gb = &s->HEVClc.gb;
+
+ switch (type) {
+ case 256: // Mismatched value from HM 8.1
+ return decode_nal_sei_decoded_picture_hash(s);
+ case SEI_TYPE_FRAME_PACKING:
+ return decode_nal_sei_frame_packing_arrangement(s);
+ case SEI_TYPE_DISPLAY_ORIENTATION:
+ return decode_nal_sei_display_orientation(s);
+ default:
+ av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
+ skip_bits_long(gb, 8 * size);
+ return 0;
+ }
+}
+
+static int decode_nal_sei_suffix(HEVCContext *s, int type, int size)
+{
+ GetBitContext *gb = &s->HEVClc.gb;
+
+ switch (type) {
+ case SEI_TYPE_DECODED_PICTURE_HASH:
+ return decode_nal_sei_decoded_picture_hash(s);
+ default:
+ av_log(s->avctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
+ skip_bits_long(gb, 8 * size);
+ return 0;
+ }
+}
+
static int decode_nal_sei_message(HEVCContext *s)
{
GetBitContext *gb = &s->HEVClc.gb;
@@ -137,27 +169,9 @@ static int decode_nal_sei_message(HEVCContext *s)
payload_size += byte;
}
if (s->nal_unit_type == NAL_SEI_PREFIX) {
- switch (payload_type) {
- case 256: // Mismatched value from HM 8.1
- return decode_nal_sei_decoded_picture_hash(s);
- case SEI_TYPE_FRAME_PACKING:
- return decode_nal_sei_frame_packing_arrangement(s);
- case SEI_TYPE_DISPLAY_ORIENTATION:
- return decode_nal_sei_display_orientation(s);
- default:
- av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", payload_type);
- skip_bits(gb, 8 * payload_size);
- return 0;
- }
+ return decode_nal_sei_prefix(s, payload_type, payload_size);
} else { /* nal_unit_type == NAL_SEI_SUFFIX */
- switch (payload_type) {
- case SEI_TYPE_DECODED_PICTURE_HASH:
- return decode_nal_sei_decoded_picture_hash(s);
- default:
- av_log(s->avctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", payload_type);
- skip_bits(gb, 8 * payload_size);
- return 0;
- }
+ return decode_nal_sei_suffix(s, payload_type, payload_size);
}
return 0;
}