aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia
diff options
context:
space:
mode:
authorcpm <cpm@FreeBSD.org>2016-06-27 05:41:08 +0800
committercpm <cpm@FreeBSD.org>2016-06-27 05:41:08 +0800
commit635569e4d2a85abfb6583eb2b394637872a2b2d6 (patch)
treebe6a54db8cc4635670afe86d3c4319ca4bc1fd47 /multimedia
parent792e0558c33a3297a7bdacb94cc231fc93e0511c (diff)
downloadfreebsd-ports-gnome-635569e4d2a85abfb6583eb2b394637872a2b2d6.tar.gz
freebsd-ports-gnome-635569e4d2a85abfb6583eb2b394637872a2b2d6.tar.zst
freebsd-ports-gnome-635569e4d2a85abfb6583eb2b394637872a2b2d6.zip
- Update to 0.18.0 release
- Update waf to 1.9.0pre3 release - Remove unneeded patches (applied upstream) - Fix CONFIGURE_ARGS adding/disabling certain features - Add patches to fix "-Wmissing-braces" warning, so the compiler is happy - Switch to USES=localbase framework - Bump library version in pkg-plist Changelog: https://github.com/mpv-player/mpv/releases/tag/v0.18.0 Reviewed by: junovitch (mentor) Approved by: junovitch (mentor) Differential Revision: D6965
Diffstat (limited to 'multimedia')
-rw-r--r--multimedia/mpv/Makefile14
-rw-r--r--multimedia/mpv/distinfo9
-rw-r--r--multimedia/mpv/files/patch-audio_out_ao__lavc.c209
-rw-r--r--multimedia/mpv/files/patch-common_encode__lavc.c569
-rw-r--r--multimedia/mpv/files/patch-common_encode__lavc.h60
-rw-r--r--multimedia/mpv/files/patch-player_command.c11
-rw-r--r--multimedia/mpv/files/patch-video_out_opengl_hwdec__vaegl.c11
-rw-r--r--multimedia/mpv/files/patch-video_out_opengl_video.c31
-rw-r--r--multimedia/mpv/files/patch-video_out_vo__lavc.c163
-rw-r--r--multimedia/mpv/files/patch-wscript10
-rw-r--r--multimedia/mpv/pkg-plist2
11 files changed, 61 insertions, 1028 deletions
diff --git a/multimedia/mpv/Makefile b/multimedia/mpv/Makefile
index 0839973f2114..fed11b5889db 100644
--- a/multimedia/mpv/Makefile
+++ b/multimedia/mpv/Makefile
@@ -2,9 +2,8 @@
# $FreeBSD$
PORTNAME= mpv
-PORTVERSION= 0.17.0
+PORTVERSION= 0.18.0
DISTVERSIONPREFIX= v
-PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= multimedia audio
@@ -20,23 +19,18 @@ BUILD_DEPENDS= rst2man:textproc/py-docutils
USE_GITHUB= yes
GH_ACCOUNT= mpv-player waf-project:waf
GH_PROJECT= waf:waf
-GH_TAGNAME= waf-1.9.0pre1:waf
+GH_TAGNAME= waf-1.9.0pre3:waf
WAF_CMD= ${WRKSRC_waf}/waf-light
-USES= compiler:c11 desktop-file-utils iconv pkgconfig python:build waf
+USES= compiler:c11 desktop-file-utils iconv localbase pkgconfig python:build waf
USE_LDCONFIG= yes
-CPPFLAGS+= -I.. -I${LOCALBASE}/include
-LDFLAGS+= -L${LOCALBASE}/lib
-
CONFIGURE_ARGS= --docdir=${EXAMPLESDIR} \
--mandir=${MANPREFIX}/man \
--prefix=${PREFIX} \
--disable-debug-build \
- --disable-d3d11va-hwaccel \
- --disable-dxva2-hwaccel \
- --disable-gpl3 \
+ --disable-d3d-hwaccel \
--disable-optimize \
--disable-pdf \
--disable-rubberband \
diff --git a/multimedia/mpv/distinfo b/multimedia/mpv/distinfo
index 6dce23afbbdc..d9eeea38d278 100644
--- a/multimedia/mpv/distinfo
+++ b/multimedia/mpv/distinfo
@@ -1,4 +1,5 @@
-SHA256 (mpv-player-mpv-v0.17.0_GH0.tar.gz) = 602cd2b0f5fc7e43473234fbb96e3f7bbb6418f15eb8fa720d9433cce31eba6e
-SIZE (mpv-player-mpv-v0.17.0_GH0.tar.gz) = 2882629
-SHA256 (waf-project-waf-waf-1.9.0pre1_GH0.tar.gz) = c4f971db873fedb93af163a4245a25ac80f76ebbf138acc257d8905c540d5da4
-SIZE (waf-project-waf-waf-1.9.0pre1_GH0.tar.gz) = 1394546
+TIMESTAMP = 1466848940
+SHA256 (mpv-player-mpv-v0.18.0_GH0.tar.gz) = b656638d4f6bce2621baaacb60d8be384aa492fcd86dfd43996aaa2c16fee02b
+SIZE (mpv-player-mpv-v0.18.0_GH0.tar.gz) = 2758960
+SHA256 (waf-project-waf-waf-1.9.0pre3_GH0.tar.gz) = f9adc2059fe6821b21d901ea3795b92610a59e2b2675d42b368388fe32e4d852
+SIZE (waf-project-waf-waf-1.9.0pre3_GH0.tar.gz) = 1396329
diff --git a/multimedia/mpv/files/patch-audio_out_ao__lavc.c b/multimedia/mpv/files/patch-audio_out_ao__lavc.c
deleted file mode 100644
index 92d4385962be..000000000000
--- a/multimedia/mpv/files/patch-audio_out_ao__lavc.c
+++ /dev/null
@@ -1,209 +0,0 @@
---- audio/out/ao_lavc.c.orig 2016-04-11 17:10:54 UTC
-+++ audio/out/ao_lavc.c
-@@ -42,6 +42,7 @@ struct priv {
- uint8_t *buffer;
- size_t buffer_size;
- AVStream *stream;
-+ AVCodecContext *codec;
- int pcmhack;
- int aframesize;
- int aframecount;
-@@ -98,15 +99,14 @@ static int init(struct ao *ao)
-
- pthread_mutex_lock(&ao->encode_lavc_ctx->lock);
-
-- ac->stream = encode_lavc_alloc_stream(ao->encode_lavc_ctx,
-- AVMEDIA_TYPE_AUDIO);
--
-- if (!ac->stream) {
-- MP_ERR(ao, "could not get a new audio stream\n");
-- goto fail;
-+ if (encode_lavc_alloc_stream(ao->encode_lavc_ctx,
-+ AVMEDIA_TYPE_AUDIO,
-+ &ac->stream, &ac->codec) < 0) {
-+ MP_ERR(ao, "could not get a new audio stream\n");
-+ goto fail;
- }
-
-- codec = encode_lavc_get_codec(ao->encode_lavc_ctx, ac->stream);
-+ codec = ao->encode_lavc_ctx->ac;
-
- int samplerate = af_select_best_samplerate(ao->samplerate,
- codec->supported_samplerates);
-@@ -118,40 +118,40 @@ static int init(struct ao *ao)
- // Using codec->time_bvase is deprecated, but needed for older lavf.
- ac->stream->time_base.num = 1;
- ac->stream->time_base.den = ao->samplerate;
-- ac->stream->codec->time_base.num = 1;
-- ac->stream->codec->time_base.den = ao->samplerate;
-+ ac->codec->time_base.num = 1;
-+ ac->codec->time_base.den = ao->samplerate;
-
-- ac->stream->codec->sample_rate = ao->samplerate;
-+ ac->codec->sample_rate = ao->samplerate;
-
- struct mp_chmap_sel sel = {0};
- mp_chmap_sel_add_any(&sel);
- if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels))
- goto fail;
- mp_chmap_reorder_to_lavc(&ao->channels);
-- ac->stream->codec->channels = ao->channels.num;
-- ac->stream->codec->channel_layout = mp_chmap_to_lavc(&ao->channels);
-+ ac->codec->channels = ao->channels.num;
-+ ac->codec->channel_layout = mp_chmap_to_lavc(&ao->channels);
-
-- ac->stream->codec->sample_fmt = AV_SAMPLE_FMT_NONE;
-+ ac->codec->sample_fmt = AV_SAMPLE_FMT_NONE;
-
- select_format(ao, codec);
-
- ac->sample_size = af_fmt_to_bytes(ao->format);
-- ac->stream->codec->sample_fmt = af_to_avformat(ao->format);
-- ac->stream->codec->bits_per_raw_sample = ac->sample_size * 8;
-+ ac->codec->sample_fmt = af_to_avformat(ao->format);
-+ ac->codec->bits_per_raw_sample = ac->sample_size * 8;
-
-- if (encode_lavc_open_codec(ao->encode_lavc_ctx, ac->stream) < 0)
-+ if (encode_lavc_open_codec(ao->encode_lavc_ctx, ac->codec) < 0)
- goto fail;
-
- ac->pcmhack = 0;
-- if (ac->stream->codec->frame_size <= 1)
-- ac->pcmhack = av_get_bits_per_sample(ac->stream->codec->codec_id) / 8;
-+ if (ac->codec->frame_size <= 1)
-+ ac->pcmhack = av_get_bits_per_sample(ac->codec->codec_id) / 8;
-
- if (ac->pcmhack) {
- ac->aframesize = 16384; // "enough"
- ac->buffer_size =
- ac->aframesize * ac->pcmhack * ao->channels.num * 2 + 200;
- } else {
-- ac->aframesize = ac->stream->codec->frame_size;
-+ ac->aframesize = ac->codec->frame_size;
- ac->buffer_size =
- ac->aframesize * ac->sample_size * ao->channels.num * 2 + 200;
- }
-@@ -203,7 +203,7 @@ static void uninit(struct ao *ao)
- double outpts = ac->expected_next_pts;
- if (!ectx->options->rawts && ectx->options->copyts)
- outpts += ectx->discontinuity_pts_offset;
-- outpts += encode_lavc_getoffset(ectx, ac->stream);
-+ outpts += encode_lavc_getoffset(ectx, ac->codec);
- while (encode(ao, outpts, NULL) > 0) ;
- }
-
-@@ -252,25 +252,25 @@ static int encode(struct ao *ao, double
-
- if (ectx->options->rawts || ectx->options->copyts) {
- // real audio pts
-- frame->pts = floor(apts * ac->stream->codec->time_base.den / ac->stream->codec->time_base.num + 0.5);
-+ frame->pts = floor(apts * ac->codec->time_base.den / ac->codec->time_base.num + 0.5);
- } else {
- // audio playback time
-- frame->pts = floor(realapts * ac->stream->codec->time_base.den / ac->stream->codec->time_base.num + 0.5);
-+ frame->pts = floor(realapts * ac->codec->time_base.den / ac->codec->time_base.num + 0.5);
- }
-
-- int64_t frame_pts = av_rescale_q(frame->pts, ac->stream->codec->time_base, ac->worst_time_base);
-+ int64_t frame_pts = av_rescale_q(frame->pts, ac->codec->time_base, ac->worst_time_base);
- if (ac->lastpts != AV_NOPTS_VALUE && frame_pts <= ac->lastpts) {
- // this indicates broken video
- // (video pts failing to increase fast enough to match audio)
- MP_WARN(ao, "audio frame pts went backwards (%d <- %d), autofixed\n",
- (int)frame->pts, (int)ac->lastpts);
- frame_pts = ac->lastpts + 1;
-- frame->pts = av_rescale_q(frame_pts, ac->worst_time_base, ac->stream->codec->time_base);
-+ frame->pts = av_rescale_q(frame_pts, ac->worst_time_base, ac->codec->time_base);
- }
- ac->lastpts = frame_pts;
-
-- frame->quality = ac->stream->codec->global_quality;
-- status = avcodec_encode_audio2(ac->stream->codec, &packet, frame, &gotpacket);
-+ frame->quality = ac->codec->global_quality;
-+ status = avcodec_encode_audio2(ac->codec, &packet, frame, &gotpacket);
-
- if (!status) {
- if (ac->savepts == AV_NOPTS_VALUE)
-@@ -281,7 +281,7 @@ static int encode(struct ao *ao, double
- }
- else
- {
-- status = avcodec_encode_audio2(ac->stream->codec, &packet, NULL, &gotpacket);
-+ status = avcodec_encode_audio2(ac->codec, &packet, NULL, &gotpacket);
- }
-
- if(status) {
-@@ -295,7 +295,7 @@ static int encode(struct ao *ao, double
- MP_DBG(ao, "got pts %f (playback time: %f); out size: %d\n",
- apts, realapts, packet.size);
-
-- encode_lavc_write_stats(ao->encode_lavc_ctx, ac->stream);
-+ encode_lavc_write_stats(ao->encode_lavc_ctx, ac->codec);
-
- packet.stream_index = ac->stream->index;
-
-@@ -307,20 +307,20 @@ static int encode(struct ao *ao, double
- }
-
- if (packet.pts != AV_NOPTS_VALUE)
-- packet.pts = av_rescale_q(packet.pts, ac->stream->codec->time_base,
-+ packet.pts = av_rescale_q(packet.pts, ac->codec->time_base,
- ac->stream->time_base);
-
- if (packet.dts != AV_NOPTS_VALUE)
-- packet.dts = av_rescale_q(packet.dts, ac->stream->codec->time_base,
-+ packet.dts = av_rescale_q(packet.dts, ac->codec->time_base,
- ac->stream->time_base);
-
- if(packet.duration > 0)
-- packet.duration = av_rescale_q(packet.duration, ac->stream->codec->time_base,
-+ packet.duration = av_rescale_q(packet.duration, ac->codec->time_base,
- ac->stream->time_base);
-
- ac->savepts = AV_NOPTS_VALUE;
-
-- if (encode_lavc_write_frame(ao->encode_lavc_ctx, &packet) < 0) {
-+ if (encode_lavc_write_frame(ao->encode_lavc_ctx, ac->stream, &packet) < 0) {
- MP_ERR(ao, "error writing at %f %f/%f\n",
- realapts, (double) ac->stream->time_base.num,
- (double) ac->stream->time_base.den);
-@@ -377,22 +377,22 @@ static int play(struct ao *ao, void **da
- }
-
- if (ac->worst_time_base.den == 0) {
-- //if (ac->stream->codec->time_base.num / ac->stream->codec->time_base.den >= ac->stream->time_base.num / ac->stream->time_base.den)
-- if (ac->stream->codec->time_base.num * (double) ac->stream->time_base.den >=
-- ac->stream->time_base.num * (double) ac->stream->codec->time_base.den) {
-+ //if (ac->codec->time_base.num / ac->codec->time_base.den >= ac->stream->time_base.num / ac->stream->time_base.den)
-+ if (ac->codec->time_base.num * (double) ac->stream->time_base.den >=
-+ ac->stream->time_base.num * (double) ac->codec->time_base.den) {
- MP_VERBOSE(ao, "NOTE: using codec time base (%d/%d) for pts "
- "adjustment; the stream base (%d/%d) is not worse.\n",
-- (int)ac->stream->codec->time_base.num,
-- (int)ac->stream->codec->time_base.den,
-+ (int)ac->codec->time_base.num,
-+ (int)ac->codec->time_base.den,
- (int)ac->stream->time_base.num,
- (int)ac->stream->time_base.den);
-- ac->worst_time_base = ac->stream->codec->time_base;
-+ ac->worst_time_base = ac->codec->time_base;
- ac->worst_time_base_is_stream = 0;
- } else {
- MP_WARN(ao, "NOTE: not using codec time base (%d/%d) for pts "
- "adjustment; the stream base (%d/%d) is worse.\n",
-- (int)ac->stream->codec->time_base.num,
-- (int)ac->stream->codec->time_base.den,
-+ (int)ac->codec->time_base.num,
-+ (int)ac->codec->time_base.den,
- (int)ac->stream->time_base.num,
- (int)ac->stream->time_base.den);
- ac->worst_time_base = ac->stream->time_base;
-@@ -437,7 +437,7 @@ static int play(struct ao *ao, void **da
- }
-
- // Shift pts by the pts offset first.
-- outpts += encode_lavc_getoffset(ectx, ac->stream);
-+ outpts += encode_lavc_getoffset(ectx, ac->codec);
-
- while (samples - bufpos >= ac->aframesize) {
- void *start[MP_NUM_CHANNELS] = {0};
diff --git a/multimedia/mpv/files/patch-common_encode__lavc.c b/multimedia/mpv/files/patch-common_encode__lavc.c
deleted file mode 100644
index ecd86ff17c6c..000000000000
--- a/multimedia/mpv/files/patch-common_encode__lavc.c
+++ /dev/null
@@ -1,569 +0,0 @@
---- common/encode_lavc.c.orig 2016-04-11 17:10:54 UTC
-+++ common/encode_lavc.c
-@@ -21,6 +21,7 @@
-
- #include <libavutil/avutil.h>
-
-+#include "config.h"
- #include "encode_lavc.h"
- #include "common/global.h"
- #include "common/msg.h"
-@@ -291,32 +292,20 @@ int encode_lavc_start(struct encode_lavc
-
- CHECK_FAIL(ctx, 0);
-
-- if (ctx->expect_video) {
-- unsigned i;
-- for (i = 0; i < ctx->avc->nb_streams; ++i)
-- if (ctx->avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-- break;
-- if (i >= ctx->avc->nb_streams) {
-- if (ctx->avc->oformat->video_codec != AV_CODEC_ID_NONE ||
-- ctx->options->vcodec) {
-- encode_lavc_fail(ctx,
-- "no video stream succeeded - invalid codec?\n");
-- return 0;
-- }
-+ if (ctx->expect_video && ctx->vcc == NULL) {
-+ if (ctx->avc->oformat->video_codec != AV_CODEC_ID_NONE ||
-+ ctx->options->vcodec) {
-+ encode_lavc_fail(ctx,
-+ "no video stream succeeded - invalid codec?\n");
-+ return 0;
- }
- }
-- if (ctx->expect_audio) {
-- unsigned i;
-- for (i = 0; i < ctx->avc->nb_streams; ++i)
-- if (ctx->avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-- break;
-- if (i >= ctx->avc->nb_streams) {
-- if (ctx->avc->oformat->audio_codec != AV_CODEC_ID_NONE ||
-- ctx->options->acodec) {
-- encode_lavc_fail(ctx,
-- "no audio stream succeeded - invalid codec?\n");
-- return 0;
-- }
-+ if (ctx->expect_audio && ctx->acc == NULL) {
-+ if (ctx->avc->oformat->audio_codec != AV_CODEC_ID_NONE ||
-+ ctx->options->acodec) {
-+ encode_lavc_fail(ctx,
-+ "no audio stream succeeded - invalid codec?\n");
-+ return 0;
- }
- }
-
-@@ -387,33 +376,38 @@ void encode_lavc_finish(struct encode_la
- if (ctx->header_written > 0)
- av_write_trailer(ctx->avc); // this is allowed to fail
-
-- for (i = 0; i < ctx->avc->nb_streams; i++) {
-- switch (ctx->avc->streams[i]->codec->codec_type) {
-- case AVMEDIA_TYPE_VIDEO:
-- if (ctx->twopass_bytebuffer_v) {
-- char *stats = ctx->avc->streams[i]->codec->stats_out;
-- if (stats)
-- stream_write_buffer(ctx->twopass_bytebuffer_v,
-- stats, strlen(stats));
-- }
-- break;
-- case AVMEDIA_TYPE_AUDIO:
-- if (ctx->twopass_bytebuffer_a) {
-- char *stats = ctx->avc->streams[i]->codec->stats_out;
-- if (stats)
-- stream_write_buffer(ctx->twopass_bytebuffer_a,
-- stats, strlen(stats));
-- }
-- break;
-- default:
-- break;
-+ if (ctx->vcc) {
-+ if (ctx->twopass_bytebuffer_v) {
-+ char *stats = ctx->vcc->stats_out;
-+ if (stats)
-+ stream_write_buffer(ctx->twopass_bytebuffer_v,
-+ stats, strlen(stats));
- }
-- avcodec_close(ctx->avc->streams[i]->codec);
-- talloc_free(ctx->avc->streams[i]->codec->stats_in);
-- av_free(ctx->avc->streams[i]->codec);
-+ avcodec_close(ctx->vcc);
-+ talloc_free(ctx->vcc->stats_in);
-+ av_free(ctx->vcc);
-+ ctx->vcc = NULL;
-+ }
-+
-+ if (ctx->acc) {
-+ if (ctx->twopass_bytebuffer_a) {
-+ char *stats = ctx->acc->stats_out;
-+ if (stats)
-+ stream_write_buffer(ctx->twopass_bytebuffer_a,
-+ stats, strlen(stats));
-+ }
-+ avcodec_close(ctx->acc);
-+ talloc_free(ctx->acc->stats_in);
-+ av_free(ctx->acc);
-+ ctx->acc = NULL;
-+ }
-+
-+ for (i = 0; i < ctx->avc->nb_streams; i++) {
- av_free(ctx->avc->streams[i]->info);
- av_free(ctx->avc->streams[i]);
- }
-+ ctx->vst = NULL;
-+ ctx->ast = NULL;
-
- if (ctx->twopass_bytebuffer_v) {
- free_stream(ctx->twopass_bytebuffer_v);
-@@ -437,6 +431,7 @@ void encode_lavc_finish(struct encode_la
- }
-
- av_free(ctx->avc);
-+ ctx->avc = NULL;
- }
-
- ctx->finished = true;
-@@ -461,7 +456,9 @@ void encode_lavc_set_audio_pts(struct en
-
- static void encode_2pass_prepare(struct encode_lavc_context *ctx,
- AVDictionary **dictp,
-- AVStream *stream, struct stream **bytebuf,
-+ AVStream *stream,
-+ AVCodecContext *codec,
-+ struct stream **bytebuf,
- const char *prefix)
- {
- if (!*bytebuf) {
-@@ -476,7 +473,7 @@ static void encode_2pass_prepare(struct
- if (!(*bytebuf = stream_open(buf, ctx->global))) {
- MP_WARN(ctx, "%s: could not open '%s', "
- "disabling 2-pass encoding at pass 2\n", prefix, buf);
-- stream->codec->flags &= ~CODEC_FLAG_PASS2;
-+ codec->flags &= ~CODEC_FLAG_PASS2;
- set_to_avdictionary(ctx, dictp, "flags", "-pass2");
- } else {
- struct bstr content = stream_read_complete(*bytebuf, NULL,
-@@ -487,7 +484,7 @@ static void encode_2pass_prepare(struct
- prefix, ctx->avc->filename);
- } else {
- content.start[content.len] = 0;
-- stream->codec->stats_in = content.start;
-+ codec->stats_in = content.start;
- }
- free_stream(*bytebuf);
- *bytebuf = NULL;
-@@ -506,43 +503,55 @@ static void encode_2pass_prepare(struct
- }
- }
-
--AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
-- enum AVMediaType mt)
-+int encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
-+ enum AVMediaType mt,
-+ AVStream **stream_out,
-+ AVCodecContext **codec_out)
- {
- AVDictionaryEntry *de;
-- AVStream *stream = NULL;
- char **p;
-- int i;
-
-- CHECK_FAIL(ctx, NULL);
-+ *stream_out = NULL;
-+ *codec_out = NULL;
-
-- if (ctx->header_written)
-- return NULL;
-+ CHECK_FAIL(ctx, -1);
-
-- for (i = 0; i < ctx->avc->nb_streams; ++i)
-- if (ctx->avc->streams[i]->codec->codec_type == mt)
-- // already have a stream of that type, this cannot really happen
-- return NULL;
-+ if (ctx->header_written)
-+ return -1;
-
- if (ctx->avc->nb_streams == 0) {
- // if this stream isn't stream #0, allocate a dummy stream first for
-- // the next loop to use
-+ // the next call to use
- if (mt == AVMEDIA_TYPE_VIDEO && ctx->audio_first) {
- MP_INFO(ctx, "vo-lavc: preallocated audio stream for later use\n");
-- avformat_new_stream(ctx->avc, NULL); // this one is AVMEDIA_TYPE_UNKNOWN for now
-+ ctx->ast = avformat_new_stream(
-+ ctx->avc, NULL); // this one is AVMEDIA_TYPE_UNKNOWN for now
- }
- if (mt == AVMEDIA_TYPE_AUDIO && ctx->video_first) {
- MP_INFO(ctx, "ao-lavc: preallocated video stream for later use\n");
-- avformat_new_stream(ctx->avc, NULL); // this one is AVMEDIA_TYPE_UNKNOWN for now
-+ ctx->vst = avformat_new_stream(
-+ ctx->avc, NULL); // this one is AVMEDIA_TYPE_UNKNOWN for now
- }
-- } else {
-- // find possibly preallocated stream
-- for (i = 0; i < ctx->avc->nb_streams; ++i)
-- if (ctx->avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_UNKNOWN) // preallocated stream
-- stream = ctx->avc->streams[i];
- }
-- if (!stream)
-- stream = avformat_new_stream(ctx->avc, NULL);
-+
-+ // already have a stream of that type (this cannot really happen)?
-+ switch (mt) {
-+ case AVMEDIA_TYPE_VIDEO:
-+ if (ctx->vcc != NULL)
-+ return -1;
-+ if (ctx->vst == NULL)
-+ ctx->vst = avformat_new_stream(ctx->avc, NULL);
-+ break;
-+ case AVMEDIA_TYPE_AUDIO:
-+ if (ctx->acc != NULL)
-+ return -1;
-+ if (ctx->ast == NULL)
-+ ctx->ast = avformat_new_stream(ctx->avc, NULL);
-+ break;
-+ default:
-+ encode_lavc_fail(ctx, "requested invalid stream type\n");
-+ return -1;
-+ }
-
- if (ctx->timebase.den == 0) {
- AVRational r;
-@@ -584,13 +593,18 @@ AVStream *encode_lavc_alloc_stream(struc
- ctx->options->vcodec) {
- encode_lavc_fail(ctx, "vo-lavc: encoder not found\n");
- }
-- return NULL;
-+ return -1;
- }
-- avcodec_get_context_defaults3(stream->codec, ctx->vc);
-+#if HAVE_AVCODEC_HAS_CODECPAR
-+ ctx->vcc = avcodec_alloc_context3(ctx->vc);
-+#else
-+ avcodec_get_context_defaults3(ctx->vst->codec, ctx->vc);
-+ ctx->vcc = ctx->vst->codec;
-+#endif
-
- // Using codec->time_base is deprecated, but needed for older lavf.
-- stream->time_base = ctx->timebase;
-- stream->codec->time_base = ctx->timebase;
-+ ctx->vst->time_base = ctx->timebase;
-+ ctx->vcc->time_base = ctx->timebase;
-
- ctx->voptions = NULL;
-
-@@ -606,10 +620,12 @@ AVStream *encode_lavc_alloc_stream(struc
- if (ctx->avc->oformat->flags & AVFMT_GLOBALHEADER)
- set_to_avdictionary(ctx, &ctx->voptions, "flags", "+global_header");
-
-- encode_2pass_prepare(ctx, &ctx->voptions, stream,
-+ encode_2pass_prepare(ctx, &ctx->voptions, ctx->vst, ctx->vcc,
- &ctx->twopass_bytebuffer_v,
- "vo-lavc");
-- break;
-+ *stream_out = ctx->vst;
-+ *codec_out = ctx->vcc;
-+ return 0;
-
- case AVMEDIA_TYPE_AUDIO:
- if (!ctx->ac) {
-@@ -617,15 +633,20 @@ AVStream *encode_lavc_alloc_stream(struc
- ctx->options->acodec) {
- encode_lavc_fail(ctx, "ao-lavc: encoder not found\n");
- }
-- return NULL;
-+ return -1;
- }
-- avcodec_get_context_defaults3(stream->codec, ctx->ac);
-+#if HAVE_AVCODEC_HAS_CODECPAR
-+ ctx->acc = avcodec_alloc_context3(ctx->ac);
-+#else
-+ avcodec_get_context_defaults3(ctx->ast->codec, ctx->ac);
-+ ctx->acc = ctx->ast->codec;
-+#endif
-
- // Using codec->time_base is deprecated, but needed for older lavf.
-- stream->time_base = ctx->timebase;
-- stream->codec->time_base = ctx->timebase;
-+ ctx->ast->time_base = ctx->timebase;
-+ ctx->acc->time_base = ctx->timebase;
-
-- ctx->aoptions = NULL;
-+ ctx->aoptions = 0;
-
- if (ctx->options->aopts)
- for (p = ctx->options->aopts; *p; ++p)
-@@ -639,49 +660,34 @@ AVStream *encode_lavc_alloc_stream(struc
- if (ctx->avc->oformat->flags & AVFMT_GLOBALHEADER)
- set_to_avdictionary(ctx, &ctx->aoptions, "flags", "+global_header");
-
-- encode_2pass_prepare(ctx, &ctx->aoptions, stream,
-+ encode_2pass_prepare(ctx, &ctx->aoptions, ctx->ast, ctx->acc,
- &ctx->twopass_bytebuffer_a,
- "ao-lavc");
-- break;
-
-- default:
-- encode_lavc_fail(ctx, "requested invalid stream type\n");
-- return NULL;
-+ *stream_out = ctx->ast;
-+ *codec_out = ctx->acc;
-+ return 0;
- }
-
-- return stream;
--}
--
--AVCodec *encode_lavc_get_codec(struct encode_lavc_context *ctx,
-- AVStream *stream)
--{
-- CHECK_FAIL(ctx, NULL);
--
-- switch (stream->codec->codec_type) {
-- case AVMEDIA_TYPE_VIDEO:
-- return ctx->vc;
-- case AVMEDIA_TYPE_AUDIO:
-- return ctx->ac;
-- default:
-- break;
-- }
-- return NULL;
-+ // Unreachable.
-+ return -1;
- }
-
--int encode_lavc_open_codec(struct encode_lavc_context *ctx, AVStream *stream)
-+int encode_lavc_open_codec(struct encode_lavc_context *ctx,
-+ AVCodecContext *codec)
- {
- AVDictionaryEntry *de;
- int ret;
-
- CHECK_FAIL(ctx, -1);
-
-- switch (stream->codec->codec_type) {
-+ switch (codec->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- MP_INFO(ctx, "Opening video encoder: %s [%s]\n",
- ctx->vc->long_name, ctx->vc->name);
-
- if (ctx->vc->capabilities & CODEC_CAP_EXPERIMENTAL) {
-- stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
-+ codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
- MP_WARN(ctx, "\n\n"
- " ********************************************\n"
- " **** Experimental VIDEO codec selected! ****\n"
-@@ -701,7 +707,11 @@ int encode_lavc_open_codec(struct encode
- ctx->vc->name);
- }
-
-- ret = avcodec_open2(stream->codec, ctx->vc, &ctx->voptions);
-+ ret = avcodec_open2(codec, ctx->vc, &ctx->voptions);
-+#if HAVE_AVCODEC_HAS_CODECPAR
-+ if (ret >= 0)
-+ ret = avcodec_parameters_from_context(ctx->vst->codecpar, codec);
-+#endif
-
- // complain about all remaining options, then free the dict
- for (de = NULL; (de = av_dict_get(ctx->voptions, "", de,
-@@ -716,7 +726,7 @@ int encode_lavc_open_codec(struct encode
- ctx->ac->long_name, ctx->ac->name);
-
- if (ctx->ac->capabilities & CODEC_CAP_EXPERIMENTAL) {
-- stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
-+ codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
- MP_WARN(ctx, "\n\n"
- " ********************************************\n"
- " **** Experimental AUDIO codec selected! ****\n"
-@@ -735,7 +745,12 @@ int encode_lavc_open_codec(struct encode
- "If none of this helps you, try another codec in place of %s.\n\n",
- ctx->ac->name);
- }
-- ret = avcodec_open2(stream->codec, ctx->ac, &ctx->aoptions);
-+
-+ ret = avcodec_open2(codec, ctx->ac, &ctx->aoptions);
-+#if HAVE_AVCODEC_HAS_CODECPAR
-+ if (ret >= 0)
-+ ret = avcodec_parameters_from_context(ctx->ast->codecpar, codec);
-+#endif
-
- // complain about all remaining options, then free the dict
- for (de = NULL; (de = av_dict_get(ctx->aoptions, "", de,
-@@ -757,36 +772,43 @@ int encode_lavc_open_codec(struct encode
- return ret;
- }
-
--void encode_lavc_write_stats(struct encode_lavc_context *ctx, AVStream *stream)
-+void encode_lavc_write_stats(struct encode_lavc_context *ctx,
-+ AVCodecContext *codec)
- {
- CHECK_FAIL(ctx, );
-
-- switch (stream->codec->codec_type) {
-+ switch (codec->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- if (ctx->twopass_bytebuffer_v)
-- if (stream->codec->stats_out)
-+ if (codec->stats_out)
- stream_write_buffer(ctx->twopass_bytebuffer_v,
-- stream->codec->stats_out,
-- strlen(stream->codec->stats_out));
-+ codec->stats_out,
-+ strlen(codec->stats_out));
- break;
- case AVMEDIA_TYPE_AUDIO:
- if (ctx->twopass_bytebuffer_a)
-- if (stream->codec->stats_out)
-+ if (codec->stats_out)
- stream_write_buffer(ctx->twopass_bytebuffer_a,
-- stream->codec->stats_out,
-- strlen(stream->codec->stats_out));
-+ codec->stats_out,
-+ strlen(codec->stats_out));
- break;
- default:
- break;
- }
- }
-
--int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVPacket *packet)
-+int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVStream *stream,
-+ AVPacket *packet)
- {
- int r;
-
- CHECK_FAIL(ctx, -1);
-
-+ if (stream->index != packet->stream_index) {
-+ MP_ERR(ctx, "Called encode_lavc_write_frame on the wrong stream\n");
-+ return -1;
-+ }
-+
- if (ctx->header_written <= 0)
- return -1;
-
-@@ -795,27 +817,32 @@ int encode_lavc_write_frame(struct encod
- (int)packet->stream_index,
- (int)packet->pts,
- packet->pts
-- * (double)ctx->avc->streams[packet->stream_index]->time_base.num
-- / (double)ctx->avc->streams[packet->stream_index]->time_base.den,
-+ * (double)stream->time_base.num
-+ / (double)stream->time_base.den,
- (int)packet->dts,
- packet->dts
-- * (double)ctx->avc->streams[packet->stream_index]->time_base.num
-- / (double)ctx->avc->streams[packet->stream_index]->time_base.den,
-+ * (double)stream->time_base.num
-+ / (double)stream->time_base.den,
- (int)packet->size);
-
-- switch (ctx->avc->streams[packet->stream_index]->codec->codec_type) {
-- case AVMEDIA_TYPE_VIDEO:
-- ctx->vbytes += packet->size;
-- ++ctx->frames;
-- break;
-- case AVMEDIA_TYPE_AUDIO:
-- ctx->abytes += packet->size;
-- ctx->audioseconds += packet->duration
-- * (double)ctx->avc->streams[packet->stream_index]->time_base.num
-- / (double)ctx->avc->streams[packet->stream_index]->time_base.den;
-- break;
-- default:
-- break;
-+
-+#if HAVE_AVCODEC_HAS_CODECPAR
-+ switch (stream->codecpar->codec_type) {
-+#else
-+ switch (stream->codec->codec_type) {
-+#endif
-+ case AVMEDIA_TYPE_VIDEO:
-+ ctx->vbytes += packet->size;
-+ ++ctx->frames;
-+ break;
-+ case AVMEDIA_TYPE_AUDIO:
-+ ctx->abytes += packet->size;
-+ ctx->audioseconds += packet->duration
-+ * (double)stream->time_base.num
-+ / (double)stream->time_base.den;
-+ break;
-+ default:
-+ break;
- }
-
- r = av_interleaved_write_frame(ctx->avc, packet);
-@@ -1062,11 +1089,12 @@ bool encode_lavc_showhelp(struct mp_log
- return help_output;
- }
-
--double encode_lavc_getoffset(struct encode_lavc_context *ctx, AVStream *stream)
-+double encode_lavc_getoffset(struct encode_lavc_context *ctx,
-+ AVCodecContext *codec)
- {
- CHECK_FAIL(ctx, 0);
-
-- switch (stream->codec->codec_type) {
-+ switch (codec->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- return ctx->options->voffset;
- case AVMEDIA_TYPE_AUDIO:
-@@ -1151,49 +1179,49 @@ void encode_lavc_fail(struct encode_lavc
- }
-
- bool encode_lavc_set_csp(struct encode_lavc_context *ctx,
-- AVStream *stream, enum mp_csp csp)
-+ AVCodecContext *codec, enum mp_csp csp)
- {
- CHECK_FAIL(ctx, NULL);
-
- if (ctx->header_written) {
-- if (stream->codec->colorspace != mp_csp_to_avcol_spc(csp))
-+ if (codec->colorspace != mp_csp_to_avcol_spc(csp))
- MP_WARN(ctx, "can not change color space during encoding\n");
- return false;
- }
-
-- stream->codec->colorspace = mp_csp_to_avcol_spc(csp);
-+ codec->colorspace = mp_csp_to_avcol_spc(csp);
- return true;
- }
-
- bool encode_lavc_set_csp_levels(struct encode_lavc_context *ctx,
-- AVStream *stream, enum mp_csp_levels lev)
-+ AVCodecContext *codec, enum mp_csp_levels lev)
- {
- CHECK_FAIL(ctx, NULL);
-
- if (ctx->header_written) {
-- if (stream->codec->color_range != mp_csp_levels_to_avcol_range(lev))
-+ if (codec->color_range != mp_csp_levels_to_avcol_range(lev))
- MP_WARN(ctx, "can not change color space during encoding\n");
- return false;
- }
-
-- stream->codec->color_range = mp_csp_levels_to_avcol_range(lev);
-+ codec->color_range = mp_csp_levels_to_avcol_range(lev);
- return true;
- }
-
- enum mp_csp encode_lavc_get_csp(struct encode_lavc_context *ctx,
-- AVStream *stream)
-+ AVCodecContext *codec)
- {
- CHECK_FAIL(ctx, 0);
-
-- return avcol_spc_to_mp_csp(stream->codec->colorspace);
-+ return avcol_spc_to_mp_csp(codec->colorspace);
- }
-
- enum mp_csp_levels encode_lavc_get_csp_levels(struct encode_lavc_context *ctx,
-- AVStream *stream)
-+ AVCodecContext *codec)
- {
- CHECK_FAIL(ctx, 0);
-
-- return avcol_range_to_mp_csp_levels(stream->codec->color_range);
-+ return avcol_range_to_mp_csp_levels(codec->color_range);
- }
-
- // vim: ts=4 sw=4 et
diff --git a/multimedia/mpv/files/patch-common_encode__lavc.h b/multimedia/mpv/files/patch-common_encode__lavc.h
deleted file mode 100644
index 221d2496c57e..000000000000
--- a/multimedia/mpv/files/patch-common_encode__lavc.h
+++ /dev/null
@@ -1,60 +0,0 @@
---- common/encode_lavc.h.orig 2016-04-11 17:10:54 UTC
-+++ common/encode_lavc.h
-@@ -46,8 +46,14 @@ struct encode_lavc_context {
-
- float vo_fps;
-
-- // these are processed from the options
-+ // FFmpeg contexts.
- AVFormatContext *avc;
-+ AVStream *vst;
-+ AVStream *ast;
-+ AVCodecContext *vcc;
-+ AVCodecContext *acc;
-+
-+ // these are processed from the options
- AVRational timebase;
- AVCodec *vc;
- AVCodec *ac;
-@@ -88,26 +94,31 @@ struct encode_lavc_context {
- };
-
- // interface for vo/ao drivers
--AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx, enum AVMediaType mt);
--void encode_lavc_write_stats(struct encode_lavc_context *ctx, AVStream *stream);
--int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVPacket *packet);
-+int encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
-+ enum AVMediaType mt, AVStream **stream_out,
-+ AVCodecContext **codec_out);
-+void encode_lavc_write_stats(struct encode_lavc_context *ctx,
-+ AVCodecContext *stream);
-+int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVStream *stream,
-+ AVPacket *packet);
- int encode_lavc_supports_pixfmt(struct encode_lavc_context *ctx, enum AVPixelFormat format);
--AVCodec *encode_lavc_get_codec(struct encode_lavc_context *ctx, AVStream *stream);
--int encode_lavc_open_codec(struct encode_lavc_context *ctx, AVStream *stream);
-+int encode_lavc_open_codec(struct encode_lavc_context *ctx,
-+ AVCodecContext *codec);
- int encode_lavc_available(struct encode_lavc_context *ctx);
- int encode_lavc_timesyncfailed(struct encode_lavc_context *ctx);
- int encode_lavc_start(struct encode_lavc_context *ctx); // returns 1 on success
- int encode_lavc_oformat_flags(struct encode_lavc_context *ctx);
--double encode_lavc_getoffset(struct encode_lavc_context *ctx, AVStream *stream);
-+double encode_lavc_getoffset(struct encode_lavc_context *ctx,
-+ AVCodecContext *codec);
- void encode_lavc_fail(struct encode_lavc_context *ctx, const char *format, ...); // report failure of encoding
-
- bool encode_lavc_set_csp(struct encode_lavc_context *ctx,
-- AVStream *stream, enum mp_csp csp);
-+ AVCodecContext *codec, enum mp_csp csp);
- bool encode_lavc_set_csp_levels(struct encode_lavc_context *ctx,
-- AVStream *stream, enum mp_csp_levels lev);
-+ AVCodecContext *codec, enum mp_csp_levels lev);
- enum mp_csp encode_lavc_get_csp(struct encode_lavc_context *ctx,
-- AVStream *stream);
-+ AVCodecContext *codec);
- enum mp_csp_levels encode_lavc_get_csp_levels(struct encode_lavc_context *ctx,
-- AVStream *stream);
-+ AVCodecContext *codec);
-
- #endif
diff --git a/multimedia/mpv/files/patch-player_command.c b/multimedia/mpv/files/patch-player_command.c
new file mode 100644
index 000000000000..5b408f94b143
--- /dev/null
+++ b/multimedia/mpv/files/patch-player_command.c
@@ -0,0 +1,11 @@
+--- player/command.c.orig 2016-06-25 10:10:43 UTC
++++ player/command.c
+@@ -2801,7 +2801,7 @@ static int mp_property_vo_performance(vo
+ return M_PROPERTY_OK;
+ }
+
+- struct voctrl_performance_data data = {0};
++ struct voctrl_performance_data data = {{0}};
+ if (vo_control(mpctx->video_out, VOCTRL_PERFORMANCE_DATA, &data) <= 0)
+ return M_PROPERTY_UNAVAILABLE;
+
diff --git a/multimedia/mpv/files/patch-video_out_opengl_hwdec__vaegl.c b/multimedia/mpv/files/patch-video_out_opengl_hwdec__vaegl.c
new file mode 100644
index 000000000000..63d54302c417
--- /dev/null
+++ b/multimedia/mpv/files/patch-video_out_opengl_hwdec__vaegl.c
@@ -0,0 +1,11 @@
+--- video/out/opengl/hwdec_vaegl.c.orig 2016-06-25 10:09:55 UTC
++++ video/out/opengl/hwdec_vaegl.c
+@@ -367,7 +367,7 @@ static bool test_format(struct gl_hwdec
+ va_surface_init_subformat(surface);
+ struct mp_image_params params = surface->params;
+ if (reinit(hw, &params) >= 0) {
+- struct gl_hwdec_frame frame = {0};
++ struct gl_hwdec_frame frame = {{{0}}};
+ ok = map_frame(hw, surface, &frame) >= 0;
+ }
+ unmap_frame(hw);
diff --git a/multimedia/mpv/files/patch-video_out_opengl_video.c b/multimedia/mpv/files/patch-video_out_opengl_video.c
index 8c9cf0d5f054..e512ec06bd01 100644
--- a/multimedia/mpv/files/patch-video_out_opengl_video.c
+++ b/multimedia/mpv/files/patch-video_out_opengl_video.c
@@ -1,6 +1,15 @@
---- video/out/opengl/video.c.orig 2016-04-12 22:17:16 UTC
+--- video/out/opengl/video.c.orig 2016-06-25 01:23:40 UTC
+++ video/out/opengl/video.c
-@@ -1003,7 +1003,7 @@ static void pass_prepare_src_tex(struct
+@@ -881,7 +881,7 @@ static void uninit_video(struct gl_video
+ gl->DeleteTextures(1, &plane->gl_texture);
+ gl->DeleteBuffers(1, &plane->gl_buffer);
+ }
+- *vimg = (struct video_image){0};
++ *vimg = (struct video_image){{{0}}};
+
+ // Invalidate image_params to ensure that gl_video_config() will call
+ // init_video() on uninitialized gl_video.
+@@ -933,7 +933,7 @@ static void pass_prepare_src_tex(struct
static void render_pass_quad(struct gl_video *p, int vp_w, int vp_h,
const struct mp_rect *dst)
{
@@ -9,3 +18,21 @@
struct gl_transform t;
gl_transform_ortho(&t, 0, vp_w, 0, vp_h);
+@@ -2931,7 +2931,7 @@ static bool map_image(struct gl_video *p
+ // This assumes nv12, with textures set to GL_NEAREST filtering.
+ static void reinterleave_vdpau(struct gl_video *p, struct gl_hwdec_frame *frame)
+ {
+- struct gl_hwdec_frame res = {0};
++ struct gl_hwdec_frame res = {{{0}}};
+ for (int n = 0; n < 2; n++) {
+ struct fbotex *fbo = &p->vdpau_deinterleave_fbo[n];
+ // This is an array of the 2 to-merge planes.
+@@ -2989,7 +2989,7 @@ static bool gl_video_upload_image(struct
+
+ if (p->hwdec_active) {
+ // Hardware decoding
+- struct gl_hwdec_frame gl_frame = {0};
++ struct gl_hwdec_frame gl_frame = {{{0}}};
+ gl_timer_start(p->upload_timer);
+ bool ok = p->hwdec->driver->map_frame(p->hwdec, vimg->mpi, &gl_frame) >= 0;
+ gl_timer_stop(p->upload_timer);
diff --git a/multimedia/mpv/files/patch-video_out_vo__lavc.c b/multimedia/mpv/files/patch-video_out_vo__lavc.c
deleted file mode 100644
index 43cee6001849..000000000000
--- a/multimedia/mpv/files/patch-video_out_vo__lavc.c
+++ /dev/null
@@ -1,163 +0,0 @@
---- video/out/vo_lavc.c.orig 2016-04-11 17:10:54 UTC
-+++ video/out/vo_lavc.c
-@@ -37,6 +37,7 @@ struct priv {
- uint8_t *buffer;
- size_t buffer_size;
- AVStream *stream;
-+ AVCodecContext *codec;
- int have_first_packet;
-
- int harddup;
-@@ -108,14 +109,14 @@ static int reconfig(struct vo *vo, struc
- * warning here. We choose to ignore that; just because ffmpeg currently
- * uses a plain 'int' for these struct fields, it doesn't mean it always
- * will */
-- if (width == vc->stream->codec->width &&
-- height == vc->stream->codec->height) {
-- if (aspect.num != vc->stream->codec->sample_aspect_ratio.num ||
-- aspect.den != vc->stream->codec->sample_aspect_ratio.den) {
-+ if (width == vc->codec->width &&
-+ height == vc->codec->height) {
-+ if (aspect.num != vc->codec->sample_aspect_ratio.num ||
-+ aspect.den != vc->codec->sample_aspect_ratio.den) {
- /* aspect-only changes are not critical */
- MP_WARN(vo, "unsupported pixel aspect ratio change from %d:%d to %d:%d\n",
-- vc->stream->codec->sample_aspect_ratio.num,
-- vc->stream->codec->sample_aspect_ratio.den,
-+ vc->codec->sample_aspect_ratio.num,
-+ vc->codec->sample_aspect_ratio.den,
- aspect.num, aspect.den);
- }
- goto done;
-@@ -144,18 +145,20 @@ static int reconfig(struct vo *vo, struc
- goto error;
- }
-
-- vc->stream = encode_lavc_alloc_stream(vo->encode_lavc_ctx,
-- AVMEDIA_TYPE_VIDEO);
-- vc->stream->sample_aspect_ratio = vc->stream->codec->sample_aspect_ratio =
-+ if (encode_lavc_alloc_stream(vo->encode_lavc_ctx,
-+ AVMEDIA_TYPE_VIDEO,
-+ &vc->stream, &vc->codec) < 0)
-+ goto error;
-+ vc->stream->sample_aspect_ratio = vc->codec->sample_aspect_ratio =
- aspect;
-- vc->stream->codec->width = width;
-- vc->stream->codec->height = height;
-- vc->stream->codec->pix_fmt = pix_fmt;
-+ vc->codec->width = width;
-+ vc->codec->height = height;
-+ vc->codec->pix_fmt = pix_fmt;
-
-- encode_lavc_set_csp(vo->encode_lavc_ctx, vc->stream, params->colorspace);
-- encode_lavc_set_csp_levels(vo->encode_lavc_ctx, vc->stream, params->colorlevels);
-+ encode_lavc_set_csp(vo->encode_lavc_ctx, vc->codec, params->colorspace);
-+ encode_lavc_set_csp_levels(vo->encode_lavc_ctx, vc->codec, params->colorlevels);
-
-- if (encode_lavc_open_codec(vo->encode_lavc_ctx, vc->stream) < 0)
-+ if (encode_lavc_open_codec(vo->encode_lavc_ctx, vc->codec) < 0)
- goto error;
-
- vc->buffer_size = 6 * width * height + 200;
-@@ -204,7 +207,7 @@ static void write_packet(struct vo *vo,
- packet->stream_index = vc->stream->index;
- if (packet->pts != AV_NOPTS_VALUE) {
- packet->pts = av_rescale_q(packet->pts,
-- vc->stream->codec->time_base,
-+ vc->codec->time_base,
- vc->stream->time_base);
- } else {
- MP_VERBOSE(vo, "codec did not provide pts\n");
-@@ -213,12 +216,12 @@ static void write_packet(struct vo *vo,
- }
- if (packet->dts != AV_NOPTS_VALUE) {
- packet->dts = av_rescale_q(packet->dts,
-- vc->stream->codec->time_base,
-+ vc->codec->time_base,
- vc->stream->time_base);
- }
- if (packet->duration > 0) {
- packet->duration = av_rescale_q(packet->duration,
-- vc->stream->codec->time_base,
-+ vc->codec->time_base,
- vc->stream->time_base);
- } else {
- // HACK: libavformat calculates dts wrong if the initial packet
-@@ -226,15 +229,16 @@ static void write_packet(struct vo *vo,
- // have b-frames!
- if (!packet->duration)
- if (!vc->have_first_packet)
-- if (vc->stream->codec->has_b_frames
-- || vc->stream->codec->max_b_frames)
-+ if (vc->codec->has_b_frames
-+ || vc->codec->max_b_frames)
- if (vc->stream->time_base.num * 1000LL <=
- vc->stream->time_base.den)
- packet->duration = FFMAX(1, av_rescale_q(1,
-- vc->stream->codec->time_base, vc->stream->time_base));
-+ vc->codec->time_base, vc->stream->time_base));
- }
-
-- if (encode_lavc_write_frame(vo->encode_lavc_ctx, packet) < 0) {
-+ if (encode_lavc_write_frame(vo->encode_lavc_ctx,
-+ vc->stream, packet) < 0) {
- MP_ERR(vo, "error writing\n");
- return;
- }
-@@ -251,23 +255,23 @@ static int encode_video(struct vo *vo, A
- return 0;
- memcpy(vc->buffer, frame, sizeof(AVPicture));
- MP_DBG(vo, "got pts %f\n",
-- frame->pts * (double) vc->stream->codec->time_base.num /
-- (double) vc->stream->codec->time_base.den);
-+ frame->pts * (double) vc->codec->time_base.num /
-+ (double) vc->codec->time_base.den);
- packet->size = sizeof(AVPicture);
- return packet->size;
- } else {
- int got_packet = 0;
-- int status = avcodec_encode_video2(vc->stream->codec, packet,
-+ int status = avcodec_encode_video2(vc->codec, packet,
- frame, &got_packet);
- int size = (status < 0) ? status : got_packet ? packet->size : 0;
-
- if (frame)
- MP_DBG(vo, "got pts %f; out size: %d\n",
-- frame->pts * (double) vc->stream->codec->time_base.num /
-- (double) vc->stream->codec->time_base.den, size);
-+ frame->pts * (double) vc->codec->time_base.num /
-+ (double) vc->codec->time_base.den, size);
-
- if (got_packet)
-- encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
-+ encode_lavc_write_stats(vo->encode_lavc_ctx, vc->codec);
- return size;
- }
- }
-@@ -295,7 +299,7 @@ static void draw_image_unlocked(struct v
- pts = vc->expected_next_pts;
- }
-
-- avc = vc->stream->codec;
-+ avc = vc->codec;
-
- if (vc->worst_time_base.den == 0) {
- //if (avc->time_base.num / avc->time_base.den >= vc->stream->time_base.num / vc->stream->time_base.den)
-@@ -376,7 +380,7 @@ static void draw_image_unlocked(struct v
- }
- vc->lastpts = outpts;
- ectx->last_video_in_pts = pts;
-- frameipts = floor((outpts + encode_lavc_getoffset(ectx, vc->stream))
-+ frameipts = floor((outpts + encode_lavc_getoffset(ectx, vc->codec))
- / timeunit + 0.5);
-
- // calculate expected pts of next video frame
-@@ -396,7 +400,7 @@ static void draw_image_unlocked(struct v
- MP_INFO(vo, "--oneverdrop increased pts by %d\n",
- (int) (vc->lastipts - frameipts + step));
- frameipts = vc->lastipts + step;
-- vc->lastpts = frameipts * timeunit - encode_lavc_getoffset(ectx, vc->stream);
-+ vc->lastpts = frameipts * timeunit - encode_lavc_getoffset(ectx, vc->codec);
- }
- }
-
diff --git a/multimedia/mpv/files/patch-wscript b/multimedia/mpv/files/patch-wscript
deleted file mode 100644
index 08dcf8377b99..000000000000
--- a/multimedia/mpv/files/patch-wscript
+++ /dev/null
@@ -1,10 +0,0 @@
---- wscript.orig 2016-04-11 17:10:54 UTC
-+++ wscript
-@@ -325,7 +325,6 @@ iconv support use --disable-iconv.",
- } , {
- 'name' : '--encoding',
- 'desc' : 'Encoding',
-- 'default': 'disable',
- 'func': check_true,
- }, {
- 'name': '--libbluray',
diff --git a/multimedia/mpv/pkg-plist b/multimedia/mpv/pkg-plist
index e33b50580140..407f7b5b04e6 100644
--- a/multimedia/mpv/pkg-plist
+++ b/multimedia/mpv/pkg-plist
@@ -5,7 +5,7 @@ include/mpv/opengl_cb.h
include/mpv/qthelper.hpp
lib/libmpv.so
lib/libmpv.so.1
-lib/libmpv.so.1.20.0
+lib/libmpv.so.1.21.0
libdata/pkgconfig/mpv.pc
man/man1/mpv.1.gz
share/applications/mpv.desktop