From ecd03fa3d7a702eaf16d12b8191aaeb2825949bd Mon Sep 17 00:00:00 2001 From: seaweeduk <2912658+seaweeduk@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:57:17 +0000 Subject: [PATCH] Update mpv to 0.42.0 --- packaging/frame/mpv-export-release.patch | 2 +- packaging/frame/mpv-v4l2-av1.patch | 6 +- packaging/frame/mpv-v4l2-hardware-only.patch | 14 +-- packaging/frame/mpv-v4l2-interrupt.patch | 40 +++---- packaging/frame/mpv-v4l2-reset.patch | 84 ++++++------- packaging/libplacebo/NOTICE | 42 +++++++ packaging/mpv/NOTICE | 62 ++++++++++ packaging/mpv/mpv-mvc.patch | 119 +++++++++---------- packaging/release/assemble.py | 19 ++- packaging/release/build-sdk.sh | 18 ++- packaging/release/debian.json | 8 +- packaging/release/sources.json | 3 +- src/frame_grabber.cpp | 2 + src/video_player.cpp | 3 + 14 files changed, 272 insertions(+), 150 deletions(-) create mode 100644 packaging/libplacebo/NOTICE create mode 100644 packaging/mpv/NOTICE diff --git a/packaging/frame/mpv-export-release.patch b/packaging/frame/mpv-export-release.patch index 3486fae..6ce81ec 100644 --- a/packaging/frame/mpv-export-release.patch +++ b/packaging/frame/mpv-export-release.patch @@ -2,7 +2,7 @@ # as its frames are done with. Apply after mpv-v4l2-interrupt.patch. --- a/video/out/gpu/libmpv_gpu.c +++ b/video/out/gpu/libmpv_gpu.c -@@ -152,10 +152,26 @@ static bool check_format(struct render_b +@@ -155,10 +155,26 @@ static bool check_format(struct render_b return gl_video_check_format(p->renderer, imgfmt); } diff --git a/packaging/frame/mpv-v4l2-av1.patch b/packaging/frame/mpv-v4l2-av1.patch index dac6f2b..d6423dd 100644 --- a/packaging/frame/mpv-v4l2-av1.patch +++ b/packaging/frame/mpv-v4l2-av1.patch @@ -18,7 +18,7 @@ [source && source->comp[0].depth > 8]; } -@@ -703,7 +704,9 @@ static void select_and_set_hwdec(struct +@@ -721,7 +722,9 @@ static void select_and_set_hwdec(struct } else { const AVCodecParameters *par = ctx->codec->lav_codecpar; bool large_v4l2 = false; @@ -29,7 +29,7 @@ for (int n = 0; n < ctx->num_attempted_hwdecs; n++) { if (bstr_find0(ctx->attempted_hwdecs[n], "v4l2m2m") >= 0) large_v4l2 = true; -@@ -890,12 +893,17 @@ static void init_avctx(struct mp_filter +@@ -913,12 +916,17 @@ static void init_avctx(struct mp_filter spare += 3; av_opt_set_int(avctx->priv_data, "capture_spare", spare, 0); } @@ -48,7 +48,7 @@ const AVCodecParameters *par = c->lav_codecpar; ctx->v4l2_smallest_pool = (int64_t)par->width * par->height >= atomic_load(v4l2_refused(par)); if (ctx->v4l2_smallest_pool) -@@ -1377,7 +1385,8 @@ static void handle_err(struct mp_filter +@@ -1431,7 +1439,8 @@ static void handle_err(struct mp_filter const AVCodecParameters *par = ctx->codec->lav_codecpar; int64_t refused = 0; bool smaller = false; diff --git a/packaging/frame/mpv-v4l2-hardware-only.patch b/packaging/frame/mpv-v4l2-hardware-only.patch index 34d32af..d1ef803 100644 --- a/packaging/frame/mpv-v4l2-hardware-only.patch +++ b/packaging/frame/mpv-v4l2-hardware-only.patch @@ -1,7 +1,7 @@ # Do not start a software decoder after V4L2 fails on large VR video. --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c -@@ -669,10 +669,19 @@ static void select_and_set_hwdec(struct +@@ -709,10 +709,19 @@ static void select_and_set_hwdec(struct MP_VERBOSE(vd, "Using underlying hw-decoder '%s'\n", ctx->hwdec.codec->name); } else { @@ -23,7 +23,7 @@ ctx->force_eof = true; } else { MP_VERBOSE(vd, "Using software decoding.\n"); -@@ -755,10 +764,10 @@ static void reinit(struct mp_filter *vd) +@@ -795,10 +804,10 @@ static void reinit(struct mp_filter *vd) bool use_hwdec = ctx->use_hwdec; init_avctx(vd); @@ -34,9 +34,9 @@ - } while (!ctx->avctx); + } while (!ctx->avctx && !ctx->force_eof); } - } -@@ -774,6 +783,9 @@ static void init_avctx(struct mp_filter + // Wait for the first keyframe after reinit to ensure the decoder state is +@@ -820,6 +829,9 @@ static void init_avctx(struct mp_filter m_config_cache_update(ctx->opts_cache); mp_assert(!ctx->avctx); @@ -46,7 +46,7 @@ const AVCodec *lavc_codec = NULL; -@@ -1369,6 +1381,8 @@ static bool send_mvc_queue(struct mp_fil +@@ -1469,6 +1481,8 @@ static bool send_mvc_queue(struct mp_fil static int send_packet(struct mp_filter *vd, struct demux_packet *pkt) { vd_ffmpeg_ctx *ctx = vd->priv; @@ -55,7 +55,7 @@ if (ctx->reopen_v4l2) { if (!pkt) return AVERROR_EOF; -@@ -1607,7 +1621,7 @@ static int receive_frame(struct mp_filte +@@ -1716,7 +1730,7 @@ static int receive_frame(struct mp_filte int ret = decode_frame(vd); @@ -64,7 +64,7 @@ // Failed hardware decoding? Try the next one, and eventually software. struct demux_packet **pkts = ctx->sent_packets; int num_pkts = ctx->num_sent_packets; -@@ -1626,7 +1640,7 @@ static int receive_frame(struct mp_filte +@@ -1735,7 +1749,7 @@ static int receive_frame(struct mp_filte */ do { force_fallback(vd); diff --git a/packaging/frame/mpv-v4l2-interrupt.patch b/packaging/frame/mpv-v4l2-interrupt.patch index 5edce4d..38b5e2b 100644 --- a/packaging/frame/mpv-v4l2-interrupt.patch +++ b/packaging/frame/mpv-v4l2-interrupt.patch @@ -2,7 +2,7 @@ # for frames that only the locking thread returns. Apply after mpv-v4l2-reset.patch. --- a/filters/f_decoder_wrapper.c +++ b/filters/f_decoder_wrapper.c -@@ -225,6 +225,12 @@ struct priv { +@@ -227,6 +227,12 @@ struct priv { bool dec_thread_valid; mp_mutex cache_lock; @@ -15,7 +15,7 @@ // --- Protected by cache_lock. char *cur_hwdec; bool try_spdif; -@@ -290,8 +296,26 @@ static void thread_unlock(struct priv *p +@@ -303,8 +309,26 @@ static void thread_unlock(struct priv *p mp_assert(p->dec_thread_lock); p->dec_thread_lock = false; @@ -43,7 +43,7 @@ } // This resets only the decoder. Unlike a full reset(), this doesn't imply a -@@ -371,8 +395,9 @@ static void decf_destroy(struct mp_filte +@@ -397,8 +421,9 @@ static void decf_destroy(struct mp_filte if (p->decoder) { MP_DBG(f, "Uninit decoder.\n"); @@ -55,7 +55,7 @@ p->codec->decoder = NULL; p->codec->decoder_desc = NULL; } -@@ -397,9 +422,10 @@ struct mp_decoder_list *audio_decoder_li +@@ -423,9 +448,10 @@ struct mp_decoder_list *audio_decoder_li static bool reinit_decoder(struct priv *p) { @@ -69,16 +69,16 @@ reset_decoder(p); p->has_broken_packet_pts = -10; // needs 10 packets to reach decision -@@ -453,7 +479,7 @@ static bool reinit_decoder(struct priv * +@@ -487,7 +513,7 @@ static bool reinit_decoder(struct priv * struct mp_decoder_entry *sel = &list->entries[n]; MP_VERBOSE(p, "Opening decoder %s\n", sel->decoder); - p->decoder = driver->create(p->decf, p->codec, sel->decoder); + set_decoder(p, driver->create(p->decf, p->codec, sel->decoder)); if (p->decoder) { - p->codec->decoder = talloc_strdup(p, sel->decoder); - p->codec->decoder_desc = talloc_strdup(p, sel->desc && sel->desc[0] ? sel->desc : NULL); -@@ -1183,6 +1209,7 @@ static void public_f_destroy(struct mp_f + p->codec->decoder = talloc_strdup(p->codec, sel->decoder); + p->codec->decoder_desc = talloc_strdup(p->codec, sel->desc && sel->desc[0] ? sel->desc : NULL); +@@ -1268,6 +1294,7 @@ static void public_f_destroy(struct mp_f talloc_free(p->dec_root_filter); talloc_free(p->queue); mp_mutex_destroy(&p->cache_lock); @@ -86,7 +86,7 @@ } static const struct mp_filter_info decf_filter = { -@@ -1211,6 +1238,14 @@ static void onlock_dec_thread(void *ptr) +@@ -1296,6 +1323,14 @@ static void onlock_dec_thread(void *ptr) struct priv *p = ptr; mp_filter_graph_interrupt(p->dec_root_filter); @@ -100,8 +100,8 @@ + mp_mutex_unlock(&p->decoder_lock); } - struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent, -@@ -1224,6 +1259,7 @@ struct mp_decoder_wrapper *mp_decoder_wr + // Build the multi-decoder + libavfilter merge subgraph for a stream group +@@ -1384,6 +1419,7 @@ struct mp_decoder_wrapper *mp_decoder_wr p->public.f = public_f; mp_mutex_init(&p->cache_lock); @@ -111,7 +111,7 @@ p->header = src; --- a/filters/f_decoder_wrapper.h +++ b/filters/f_decoder_wrapper.h -@@ -98,6 +98,11 @@ struct mp_decoder { +@@ -104,6 +104,11 @@ struct mp_decoder { // Can be set by decoder impl. on init for "special" functionality. int (*control)(struct mp_filter *f, enum dec_ctrl cmd, void *arg); @@ -133,7 +133,7 @@ #include #include -@@ -61,6 +62,9 @@ void frame_ubwc_decoder_closed(void); +@@ -82,6 +83,9 @@ static void v4l2_note_refused(const AVCo #include "options/m_option.h" @@ -143,7 +143,7 @@ static void init_avctx(struct mp_filter *vd); static void uninit_avctx(struct mp_filter *vd); -@@ -276,6 +280,12 @@ typedef struct lavc_ctx { +@@ -305,6 +309,12 @@ typedef struct lavc_ctx { struct mp_image_pool *dr_pool; int dr_imgfmt, dr_w, dr_h, dr_stride_align; @@ -156,7 +156,7 @@ struct mp_decoder public; } vd_ffmpeg_ctx; -@@ -986,6 +996,12 @@ static void init_avctx(struct mp_filter +@@ -1044,6 +1054,12 @@ static void init_avctx(struct mp_filter if (avcodec_open2(avctx, lavc_codec, NULL) < 0) goto error; @@ -169,7 +169,7 @@ // Sometimes, the first packet contains information required for correct // decoding of the rest of the stream. The only currently known case is the // x264 build number (encoded in a SEI element), needed to enable a -@@ -1063,6 +1079,9 @@ static void uninit_avctx(struct mp_filte +@@ -1124,6 +1140,9 @@ static void uninit_avctx(struct mp_filte const char *wrapper = ctx->avctx && ctx->avctx->codec ? ctx->avctx->codec->wrapper_name : NULL; bool v4l2 = wrapper && strcmp(wrapper, "v4l2m2m") == 0; @@ -179,7 +179,7 @@ avcodec_free_context(&ctx->avctx); // Before a new session allocates its capture buffers (a seek reopens // the decoder), so the old ones are not still kept by the converter. -@@ -1655,6 +1674,12 @@ static int receive_frame(struct mp_filte +@@ -1764,6 +1783,12 @@ static int receive_frame(struct mp_filte if (ret == AVERROR(EAGAIN) && ctx->mvc && vd_mvc_next(ctx->mvc, &mvc_pkt)) return 0; // force retry, so send_mvc_queue() gets called @@ -192,7 +192,7 @@ if (ctx->num_delay_queue <= ctx->max_delay_queue && ret != AVERROR_EOF) return ret; -@@ -1764,6 +1789,17 @@ static void vd_lavc_reset(struct mp_filt +@@ -1876,6 +1901,17 @@ static void vd_lavc_reset(struct mp_filt ctx->framedrop_flags = 0; } @@ -210,7 +210,7 @@ static void vd_lavc_destroy(struct mp_filter *vd) { vd_ffmpeg_ctx *ctx = vd->priv; -@@ -1771,6 +1807,7 @@ static void vd_lavc_destroy(struct mp_fi +@@ -1883,6 +1919,7 @@ static void vd_lavc_destroy(struct mp_fi uninit_avctx(vd); mp_mutex_destroy(&ctx->dr_lock); @@ -218,7 +218,7 @@ } static const struct mp_filter_info vd_lavc_filter = { -@@ -1807,8 +1844,11 @@ static struct mp_decoder *create(struct +@@ -1919,8 +1956,11 @@ static struct mp_decoder *create(struct ctx->public.f = vd; ctx->public.control = control; diff --git a/packaging/frame/mpv-v4l2-reset.patch b/packaging/frame/mpv-v4l2-reset.patch index 6bf1c17..d8fb1bb 100644 --- a/packaging/frame/mpv-v4l2-reset.patch +++ b/packaging/frame/mpv-v4l2-reset.patch @@ -1,4 +1,4 @@ -# Private mpv Frame integration. Apply to the pinned 0.41.0 source after +# Private mpv Frame integration. Apply to the pinned 0.42.0 source after # packaging/mpv/mpv-mvc.patch. --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -34,7 +34,7 @@ #include "options/m_option.h" static void init_avctx(struct mp_filter *vd); -@@ -147,6 +172,7 @@ struct hwdec_opts { +@@ -155,6 +180,7 @@ struct hwdec_opts { int hwdec_image_format; int hwdec_extra_frames; int hwdec_threads; @@ -42,7 +42,7 @@ }; const struct m_sub_options hwdec_conf = { -@@ -165,6 +191,9 @@ const struct m_sub_options hwdec_conf = +@@ -173,6 +199,9 @@ const struct m_sub_options hwdec_conf = .flags = UPDATE_HWDEC}, {"hwdec-threads", OPT_INT(hwdec_threads), M_RANGE(0, DBL_MAX)}, {"vd-lavc-software-fallback", OPT_REPLACED("hwdec-software-fallback")}, @@ -52,7 +52,7 @@ {0} }, .size = sizeof(struct hwdec_opts), -@@ -219,6 +248,13 @@ typedef struct lavc_ctx { +@@ -223,6 +252,13 @@ typedef struct lavc_ctx { bool hwdec_failed; bool hwdec_notified; bool force_eof; @@ -63,10 +63,10 @@ + bool v4l2_smallest_pool; // this session asked for the driver's minimum and one more + bool prefer_v4l2_ubwc; + bool v4l2_eof; + int wait_for_keyframe; // max number of frames to wait for keyframe after reset bool intra_only; - int framedrop_flags; -@@ -698,10 +734,23 @@ static void force_fallback(struct mp_fil +@@ -716,10 +752,23 @@ static void force_fallback(struct mp_fil { vd_ffmpeg_ctx *ctx = vd->priv; @@ -93,7 +93,7 @@ select_and_set_hwdec(vd); init_avctx(vd); } -@@ -711,6 +760,8 @@ static void reinit(struct mp_filter *vd) +@@ -729,6 +778,8 @@ static void reinit(struct mp_filter *vd) vd_ffmpeg_ctx *ctx = vd->priv; uninit_avctx(vd); @@ -102,7 +102,7 @@ /* * Reset attempted hwdecs so that if the hwdec list is reconfigured -@@ -738,6 +789,10 @@ static void init_avctx(struct mp_filter +@@ -761,6 +812,10 @@ static void init_avctx(struct mp_filter vd_ffmpeg_ctx *ctx = vd->priv; struct vd_lavc_params *lavc_param = ctx->opts; struct mp_codec_params *c = ctx->codec; @@ -113,7 +113,7 @@ m_config_cache_update(ctx->opts_cache); -@@ -753,6 +808,34 @@ static void init_avctx(struct mp_filter +@@ -776,6 +831,34 @@ static void init_avctx(struct mp_filter if (!lavc_codec) return; @@ -148,7 +148,7 @@ const AVCodecDescriptor *desc = avcodec_descriptor_get(lavc_codec->id); ctx->intra_only = desc && (desc->props & AV_CODEC_PROP_INTRA_ONLY); -@@ -768,6 +851,37 @@ static void init_avctx(struct mp_filter +@@ -791,6 +874,37 @@ static void init_avctx(struct mp_filter avctx->codec_id = lavc_codec->id; avctx->pkt_timebase = ctx->codec_timebase; @@ -186,7 +186,7 @@ ctx->pic = av_frame_alloc(); if (!ctx->pic) goto error; -@@ -917,8 +1031,20 @@ static void reset_avctx(struct mp_filter +@@ -941,8 +1055,20 @@ static void reset_avctx(struct mp_filter { vd_ffmpeg_ctx *ctx = vd->priv; @@ -208,8 +208,8 @@ + } ctx->flushing = false; ctx->hwdec_request_reinit = false; - } -@@ -957,7 +1083,13 @@ static void uninit_avctx(struct mp_filte + // Wait for the first keyframe after reset to ensure the decoder state is +@@ -984,7 +1110,13 @@ static void uninit_avctx(struct mp_filte mp_free_av_packet(&ctx->avpkt); av_buffer_unref(&ctx->cached_hw_frames_ctx); @@ -223,7 +223,7 @@ av_buffer_unref(&ctx->hwdec_dev); -@@ -1195,7 +1327,7 @@ static void prepare_decoding(struct mp_f +@@ -1249,7 +1381,7 @@ static void prepare_decoding(struct mp_f reset_avctx(vd); } @@ -232,7 +232,7 @@ { vd_ffmpeg_ctx *ctx = vd->priv; struct hwdec_opts *hwdec_opts = ctx->hwdec_opts; -@@ -1204,6 +1336,27 @@ static void handle_err(struct mp_filter +@@ -1258,6 +1390,27 @@ static void handle_err(struct mp_filter ctx->use_hwdec ? " (hardware decoding)" : ""); if (ctx->use_hwdec) { @@ -260,7 +260,7 @@ ctx->hwdec_fail_count += 1; if (ctx->hwdec_fail_count >= hwdec_opts->software_fallback) ctx->hwdec_failed = true; -@@ -1253,7 +1406,7 @@ static bool send_mvc_queue(struct mp_fil +@@ -1307,7 +1460,7 @@ static bool send_mvc_queue(struct mp_fil if (ret == AVERROR(EAGAIN)) return true; if (ret < 0 && ret != AVERROR_EOF) @@ -269,7 +269,7 @@ vd_mvc_pop(ctx->mvc); } return false; -@@ -1262,6 +1415,29 @@ static bool send_mvc_queue(struct mp_fil +@@ -1316,6 +1469,29 @@ static bool send_mvc_queue(struct mp_fil static int send_packet(struct mp_filter *vd, struct demux_packet *pkt) { vd_ffmpeg_ctx *ctx = vd->priv; @@ -299,7 +299,7 @@ if (ctx->num_requeue_packets && ctx->requeue_packets[0] != pkt) return AVERROR(EAGAIN); // cannot consume the packet -@@ -1291,6 +1467,7 @@ static int send_packet(struct mp_filter +@@ -1354,6 +1530,7 @@ static int send_packet(struct mp_filter return 0; int ret; @@ -307,7 +307,7 @@ if (ctx->mvc) { if (!vd_mvc_send(ctx->mvc, pkt)) { // The rewrite can't take this stream: carry on in 2D, from a -@@ -1328,7 +1505,7 @@ static int send_packet(struct mp_filter +@@ -1391,7 +1568,7 @@ static int send_packet(struct mp_filter } if (ret < 0) @@ -316,7 +316,7 @@ return ret; } -@@ -1352,6 +1529,8 @@ static int decode_frame(struct mp_filter +@@ -1415,6 +1592,8 @@ static int decode_frame(struct mp_filter if (!avctx || ctx->force_eof) return AVERROR_EOF; @@ -325,7 +325,7 @@ prepare_decoding(vd); -@@ -1362,9 +1541,20 @@ static int decode_frame(struct mp_filter +@@ -1425,9 +1604,20 @@ static int decode_frame(struct mp_filter if (ctx->mvc) send_mvc_queue(vd); @@ -346,7 +346,7 @@ // If flushing was initialized earlier and has ended now, make it // start over in case we get new packets at some point in the future. // This must take the delay queue into account, so avctx returns EOF -@@ -1374,11 +1564,23 @@ static int decode_frame(struct mp_filter +@@ -1437,11 +1627,23 @@ static int decode_frame(struct mp_filter } else if (ret == AVERROR(EAGAIN)) { // just retry after caller writes a packet } else { @@ -371,7 +371,7 @@ mp_codec_info_from_av(avctx, ctx->codec); // If something was decoded successfully, it must return a frame with valid -@@ -1394,7 +1596,7 @@ static int decode_frame(struct mp_filter +@@ -1457,7 +1659,7 @@ static int decode_frame(struct mp_filter if (mpi->imgfmt == IMGFMT_CUDA && !mpi->planes[0]) { MP_ERR(vd, "CUDA frame without data. This is a FFmpeg bug.\n"); talloc_free(mpi); @@ -380,7 +380,7 @@ return AVERROR_BUG; } -@@ -1415,7 +1617,7 @@ static int decode_frame(struct mp_filter +@@ -1478,7 +1680,7 @@ static int decode_frame(struct mp_filter if (!sw) { MP_ERR(vd, "Could not copy back hardware decoded frame.\n"); ctx->hwdec_fail_count = INT_MAX - 1; // force fallback @@ -389,7 +389,7 @@ return AVERROR_UNKNOWN; } mpi = sw; -@@ -1426,6 +1628,21 @@ static int decode_frame(struct mp_filter +@@ -1489,6 +1691,21 @@ static int decode_frame(struct mp_filter return ret; } @@ -411,7 +411,7 @@ MP_TARRAY_APPEND(ctx, ctx->delay_queue, ctx->num_delay_queue, mpi); return ret; } -@@ -1490,7 +1707,7 @@ static int receive_frame(struct mp_filte +@@ -1553,7 +1770,7 @@ static int receive_frame(struct mp_filte if (!res) { MP_ERR(vd, "Could not copy back hardware decoded frame.\n"); ctx->hwdec_fail_count = INT_MAX - 1; // force fallback @@ -420,7 +420,7 @@ return AVERROR_UNKNOWN; } } -@@ -1571,6 +1788,10 @@ static void vd_lavc_reset(struct mp_filt +@@ -1637,6 +1854,10 @@ static void vd_lavc_reset(struct mp_filt flush_all(vd); @@ -433,7 +433,7 @@ } --- a/meson.build +++ b/meson.build -@@ -1480,6 +1480,8 @@ endif +@@ -1532,6 +1532,8 @@ endif features += {'dmabuf-interop-gl': features['egl'] and drm.found()} if features['dmabuf-interop-gl'] dependencies += drm.partial_dependency(includes: true, compile_args: true) @@ -570,8 +570,8 @@ +#endif static const struct libmpv_gpu_context_fns *context_backends[] = { - #if HAVE_GL -@@ -16,6 +32,42 @@ struct priv { + #if HAVE_D3D11 +@@ -19,6 +35,42 @@ struct priv { struct libmpv_gpu_context *context; struct gl_video *renderer; @@ -614,7 +614,7 @@ }; struct native_resource_entry { -@@ -168,11 +220,453 @@ static int get_target_size(struct render +@@ -171,11 +223,453 @@ static int get_target_size(struct render return 0; } @@ -1068,7 +1068,7 @@ // Mapping the surface is cheap, better than adding new backend entrypoints. struct ra_tex *tex; int err = p->context->fns->wrap_fbo(p->context, params, &tex); -@@ -188,6 +682,9 @@ static int render(struct render_backend +@@ -193,6 +687,9 @@ static int render(struct render_backend struct ra_fbo target = {.tex = tex, .flip = flip}; gl_video_render_frame(p->renderer, frame, &target, RENDER_FRAME_DEF); @@ -1078,7 +1078,7 @@ p->context->fns->done_frame(p->context, frame->display_synced); return 0; -@@ -221,6 +718,17 @@ static void destroy(struct render_backen +@@ -226,6 +723,17 @@ static void destroy(struct render_backen { struct priv *p = ctx->priv; @@ -1096,7 +1096,7 @@ if (p->renderer) gl_video_uninit(p->renderer); -@@ -243,6 +751,10 @@ const struct render_backend_fns render_b +@@ -248,6 +756,10 @@ const struct render_backend_fns render_b .resize = resize, .get_target_size = get_target_size, .render = render, @@ -1109,7 +1109,7 @@ .perfdata = perfdata, --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c -@@ -4115,6 +4115,12 @@ void gl_video_reset(struct gl_video *p) +@@ -4247,6 +4247,12 @@ void gl_video_reset(struct gl_video *p) gl_video_reset_surfaces(p); } @@ -1122,7 +1122,7 @@ bool gl_video_showing_interpolated_frame(struct gl_video *p) { return p->is_interpolated; -@@ -4196,6 +4202,14 @@ struct gl_video *gl_video_init(struct ra +@@ -4328,6 +4334,14 @@ struct gl_video *gl_video_init(struct ra }); init_gl(p); reinit_from_options(p); @@ -1161,7 +1161,7 @@ /* Handle input and redraw events, called by vo_check_events() */ VOCTRL_CHECK_EVENTS, /* signal a device pause */ -@@ -539,6 +541,7 @@ bool vo_has_frame(struct vo *vo); +@@ -540,6 +542,7 @@ bool vo_has_frame(struct vo *vo); void vo_redraw(struct vo *vo); bool vo_want_redraw(struct vo *vo); void vo_seek_reset(struct vo *vo); @@ -1171,7 +1171,7 @@ int64_t vo_get_drop_count(struct vo *vo); --- a/video/out/vo.c +++ b/video/out/vo.c -@@ -1281,10 +1281,35 @@ void vo_seek_reset(struct vo *vo) +@@ -1280,10 +1280,35 @@ void vo_seek_reset(struct vo *vo) struct vo_internal *in = vo->in; mp_mutex_lock(&in->lock); forget_frames(vo); @@ -1253,7 +1253,7 @@ return VO_TRUE; --- a/player/video.c +++ b/player/video.c -@@ -158,6 +158,20 @@ static void vo_chain_uninit(struct vo_ch +@@ -163,6 +163,20 @@ static void vo_chain_uninit(struct vo_ch void uninit_video_chain(struct MPContext *mpctx) { if (mpctx->vo_chain) { @@ -1276,7 +1276,7 @@ mpctx->vo_chain = NULL; --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h -@@ -223,6 +223,7 @@ bool gl_video_icc_auto_enabled(struct gl +@@ -226,6 +226,7 @@ bool gl_video_icc_auto_enabled(struct gl bool gl_video_gamma_auto_enabled(struct gl_video *p); void gl_video_reset(struct gl_video *p); @@ -1286,7 +1286,7 @@ struct mp_hwdec_devices; --- a/filters/f_decoder_wrapper.c +++ b/filters/f_decoder_wrapper.c -@@ -544,6 +544,15 @@ bool mp_decoder_wrapper_get_pts_reset(st +@@ -608,6 +608,15 @@ bool mp_decoder_wrapper_get_pts_reset(st return res; } @@ -1304,7 +1304,7 @@ struct priv *p = d->f->priv; --- a/filters/f_decoder_wrapper.h +++ b/filters/f_decoder_wrapper.h -@@ -59,6 +59,7 @@ void mp_decoder_wrapper_set_coverart_fla +@@ -63,6 +63,7 @@ void mp_decoder_wrapper_set_coverart_fla bool mp_decoder_wrapper_get_pts_reset(struct mp_decoder_wrapper *d); void mp_decoder_wrapper_set_play_dir(struct mp_decoder_wrapper *d, int dir); diff --git a/packaging/libplacebo/NOTICE b/packaging/libplacebo/NOTICE new file mode 100644 index 0000000..2415892 --- /dev/null +++ b/packaging/libplacebo/NOTICE @@ -0,0 +1,42 @@ +Notices for code in libplacebo that is not under libplacebo's own licence +and whose grant is not written out in the file's header. + +src/filters.c: +Some of the filter code originally derives (via mpv) from Glumpy +(https://github.com/glumpy/glumpy/blob/master/glumpy/library/build-spatial-filters.py): + +Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of Nicolas P. Rougier nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +src/convert.cc, number printing and parsing: +Copyright (c) 2007-2016 Alexis Naveros, under the zlib licence written out +in that file. + +3rdparty/json.h (https://github.com/sheredom/json.h), the scene parser's +JSON reader: released into the public domain (the Unlicense, +http://unlicense.org/). diff --git a/packaging/mpv/NOTICE b/packaging/mpv/NOTICE new file mode 100644 index 0000000..298d3b1 --- /dev/null +++ b/packaging/mpv/NOTICE @@ -0,0 +1,62 @@ +Notices for code in mpv that is not under mpv's own licence and whose +grant is not written out in the file it is in. + +video/out/filter_kernels.c: +Some of the filter code was taken from Glumpy +(https://github.com/glumpy/glumpy/blob/master/glumpy/library/build-spatial-filters.py): + +Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of Nicolas P. Rougier nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +sub/osd_font.otf (compiled into libmpv by sub/osd_libass.c): +Its glyphs U+E200 to U+E215 are icons from Microsoft's Fluent UI System +Icons, https://github.com/microsoft/fluentui-system-icons, revision +9a4a2db2df7f0067b4ef43c5ae5bfcae3759a5a0 (v1.1.320), as listed in +TOOLS/gen-fluent-glyphs.py: + +MIT License + +Copyright (c) 2020 Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packaging/mpv/mpv-mvc.patch b/packaging/mpv/mpv-mvc.patch index 6fa0c37..14557cb 100644 --- a/packaging/mpv/mpv-mvc.patch +++ b/packaging/mpv/mpv-mvc.patch @@ -1,5 +1,5 @@ # Two-view H.264 MVC (3D Blu-ray, Stereo High) in both views: see -# video/decode/vd_mvc.h. Apply to the pinned 0.41.0 source with +# video/decode/vd_mvc.h. Apply to the pinned 0.42.0 source with # packaging/mpv/mvc/ copied to video/decode/mvc/, before the Frame patches. # Also: no decoder error for Blu-ray DTS-HD audio after seeks (demux_lavf). --- a/demux/demux_lavf.c @@ -12,15 +12,15 @@ #include #include #include -@@ -220,6 +221,7 @@ struct stream_info { - double last_key_pts; +@@ -235,6 +236,7 @@ struct stream_info { double highest_pts; double ts_offset; + struct mp_dovi_split *dovi_split; + bool seeked; // no packet read since the last seek }; - typedef struct lavf_priv { -@@ -250,6 +252,16 @@ typedef struct lavf_priv { + struct avio_cookie { +@@ -275,6 +277,16 @@ typedef struct lavf_priv { AVDictionary *av_opts; @@ -37,7 +37,7 @@ // Proxying nested streams. struct nested_stream *nested; int num_nested; -@@ -588,6 +600,38 @@ static void guess_and_set_vobsub_name(st +@@ -639,6 +651,38 @@ static void guess_and_set_vobsub_name(st talloc_free(tmp); } @@ -76,8 +76,8 @@ static void select_tracks(struct demuxer *demuxer, int start) { lavf_priv_t *priv = demuxer->priv; -@@ -598,6 +642,13 @@ static void select_tracks(struct demuxer - !stream->attached_picture; +@@ -655,6 +699,13 @@ static void select_tracks(struct demuxer + } st->discard = selected ? AVDISCARD_DEFAULT : AVDISCARD_ALL; } + // The dependent view goes with the base view. @@ -90,7 +90,7 @@ } static inline const uint8_t *mp_av_stream_get_side_data(const AVStream *st, -@@ -718,6 +769,12 @@ static void handle_new_stream(demuxer_t +@@ -775,6 +826,12 @@ static void handle_new_stream(demuxer_t break; } case AVMEDIA_TYPE_VIDEO: { @@ -103,8 +103,8 @@ sh = demux_alloc_sh_stream(STREAM_VIDEO); if ((st->disposition & AV_DISPOSITION_ATTACHED_PIC) && -@@ -773,6 +830,14 @@ static void handle_new_stream(demuxer_t - // This also applies to vfw-muxed mkv, but we can't detect these easily. +@@ -835,6 +892,14 @@ static void handle_new_stream(demuxer_t + // AVI uses decode-order indices as DTS and needs the compensation. sh->codec->avi_dts = matches_avinputformat_name(priv, "avi"); + if (priv->mvc_ts && priv->mvc_base < 0 && @@ -118,7 +118,7 @@ break; } case AVMEDIA_TYPE_SUBTITLE: { -@@ -977,6 +1042,8 @@ static int demux_open_lavf(demuxer_t *de +@@ -1467,6 +1532,8 @@ static int demux_open_lavf(demuxer_t *de demuxer->priv = priv; priv->stream = demuxer->stream; @@ -127,7 +127,7 @@ priv->opts = mp_get_config_group(priv, demuxer->global, &demux_lavf_conf); struct demux_lavf_opts *lavfdopts = priv->opts; -@@ -1103,6 +1170,21 @@ static int demux_open_lavf(demuxer_t *de +@@ -1619,6 +1686,21 @@ static int demux_open_lavf(demuxer_t *de priv->avfc = avfc; @@ -149,7 +149,7 @@ bool probeinfo = lavfdopts->probeinfo != 0; switch (lavfdopts->probeinfo) { case -2: probeinfo = priv->avfc->nb_streams == 0; break; -@@ -1211,6 +1293,133 @@ fail: +@@ -1750,6 +1832,133 @@ fail: return -1; } @@ -283,7 +283,7 @@ static bool demux_lavf_read_packet(struct demuxer *demux, struct demux_packet **mp_pkt) { -@@ -1218,7 +1427,7 @@ static bool demux_lavf_read_packet(struc +@@ -1764,7 +1973,7 @@ static bool demux_lavf_read_packet(struc AVPacket *pkt = av_packet_alloc(); MP_HANDLE_OOM(pkt); @@ -292,7 +292,7 @@ update_read_stats(demux); if (r < 0) { av_packet_free(&pkt); -@@ -1247,6 +1456,20 @@ static bool demux_lavf_read_packet(struc +@@ -1804,6 +2013,20 @@ static bool demux_lavf_read_packet(struc return true; // don't signal EOF if skipping a packet } @@ -313,16 +313,16 @@ // Never send additional frames for streams that are a single frame. if (stream->image && priv->format_hack.first_frame_only && pkt->pos != 0) { av_packet_free(&pkt); -@@ -1315,6 +1538,8 @@ static void demux_drop_buffers_lavf(demu - { +@@ -1895,6 +2118,8 @@ static void demux_drop_buffers_lavf(demu lavf_priv_t *priv = demuxer->priv; - av_seek_frame(priv->avfc, -1, 0, 1); + if (!priv->stream || priv->stream->seekable) + av_seek_frame(priv->avfc, -1, 0, 1); + mvc_clear(priv); + set_seeked(priv); demux_flush(demuxer); - stream_drop_buffers(priv->stream); - avio_flush(priv->avfc->pb); -@@ -1388,6 +1613,22 @@ static void demux_seek_lavf(demuxer_t *d + if (priv->stream) + stream_drop_buffers(priv->stream); +@@ -1980,6 +2205,22 @@ static void demux_seek_lavf(demuxer_t *d } } @@ -345,7 +345,7 @@ int r = av_seek_frame(priv->avfc, seek_stream, seek_pts_av, avsflags); if (r < 0 && (avsflags & AVSEEK_FLAG_BACKWARD)) { // When seeking before the beginning of the file, and seeking fails, -@@ -1415,6 +1656,7 @@ static void demux_close_lavf(demuxer_t * +@@ -2008,6 +2249,7 @@ static void demux_close_lavf(demuxer_t * { lavf_priv_t *priv = demuxer->priv; if (priv) { @@ -355,7 +355,7 @@ avformat_close_input(&priv->avfc); --- a/demux/stheader.h +++ b/demux/stheader.h -@@ -113,6 +113,7 @@ struct mp_codec_params { +@@ -162,6 +162,7 @@ struct mp_codec_params { // STREAM_VIDEO bool avi_dts; // use DTS timing; first frame and DTS is 0 @@ -363,24 +363,11 @@ double fps; // frames per second (set only if constant fps) bool reliable_fps; // the fps field is definitely not broken int par_w, par_h; // pixel aspect ratio (0 if unknown/square) ---- a/filters/f_decoder_wrapper.c -+++ b/filters/f_decoder_wrapper.c -@@ -610,7 +610,9 @@ static void fix_image_params(struct priv - if (m.p_w <= 0 || m.p_h <= 0) - m.p_w = m.p_h = 1; - -- m.stereo3d = p->codec->stereo_mode; -+ // A decoder that joins views says so (vd_mvc.h). -+ if (m.stereo3d == MP_STEREO3D_MONO) -+ m.stereo3d = p->codec->stereo_mode; - - if (!mp_rect_equals(&p->codec->crop, &(struct mp_rect){0})) { - struct mp_rect crop = p->codec->crop; --- a/filters/f_decoder_wrapper.h +++ b/filters/f_decoder_wrapper.h -@@ -75,6 +75,9 @@ enum dec_ctrl { - // framedrop mode: 0=none, 1=standard, 2=hrseek - VDCTRL_SET_FRAMEDROP, +@@ -81,6 +81,9 @@ enum dec_ctrl { + // int*: extra hw surfaces retained + VDCTRL_SET_EXTRA_HW_FRAMES, VDCTRL_CHECK_FORCED_EOF, + // two-view MVC: "stereo" (both views), "2d" (base view only); false if + // the video isn't MVC @@ -390,7 +377,7 @@ int mp_decoder_wrapper_control(struct mp_decoder_wrapper *d, --- a/meson.build +++ b/meson.build -@@ -209,6 +209,9 @@ sources = files( +@@ -222,6 +222,9 @@ sources = files( ## Video 'video/csputils.c', 'video/decode/vd_lavc.c', @@ -402,7 +389,7 @@ 'video/filter/vf_sub.c', --- a/player/command.c +++ b/player/command.c -@@ -2314,6 +2314,21 @@ static int mp_property_hwdec_current(voi +@@ -2451,6 +2451,21 @@ static int mp_property_hwdec_current(voi return m_property_strdup_ro(action, arg, current); } @@ -424,7 +411,7 @@ static int mp_property_hwdec_interop(void *ctx, struct m_property *prop, int action, void *arg) { -@@ -4464,6 +4479,7 @@ static const struct m_property mp_proper +@@ -4808,6 +4823,7 @@ static const struct m_property mp_proper {"video-aspect-override", mp_property_video_aspect_override}, {"vid", mp_property_switch_track, .priv = (void *)(const int[]){0, STREAM_VIDEO}}, {"hwdec-current", mp_property_hwdec_current}, @@ -432,7 +419,7 @@ {"hwdec-interop", mp_property_hwdec_interop}, {"estimated-frame-count", mp_property_frame_count}, -@@ -4596,7 +4612,7 @@ static const char *const *const mp_event +@@ -4948,7 +4964,7 @@ static const char *const *const mp_event "video-format", "video-codec", "video-bitrate", "dwidth", "dheight", "width", "height", "container-fps", "aspect", "aspect-name", "vo-configured", "current-vo", "video-dec-params", "osd-dimensions", "hwdec", "hwdec-current", "hwdec-interop", @@ -451,7 +438,7 @@ #include "options/m_option.h" -@@ -84,6 +85,8 @@ struct vd_lavc_params { +@@ -92,6 +93,8 @@ struct vd_lavc_params { bool check_hw_profile; char **avopts; int dr; @@ -460,7 +447,7 @@ }; static const struct m_opt_choice_alternatives discard_names[] = { -@@ -115,6 +118,9 @@ const struct m_sub_options vd_lavc_conf +@@ -123,6 +126,9 @@ const struct m_sub_options vd_lavc_conf {"vd-lavc-dr", OPT_CHOICE(dr, {"auto", -1}, {"no", 0}, {"yes", 1})}, {"vd-apply-cropping", OPT_BOOL(apply_cropping)}, @@ -470,9 +457,9 @@ {0} }, .change_flags = UPDATE_VD, -@@ -217,6 +223,14 @@ typedef struct lavc_ctx { - bool intra_only; +@@ -223,6 +229,14 @@ typedef struct lavc_ctx { int framedrop_flags; + int extra_hw_frames_hint; // VDCTRL_SET_EXTRA_HW_FRAMES + // Two-view H.264 MVC (vd_mvc.h): set while both views are decoded. + struct vd_mvc *mvc; @@ -485,7 +472,7 @@ bool hw_probing; struct demux_packet **sent_packets; int num_sent_packets; -@@ -492,6 +506,15 @@ static AVBufferRef *hwdec_create_dev(str +@@ -499,6 +513,15 @@ static AVBufferRef *hwdec_create_dev(str return NULL; } @@ -501,7 +488,7 @@ // Select if and which hwdec to use. Also makes sure to get the decode device. static void select_and_set_hwdec(struct mp_filter *vd) { -@@ -533,8 +556,17 @@ static void select_and_set_hwdec(struct +@@ -543,8 +566,17 @@ static void select_and_set_hwdec(struct for (int n = 0; n < num_hwdecs; n++) { struct hwdec_info *hwdec = &hwdecs[n]; @@ -521,7 +508,7 @@ continue; hwdec_name_supported = true; -@@ -792,7 +824,8 @@ static void init_avctx(struct mp_filter +@@ -815,7 +847,8 @@ static void init_avctx(struct mp_filter mp_set_avcodec_threads(vd->log, avctx, threads); @@ -531,8 +518,8 @@ avctx->opaque = vd; avctx->get_buffer2 = get_buffer2_direct; } -@@ -851,6 +884,12 @@ static void init_avctx(struct mp_filter - } +@@ -875,6 +908,12 @@ static void init_avctx(struct mp_filter + avctx->max_pixels = 2048 * 2048; #endif + // The rewritten MVC pictures carry their own parameter sets, in Annex B. @@ -544,7 +531,7 @@ /* open it */ if (avcodec_open2(avctx, lavc_codec, NULL) < 0) goto error; -@@ -859,7 +898,7 @@ static void init_avctx(struct mp_filter +@@ -883,7 +922,7 @@ static void init_avctx(struct mp_filter // decoding of the rest of the stream. The only currently known case is the // x264 build number (encoded in a SEI element), needed to enable a // workaround for broken 4:4:4 streams produced by older x264 versions. @@ -553,7 +540,7 @@ mp_set_av_packet(ctx->avpkt, c->first_packet, &ctx->codec_timebase); avcodec_send_packet(avctx, ctx->avpkt); avcodec_receive_frame(avctx, ctx->pic); -@@ -888,6 +927,12 @@ static void flush_all(struct mp_filter * +@@ -915,6 +954,12 @@ static void flush_all(struct mp_filter * { vd_ffmpeg_ctx *ctx = vd->priv; @@ -566,7 +553,7 @@ for (int n = 0; n < ctx->num_delay_queue; n++) talloc_free(ctx->delay_queue[n]); ctx->num_delay_queue = 0; -@@ -1133,7 +1178,8 @@ static void prepare_decoding(struct mp_f +@@ -1187,7 +1232,8 @@ static void prepare_decoding(struct mp_f if (!avctx) return; @@ -576,7 +563,7 @@ if (drop == 1) { avctx->skip_frame = opts->framedrop; // normal framedrop } else if (drop == 2) { -@@ -1142,7 +1188,7 @@ static void prepare_decoding(struct mp_f +@@ -1196,7 +1242,7 @@ static void prepare_decoding(struct mp_f if (ctx->intra_only) avctx->skip_frame = AVDISCARD_ALL; } else { @@ -585,7 +572,7 @@ } if (ctx->hwdec_request_reinit) -@@ -1164,10 +1210,58 @@ static void handle_err(struct mp_filter +@@ -1218,10 +1264,58 @@ static void handle_err(struct mp_filter } } @@ -645,7 +632,7 @@ if (ctx->num_requeue_packets && ctx->requeue_packets[0] != pkt) return AVERROR(EAGAIN); // cannot consume the packet -@@ -1178,16 +1272,53 @@ static int send_packet(struct mp_filter +@@ -1232,6 +1326,19 @@ static int send_packet(struct mp_filter if (!ctx->avctx) return AVERROR_EOF; @@ -664,6 +651,8 @@ + prepare_decoding(vd); + if (ctx->wait_for_keyframe > 0 && pkt) { +@@ -1246,11 +1353,35 @@ static int send_packet(struct mp_filter if (avctx->skip_frame == AVDISCARD_ALL) return 0; @@ -704,7 +693,7 @@ if (ctx->hw_probing && ctx->num_sent_packets < 32 && ctx->hwdec_opts->software_fallback <= 32) -@@ -1228,6 +1359,9 @@ static int decode_frame(struct mp_filter +@@ -1291,6 +1422,9 @@ static int decode_frame(struct mp_filter if (ctx->num_requeue_packets) send_queued_packet(vd); @@ -714,7 +703,7 @@ int ret = avcodec_receive_frame(avctx, ctx->pic); if (ret < 0) { if (ret == AVERROR_EOF) { -@@ -1269,9 +1403,29 @@ static int decode_frame(struct mp_filter +@@ -1332,9 +1466,29 @@ static int decode_frame(struct mp_filter mpi->pts = mp_pts_from_av(ctx->pic->pts, &ctx->codec_timebase); mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, &ctx->codec_timebase); mpi->pkt_duration = mp_pts_from_av(ctx->pic->duration, &ctx->codec_timebase); @@ -744,7 +733,7 @@ MP_TARRAY_APPEND(ctx, ctx->delay_queue, ctx->num_delay_queue, mpi); return ret; } -@@ -1312,6 +1466,10 @@ static int receive_frame(struct mp_filte +@@ -1375,6 +1529,10 @@ static int receive_frame(struct mp_filte if (ret == AVERROR(EAGAIN) && ctx->num_requeue_packets) return 0; // force retry, so send_queued_packet() gets called @@ -755,7 +744,7 @@ if (ctx->num_delay_queue <= ctx->max_delay_queue && ret != AVERROR_EOF) return ret; -@@ -1391,6 +1549,11 @@ static int control(struct mp_filter *vd, +@@ -1457,6 +1615,11 @@ static int control(struct mp_filter *vd, case VDCTRL_REINIT: reinit(vd); return CONTROL_TRUE; @@ -767,8 +756,8 @@ } return CONTROL_UNKNOWN; } -@@ -1465,6 +1628,9 @@ static struct mp_decoder *create(struct - ctx->vo = info->dr_vo; +@@ -1532,6 +1695,9 @@ static struct mp_decoder *create(struct + ctx->force_swdec = info->force_swdec; } + if (vd_mvc_by_params(codec)) diff --git a/packaging/release/assemble.py b/packaging/release/assemble.py index 74b9f82..6d3d4db 100644 --- a/packaging/release/assemble.py +++ b/packaging/release/assemble.py @@ -154,6 +154,7 @@ def assemble(bundle, app, work, sdk, cache, supplement, metadata, source_name): "libssh": ["COPYING", "BSD"], "libudfread": ["COPYING"], "libbluray": ["COPYING"], + "libplacebo": ["LICENSE"], "json": ["LICENSE.MIT"], "mpv": ["LICENSE*", "Copyright"], "ffmpeg": ["COPYING*", "LICENSE*"], @@ -166,6 +167,9 @@ def assemble(bundle, app, work, sdk, cache, supplement, metadata, source_name): "libudfread": "LGPL-2.1-or-later; shared, replaceable; unmodified; examples disabled", "libbluray": ("LGPL-2.1-or-later; shared, replaceable; unmodified; used to read disc playlists only; " "BD-J (Java), tools, FreeType, fontconfig and libxml2 disabled; no AACS or BD+ library bundled"), + "libplacebo": ("LGPL-2.1-or-later with per-file notices; shared, replaceable; unmodified; colour code only: " + "Vulkan, OpenGL, Direct3D 11, shader compilers, libdovi and demos disabled; " + "Glumpy (BSD-3-Clause), zlib-licensed and public-domain parts in share/licenses/libplacebo/NOTICE"), "json": "MIT; compiled-in header library, unmodified", "mpv": ("upstream GPL-2.0-or-later, combined under GPLv3; both builds modified by mpv-mvc.patch and the " "packaging/mpv/mvc sources (3D Blu-ray, GPL-3.0); Frame build also by mpv-v4l2-reset.patch, " @@ -196,15 +200,15 @@ def assemble(bundle, app, work, sdk, cache, supplement, metadata, source_name): copied += 1 if not copied: raise RuntimeError("Missing licence files for " + item["name"]) - if item["name"] == "libsmb2": - shutil.copy2(app / "packaging/libsmb2/NOTICE", destination / "NOTICE") - if item["name"] in ("mpv", "ffmpeg"): + if item["name"] in ("libsmb2", "mpv", "libplacebo"): + shutil.copy2(app / "packaging" / item["name"] / "NOTICE", destination / "NOTICE") + if item["name"] in ("mpv", "ffmpeg", "libplacebo"): per_file_notices(source, destination / "PER-FILE-NOTICES") notices.append(f"{item['name']} {item['version']}: {item['url']}; {descriptions[item['name']]}") # Debian's copyright includes librsvg's vendored Rust grants. Preserve the # complete file rather than inventing one top-level licence for all crates. packages = {x["name"]: x for x in supplement["binaries"] if x["role"] == "runtime"} - for name in ["glslang-dev", "spirv-tools", "spirv-headers", "libxxhash-dev"]: + for name in ["libxxhash-dev"]: packages.setdefault(name, {"version": "see SDK package inventory", "homepage": "https://sources.debian.org/"}) for name, item in sorted(packages.items()): copyright_file = rooted(sdk, Path("usr/share/doc") / name / "copyright") @@ -220,8 +224,11 @@ def assemble(bundle, app, work, sdk, cache, supplement, metadata, source_name): crate_notices(rsvg[0], licenses / "librsvg2-2/crates") notices.append("librsvg's vendored Rust crates (including ICU4X under Unicode-3.0): each crate's licence " "files and declared licence in share/licenses/librsvg2-2/crates/.") - notices.append("mpv and FFmpeg files with their own BSD, MIT, ISC or IJG grants: share/licenses/mpv/PER-FILE-NOTICES " - "and share/licenses/ffmpeg/PER-FILE-NOTICES.") + notices.append("mpv, FFmpeg and libplacebo files with their own BSD, MIT, ISC or IJG grants: " + "share/licenses/mpv/PER-FILE-NOTICES, share/licenses/ffmpeg/PER-FILE-NOTICES " + "and share/licenses/libplacebo/PER-FILE-NOTICES. Glumpy's filter code in mpv and libplacebo " + "(BSD-3-Clause) and the Fluent UI System Icons in mpv's OSD font (MIT, Microsoft): " + "share/licenses/mpv/NOTICE and share/licenses/libplacebo/NOTICE.") notices.append("This software is based in part on the work of the Independent JPEG Group.") common = sdk / "usr/share/common-licenses" shutil.copytree(common, licenses / "common-licenses") diff --git a/packaging/release/build-sdk.sh b/packaging/release/build-sdk.sh index 58a569c..9617e3b 100644 --- a/packaging/release/build-sdk.sh +++ b/packaging/release/build-sdk.sh @@ -63,7 +63,8 @@ export CFLAGS="-O2 -ffile-prefix-map=/work=. -ffile-prefix-map=/src=." export CXXFLAGS="$CFLAGS" json_source=/work/source/json -mpv_source=/work/source/mpv-0.41.0 +mpv_source=/work/source/mpv-0.42.0 +placebo_source=/work/source/libplacebo-v7.387.0 ffmpeg_source=/work/source/ffmpeg-9.1 smb2_source=/work/source/libsmb2-2bcb014b23a8c8cccf534eea8bda2fe5df453cfd ssh_source=/work/source/libssh-0.12.2 @@ -118,6 +119,17 @@ meson install -C /work/libbluray-build cp /work/libudfread-build/meson-info/intro-buildoptions.json /work/config/libudfread-options.json cp /work/libbluray-build/meson-info/intro-buildoptions.json /work/config/libbluray-options.json "$PKG_CONFIG" --modversion libudfread libbluray +# mpv needs libplacebo 7.387 or newer. Its OpenGL renderer uses only the +# colour and tone-mapping code, so no graphics backend or shader compiler. +meson setup /work/libplacebo-build "$placebo_source" "${cross[@]}" \ + --prefix="$prefix" --libdir=lib --buildtype=release --wrap-mode=nofallback \ + -Ddefault_library=shared -Dvulkan=disabled -Dvk-proc-addr=disabled -Dopengl=disabled \ + -Dgl-proc-addr=disabled -Dd3d11=disabled -Dglslang=disabled -Dshaderc=disabled \ + -Dlcms=enabled -Dxxhash=enabled -Dlibdovi=disabled -Dunwind=disabled -Ddemos=false +ninja -C /work/libplacebo-build -j"$jobs" +meson install -C /work/libplacebo-build +cp /work/libplacebo-build/meson-info/intro-buildoptions.json /work/config/libplacebo-options.json +"$PKG_CONFIG" --modversion libplacebo # Both architectures: 3D Blu-ray (MVC) in both views. The Frame's patches # apply on top of it. mkdir -p "$mpv_source/video/decode/mvc" @@ -161,7 +173,11 @@ if [[ $arch == x86_64 ]]; then fi mkdir -p /work/ffmpeg-build cd /work/ffmpeg-build +# Without dovi_split, mpv passes a Dolby Vision enhancement layer to the base +# layer's decoder, which skips it. With it, mpv decodes the layer separately +# for gpu-next, the only renderer that draws it; the app uses gpu. "$ffmpeg_source/configure" --prefix="$prefix" "${ffmpeg_cross[@]}" "${ffmpeg_desktop[@]}" "${ffmpeg_licence[@]}" \ + --disable-bsf=dovi_split \ --pkg-config="$PKG_CONFIG" --disable-autodetect --enable-libdrm --enable-v4l2-m2m \ --enable-zlib --enable-bzlib --enable-lzma --enable-gnutls --enable-libdav1d --enable-libopus \ --enable-shared --disable-static --disable-doc --disable-debug --disable-programs \ diff --git a/packaging/release/debian.json b/packaging/release/debian.json index b773fee..01f0ae0 100644 --- a/packaging/release/debian.json +++ b/packaging/release/debian.json @@ -6,8 +6,8 @@ "amd64": {"path":"dists/trixie/main/binary-amd64/Packages.xz", "sha256":"7778d3e3f303b7ddb8ce0fe7c8d57473a076c6bf2e8f241f75421d2396352498"}, "source": {"path":"dists/trixie/main/source/Sources.xz", "sha256":"6002f81f463a2d976d84b34170367cc16da2d60bd0ba9ab9d868d6e1c1a935d9"} }, - "runtime": ["libglfw3", "libass9", "libplacebo349", "liblcms2-2", "librsvg2-2", "libunibreak6", "libdisplay-info2"], - "development": ["libglfw3-dev", "libass-dev", "libplacebo-dev", "liblcms2-dev", "librsvg2-dev", "libunibreak-dev", "libxxhash-dev", "libdisplay-info-dev", "libopengl-dev", "libopengl0"], - "build_tools": ["nasm"], - "static_sources": ["glslang", "spirv-tools", "spirv-headers", "xxhash"] + "runtime": ["libglfw3", "libass9", "liblcms2-2", "librsvg2-2", "libunibreak6", "libdisplay-info2"], + "development": ["libglfw3-dev", "libass-dev", "liblcms2-dev", "librsvg2-dev", "libunibreak-dev", "libxxhash-dev", "libdisplay-info-dev", "libopengl-dev", "libopengl0"], + "build_tools": ["nasm", "python3-jinja2", "python3-markupsafe"], + "static_sources": ["xxhash"] } diff --git a/packaging/release/sources.json b/packaging/release/sources.json index 2a2ad38..c8d2eba 100644 --- a/packaging/release/sources.json +++ b/packaging/release/sources.json @@ -6,7 +6,8 @@ {"name":"libbluray", "version":"1.5.1", "published":"2026-08-31T19:56:08Z", "file":"libbluray-1.5.1.tar.gz", "directory":"libbluray-1.5.1", "url":"https://code.videolan.org/videolan/libbluray/-/archive/1.5.1/libbluray-1.5.1.tar.gz", "sha256":"ee46f99adc591d18a9485b404cb04be6ba6fcde5bd45590ea94d0c1432d448c9"}, {"name":"json", "version":"3.11.3", "published":"2023-11-28T00:00:00Z", "file":"json-3.11.3.tar.xz", "directory":"json", "url":"https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz", "sha256":"d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d"}, {"name":"nv-codec-headers", "version":"12.0.16.1", "published":"2023-10-06T13:30:54Z", "file":"nv-codec-headers-12.0.16.1.tar.gz", "directory":"nv-codec-headers-12.0.16.1", "url":"https://github.com/FFmpeg/nv-codec-headers/releases/download/n12.0.16.1/nv-codec-headers-12.0.16.1.tar.gz", "sha256":"bfb3306f22c169fedcfc5489b344f414089eec796ffd528412677b0c872bc6e2"}, - {"name":"mpv", "version":"0.41.0", "published":"2025-12-21T19:17:10Z", "file":"mpv-0.41.0.tar.gz", "directory":"mpv-0.41.0", "url":"https://github.com/mpv-player/mpv/archive/refs/tags/v0.41.0.tar.gz", "sha256":"ee21092a5ee427353392360929dc64645c54479aefdb5babc5cfbb5fad626209"}, + {"name":"libplacebo", "version":"7.387.0", "published":"2026-10-25T17:55:23Z", "file":"libplacebo-v7.387.0.tar.gz", "directory":"libplacebo-v7.387.0", "url":"https://code.videolan.org/videolan/libplacebo/-/archive/v7.387.0/libplacebo-v7.387.0.tar.gz", "sha256":"3bf5d72786682c194387c33d563872f6bfe202a9816f9dde6535a31a9b2e0d74"}, + {"name":"mpv", "version":"0.42.0", "published":"2026-11-05T00:56:42Z", "file":"mpv-0.42.0.tar.gz", "directory":"mpv-0.42.0", "url":"https://github.com/mpv-player/mpv/archive/refs/tags/v0.42.0.tar.gz", "sha256":"bcfebbfa2b65a6d88dc97ea18117831072373e38b5785a2afb874ed4df5070dd"}, {"name":"ffmpeg", "version":"9.1", "published":"2026-11-20T00:16:41Z", "cooldown_waiver":"Owner approved 2026-11-21", "file":"ffmpeg-9.1.tar.xz", "directory":"ffmpeg-9.1", "url":"https://ffmpeg.org/releases/ffmpeg-9.1.tar.xz", "sha256":"1a4d394ae63d190a526cd052eb4415c156b5c5e2df37efab41a7de0b8fde2433"} ], "fonts": [ diff --git a/src/frame_grabber.cpp b/src/frame_grabber.cpp index bbe07bf..156d7e9 100644 --- a/src/frame_grabber.cpp +++ b/src/frame_grabber.cpp @@ -30,6 +30,8 @@ bool FrameGrabber::init(GlInterop& interop, const std::string& hwdec, int maxWid if (!glContext.configure(mpv_)) return false; mpv_set_option_string(mpv_, "vo", "libmpv"); mpv_set_option_string(mpv_, "hwdec", hwdec.c_str()); + // The same video track as the player's (VideoPlayer::init). + mpv_set_option_string(mpv_, "flatten-editions", "yes"); mpv_set_option_string(mpv_, "pause", "yes"); mpv_set_option_string(mpv_, "keep-open", "yes"); mpv_set_option_string(mpv_, "idle", "yes"); diff --git a/src/video_player.cpp b/src/video_player.cpp index aefa25b..ff88374 100644 --- a/src/video_player.cpp +++ b/src/video_player.cpp @@ -201,6 +201,9 @@ bool VideoPlayer::init(const std::string& hwdec, GlInterop& interop, const MpvGl if (!glContext.configure(mpv_)) return false; mpv_set_option_string(mpv_, "vo", "libmpv"); mpv_set_option_string(mpv_, "hwdec", hwdec.c_str()); + // mpv 0.42 shows only one program's tracks of a multi-program MPEG-TS, + // and the menus have no program picker: list them all, as before. + mpv_set_option_string(mpv_, "flatten-editions", "yes"); v4l2_ = hwdec == "v4l2m2m"; if (hwdec == "v4l2m2m-copy" || hwdec == "v4l2m2m") { if (kStandaloneHeadset && decoderQueue) {