aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-04 00:49:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-04 00:52:54 +0200
commit6da7625cc395692a71c99d179cb76eea6e8b27ca (patch)
treee9cc769a62e44a17288e89aab2139a91e4e79402 /libavcodec/h264.c
parent959894632ae67e356ede734e352eabda6bb55794 (diff)
parenta4d34e218f548d381e09c483e8dc6ad18a8d571c (diff)
downloadffmpeg-6da7625cc395692a71c99d179cb76eea6e8b27ca.tar.gz
Merge commit 'a4d34e218f548d381e09c483e8dc6ad18a8d571c'
* commit 'a4d34e218f548d381e09c483e8dc6ad18a8d571c': h264: disable ER by default Conflicts: libavcodec/h264.c libavcodec/h264_picture.c libavcodec/h264_slice.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 1c990c383d..a795597193 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -702,6 +702,12 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
ff_h264_flush_change(h);
+ if (h->enable_er) {
+ av_log(avctx, AV_LOG_WARNING,
+ "Error resilience is enabled. It is unsafe and unsupported and may crash. "
+ "Use it at your own risk\n");
+ }
+
return 0;
}
@@ -1925,6 +1931,22 @@ static av_cold int h264_decode_end(AVCodecContext *avctx)
return 0;
}
+#define OFFSET(x) offsetof(H264Context, x)
+#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption h264_options[] = {
+ {"is_avc", "is avc", offsetof(H264Context, is_avc), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 0},
+ {"nal_length_size", "nal_length_size", offsetof(H264Context, nal_length_size), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0},
+ { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VD },
+ { NULL },
+};
+
+static const AVClass h264_class = {
+ .class_name = "H264 Decoder",
+ .item_name = av_default_item_name,
+ .option = h264_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
static const AVProfile profiles[] = {
{ FF_PROFILE_H264_BASELINE, "Baseline" },
{ FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" },
@@ -1942,19 +1964,6 @@ static const AVProfile profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
-static const AVOption h264_options[] = {
- {"is_avc", "is avc", offsetof(H264Context, is_avc), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 0},
- {"nal_length_size", "nal_length_size", offsetof(H264Context, nal_length_size), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0},
- {NULL}
-};
-
-static const AVClass h264_class = {
- .class_name = "H264 Decoder",
- .item_name = av_default_item_name,
- .option = h264_options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
AVCodec ff_h264_decoder = {
.name = "h264",
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),