summaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_metadata_bsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/h264_metadata_bsf.c')
-rw-r--r--libavcodec/h264_metadata_bsf.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index 6a1904e..62a5547 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -1,18 +1,18 @@
/*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -62,6 +62,7 @@ typedef struct H264MetadataContext {
int crop_bottom;
const char *sei_user_data;
+ int sei_first_au;
} H264MetadataContext;
@@ -288,13 +289,16 @@ 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) {
+ // 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)) {
H264RawSEI *sei;
H264RawSEIPayload *payload;
H264RawSEIUserDataUnregistered *udu;
int sei_pos, sei_new;
+ ctx->sei_first_au = 1;
+
for (i = 0; i < au->nb_units; i++) {
if (au->units[i].type == H264_NAL_SEI ||
au->units[i].type == H264_NAL_SLICE ||
@@ -450,7 +454,7 @@ static const AVOption h264_metadata_options[] = {
{ "sample_aspect_ratio", "Set sample aspect ratio (table E-1)",
OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL,
- { .i64 = 0 }, 0, 65535 },
+ { .dbl = 0.0 }, 0, 65535 },
{ "video_format", "Set video format (table E-2)",
OFFSET(video_format), AV_OPT_TYPE_INT,
@@ -474,7 +478,7 @@ static const AVOption h264_metadata_options[] = {
{ "tick_rate", "Set VUI tick rate (num_units_in_tick / time_scale)",
OFFSET(tick_rate), AV_OPT_TYPE_RATIONAL,
- { .i64 = 0 }, 0, UINT_MAX },
+ { .dbl = 0.0 }, 0, UINT_MAX },
{ "fixed_frame_rate_flag", "Set VUI fixed frame rate flag",
OFFSET(fixed_frame_rate_flag), AV_OPT_TYPE_INT,
{ .i64 = -1 }, -1, 1 },
@@ -502,7 +506,7 @@ static const AVClass h264_metadata_class = {
.class_name = "h264_metadata_bsf",
.item_name = av_default_item_name,
.option = h264_metadata_options,
- .version = LIBAVCODEC_VERSION_MAJOR,
+ .version = LIBAVUTIL_VERSION_INT,
};
static const enum AVCodecID h264_metadata_codec_ids[] = {
OpenPOWER on IntegriCloud