aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-02-11 15:41:07 +0000
committerMark Thompson <sw@jkqxz.net>2018-02-20 22:04:12 +0000
commit78fa0b9033c0834c049e2aedf71a8c613fed87ab (patch)
tree718719c47cbe7c1ce5dc5d72daf51a44165b3688
parent69062d0f9b6aef5d9d9b8c9c9b5cfb23037caddb (diff)
downloadffmpeg-78fa0b9033c0834c049e2aedf71a8c613fed87ab.tar.gz
h264_metadata: Always add the SEI user data to the first access unit
This should be added even if the first access unit does not contain parameter sets.
-rw-r--r--libavcodec/h264_metadata_bsf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index 356daef3ec..d8d5487c99 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -62,6 +62,7 @@ typedef struct H264MetadataContext {
int crop_bottom;
const char *sei_user_data;
+ int sei_first_au;
} H264MetadataContext;
@@ -287,14 +288,17 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
}
}
- // Only insert the SEI in access units containing SPSs.
- if (has_sps && ctx->sei_user_data) {
+ // Only insert the SEI in access units containing SPSs, and also
+ // unconditionally in the first access unit we ever see.
+ if (ctx->sei_user_data && (has_sps || !ctx->sei_first_au)) {
H264RawSEIPayload payload = {
.payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED,
};
H264RawSEIUserDataUnregistered *udu =
&payload.payload.user_data_unregistered;
+ ctx->sei_first_au = 1;
+
for (i = j = 0; j < 32 && ctx->sei_user_data[i]; i++) {
int c, v;
c = ctx->sei_user_data[i];