summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-07-10 14:45:14 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-07-17 10:47:48 +0200
commite1319aa1c1be9b64117c19170344fb78841dd67c (patch)
tree719d119e4cccc17ecce1f1cb6a6534f75130df12 /libavcodec/libx264.c
parent0cf5588d69922aa3e063bac6304c09c543a9ef52 (diff)
libx264: Add support for the MPEG2 encoder
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 7c502fd53b..5d257ef889 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -323,7 +323,14 @@ static av_cold int X264_init(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
+#if CONFIG_LIBX262_ENCODER
+ if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ x4->params.b_mpeg2 = 1;
+ x264_param_default_mpeg2(&x4->params);
+ } else
+#else
x264_param_default(&x4->params);
+#endif
x4->params.b_deblocking_filter = avctx->flags & CODEC_FLAG_LOOP_FILTER;
@@ -663,13 +670,6 @@ static const AVOption options[] = {
{ NULL },
};
-static const AVClass class = {
- .class_name = "libx264",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
static const AVCodecDefault x264_defaults[] = {
{ "b", "0" },
{ "bf", "-1" },
@@ -698,6 +698,14 @@ static const AVCodecDefault x264_defaults[] = {
{ NULL },
};
+#if CONFIG_LIBX264_ENCODER
+static const AVClass class = {
+ .class_name = "libx264",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVCodec ff_libx264_encoder = {
.name = "libx264",
.long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
@@ -714,3 +722,30 @@ AVCodec ff_libx264_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
};
+#endif
+
+#if CONFIG_LIBX262_ENCODER
+static const AVClass X262_class = {
+ .class_name = "libx262",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_libx262_encoder = {
+ .name = "libx262",
+ .long_name = NULL_IF_CONFIG_SMALL("libx262 MPEG2VIDEO"),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .priv_data_size = sizeof(X264Context),
+ .init = X264_init,
+ .encode2 = X264_frame,
+ .close = X264_close,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
+ .priv_class = &X262_class,
+ .defaults = x264_defaults,
+ .pix_fmts = pix_fmts_8bit,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
+ FF_CODEC_CAP_INIT_CLEANUP,
+};
+#endif