From a1d0efa41e7e2f5d1d863d8dea89708b3d27453d Mon Sep 17 00:00:00 2001 From: sthen Date: Sun, 3 Apr 2022 11:12:09 +0000 Subject: [PATCH] xine-lib: add upstream fixes, via Brad --- multimedia/xine-lib/Makefile | 2 +- ...tch-src_combined_ffmpeg_ff_video_decoder_c | 95 +++++++++++++++++++ .../patches/patch-src_dxr3_ffmpeg_encoder_c | 26 +++++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 multimedia/xine-lib/patches/patch-src_combined_ffmpeg_ff_video_decoder_c create mode 100644 multimedia/xine-lib/patches/patch-src_dxr3_ffmpeg_encoder_c diff --git a/multimedia/xine-lib/Makefile b/multimedia/xine-lib/Makefile index 067d37454b1..b206e8b7db2 100644 --- a/multimedia/xine-lib/Makefile +++ b/multimedia/xine-lib/Makefile @@ -1,7 +1,7 @@ COMMENT= multimedia decoding library DISTNAME= xine-lib-1.2.12 -REVISION= 1 +REVISION= 2 CATEGORIES= multimedia MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=xine/} EXTRACT_SUFX= .tar.xz diff --git a/multimedia/xine-lib/patches/patch-src_combined_ffmpeg_ff_video_decoder_c b/multimedia/xine-lib/patches/patch-src_combined_ffmpeg_ff_video_decoder_c new file mode 100644 index 00000000000..a7b6c566595 --- /dev/null +++ b/multimedia/xine-lib/patches/patch-src_combined_ffmpeg_ff_video_decoder_c @@ -0,0 +1,95 @@ +- Drop always true check + b1ecb15deaf85079b3543b8b27f876abe580acd9 +- Drop redundant flag + 584638837b26fb35ec4ce082304e2943af51072d +- Check for NULL + fc5c2dde344ea039391e111bd7b0d5ab8198a544 + +Index: src/combined/ffmpeg/ff_video_decoder.c +--- src/combined/ffmpeg/ff_video_decoder.c.orig ++++ src/combined/ffmpeg/ff_video_decoder.c +@@ -127,7 +127,6 @@ struct ff_video_decoder_s { + + uint8_t decoder_ok:1; + uint8_t decoder_init_mode:1; +- uint8_t is_mpeg12:1; + #ifdef HAVE_POSTPROC + uint8_t pp_available:1; + #endif +@@ -1699,7 +1698,7 @@ static int ff_vc1_find_header(ff_video_decoder_t *this + + static int ff_check_extradata(ff_video_decoder_t *this, unsigned int codec_type, buf_element_t *buf) + { +- if (this->context && this->context->extradata) ++ if (this->context->extradata) + return 1; + + switch (codec_type) { +@@ -1713,8 +1712,6 @@ static int ff_check_extradata(ff_video_decoder_t *this + + static void ff_init_mpeg12_mode(ff_video_decoder_t *this) + { +- this->is_mpeg12 = 1; +- + if (this->decoder_init_mode) { + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + "mpeg-1 (ffmpeg)"); +@@ -1725,7 +1722,8 @@ static void ff_init_mpeg12_mode(ff_video_decoder_t *th + + if ( this->mpeg_parser == NULL ) { + this->mpeg_parser = calloc(1, sizeof(mpeg_parser_t)); +- mpeg_parser_init(this->mpeg_parser, AV_INPUT_BUFFER_PADDING_SIZE); ++ if (this->mpeg_parser) ++ mpeg_parser_init(this->mpeg_parser, AV_INPUT_BUFFER_PADDING_SIZE); + } + } + +@@ -1739,7 +1737,7 @@ static void ff_handle_preview_buffer (ff_video_decoder + ff_init_mpeg12_mode(this); + } + +- if (this->decoder_init_mode && !this->is_mpeg12) { ++ else if (this->decoder_init_mode && !this->mpeg_parser) { + + if (!ff_check_extradata(this, codec_type, buf)) + return; +@@ -2066,9 +2064,12 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_ + + lprintf("handle_mpeg12_buffer\n"); + +- if (!this->is_mpeg12) { ++ if (!this->mpeg_parser) { + /* initialize mpeg parser */ + ff_init_mpeg12_mode(this); ++ if (!this->mpeg_parser) { ++ return; ++ } + } + + #ifdef DEBUG_MPEG_PARSER +@@ -2653,7 +2654,7 @@ static void ff_decode_data (video_decoder_t *this_gen, + } + + } else { +- if (this->decoder_init_mode && !this->is_mpeg12) ++ if (this->decoder_init_mode) + ff_handle_preview_buffer(this, buf); + + /* decode */ +@@ -2875,7 +2876,7 @@ static void ff_reset (video_decoder_t *this_gen) { + #endif + } + +- if (this->is_mpeg12) ++ if (this->mpeg_parser) + mpeg_parser_reset(this->mpeg_parser); + + /* this->pts_tag_pass = 0; */ +@@ -2997,7 +2998,6 @@ static video_decoder_t *ff_video_open_plugin (video_de + #ifndef HAVE_ZERO_SAFE_MEM + this->size = 0; + this->decoder_ok = 0; +- this->is_mpeg12 = 0; + this->aspect_ratio = 0; + this->pts_tag_pass = 0; + #ifdef HAVE_POSTPROC diff --git a/multimedia/xine-lib/patches/patch-src_dxr3_ffmpeg_encoder_c b/multimedia/xine-lib/patches/patch-src_dxr3_ffmpeg_encoder_c new file mode 100644 index 00000000000..be5c5563060 --- /dev/null +++ b/multimedia/xine-lib/patches/patch-src_dxr3_ffmpeg_encoder_c @@ -0,0 +1,26 @@ +- ffmpeg_encoder: fix setting codec option + 81ba6f23b5362d8bb9140b210dd562f05add1bb0 +- Add const + 2750d2ee4ad1beb661bffd9cb696d6a5d619e5cf + +Index: src/dxr3/ffmpeg_encoder.c +--- src/dxr3/ffmpeg_encoder.c.orig ++++ src/dxr3/ffmpeg_encoder.c +@@ -123,7 +123,7 @@ static int lavc_prepare_frame(lavc_data_t *this, dxr3_ + static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) + { + lavc_data_t *this = (lavc_data_t *)drv->enc; +- AVCodec *codec; ++ const AVCodec *codec; + unsigned char use_quantizer; + + if (this->context) { +@@ -223,7 +223,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, d + this->context->gop_size = 0; /*intra frames only */ + /* TJ. this version is known to have that but maybe its not the first. */ + #if LIBAVCODEC_VERSION_INT >= XFF_INT_VERSION(56,56,101) +- av_opt_set_int (codec, "motion_est", 0 /* "zero" */, 0); ++ av_opt_set_int (this->context->priv_data, "motion_est", 0 /* "zero" */, 0); + #else + this->context->me_method = ME_ZERO; /*motion estimation type*/ + #endif