Projects
Multimedia
handbrake
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 31
View file
handbrake.changes
Changed
@@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Oct 14 12:43:29 UTC 2019 - manfred.h@gmx.net + +- Add patch audio_resample-issue#2126.patch to fix + <https://github.com/HandBrake/HandBrake/issues/2124> + +------------------------------------------------------------------- Tue Feb 26 12:24:08 UTC 2019 - enzokiel@kabelmail.de - update to version 1.2.2
View file
handbrake.spec
Changed
@@ -26,6 +26,7 @@ Source1: https://github.com/HandBrake/HandBrake/releases/download/%{version}/HandBrake-%{version}-source.tar.bz2.sig Patch0: HandBrake-no-builddate.patch Patch1: HandBrake-build-shared.patch +Patch2: audio_resample-issue#2126.patch License: GPL-2.0+ Group: Productivity/Multimedia/Video/Editors and Convertors BuildRequires: autoconf @@ -111,6 +112,7 @@ %setup -q -n HandBrake-%{version} %patch0 -p0 %patch1 -p0 +%patch2 -p1 %build export CFLAGS="%{optflags} -fno-strict-aliasing -Wno-unused -I%{_includedir}/ffmpeg"
View file
audio_resample-issue#2126.patch
Added
@@ -0,0 +1,226 @@ +commit 4ba75f97f31b0e6f64ebd4684d5f2aeeba494629 +Author: John Stebbins <jstebbins.hb@gmail.com> +Date: Thu May 30 08:45:13 2019 -0700 + + audio_resample: set input and output samplerate + + Fixes https://github.com/HandBrake/HandBrake/issues/2124 + +diff -rup HandBrake-1.2.2.orig/libhb/audio_resample.c HandBrake-1.2.2/libhb/audio_resample.c +--- HandBrake-1.2.2.orig/libhb/audio_resample.c 2019-02-22 17:23:51.000000000 +0100 ++++ HandBrake-1.2.2/libhb/audio_resample.c 2019-10-14 14:32:45.006416242 +0200 +@@ -12,6 +12,7 @@ + #include "audio_resample.h" + + hb_audio_resample_t* hb_audio_resample_init(enum AVSampleFormat sample_fmt, ++ int sample_rate, + int hb_amixdown, int normalize_mix) + { + hb_audio_resample_t *resample = calloc(1, sizeof(hb_audio_resample_t)); +@@ -56,6 +57,7 @@ hb_audio_resample_t* hb_audio_resample_i + resample->out.channel_layout = channel_layout; + resample->out.matrix_encoding = matrix_encoding; + resample->out.sample_fmt = sample_fmt; ++ resample->out.sample_rate = sample_rate; + if (normalize_mix) + { + resample->out.maxval = 1.0; +@@ -68,6 +70,7 @@ hb_audio_resample_t* hb_audio_resample_i + + // set default input characteristics + resample->in.sample_fmt = resample->out.sample_fmt; ++ resample->in.sample_rate = resample->out.sample_rate; + resample->in.channel_layout = resample->out.channel_layout; + resample->in.lfe_mix_level = HB_MIXLEV_ZERO; + resample->in.center_mix_level = HB_MIXLEV_DEFAULT; +@@ -145,6 +148,15 @@ void hb_audio_resample_set_sample_fmt(hb + } + } + ++void hb_audio_resample_set_sample_rate(hb_audio_resample_t *resample, ++ int sample_rate) ++{ ++ if (resample != NULL) ++ { ++ resample->in.sample_rate = sample_rate; ++ } ++} ++ + int hb_audio_resample_update(hb_audio_resample_t *resample) + { + if (resample == NULL) +@@ -157,11 +169,13 @@ int hb_audio_resample_update(hb_audio_re + + resample->resample_needed = + (resample->out.sample_fmt != resample->in.sample_fmt || ++ resample->out.sample_rate != resample->in.sample_rate || + resample->out.channel_layout != resample->in.channel_layout); + + resample_changed = + (resample->resample_needed && + (resample->resample.sample_fmt != resample->in.sample_fmt || ++ resample->resample.sample_rate != resample->in.sample_rate || + resample->resample.channel_layout != resample->in.channel_layout || + resample->resample.lfe_mix_level != resample->in.lfe_mix_level || + resample->resample.center_mix_level != resample->in.center_mix_level || +@@ -181,6 +195,8 @@ int hb_audio_resample_update(hb_audio_re + + av_opt_set_int(resample->swresample, "out_sample_fmt", + resample->out.sample_fmt, 0); ++ av_opt_set_int(resample->swresample, "out_sample_rate", ++ resample->out.sample_rate, 0); + av_opt_set_int(resample->swresample, "out_channel_layout", + resample->out.channel_layout, 0); + av_opt_set_int(resample->swresample, "matrix_encoding", +@@ -191,6 +207,8 @@ int hb_audio_resample_update(hb_audio_re + + av_opt_set_int(resample->swresample, "in_sample_fmt", + resample->in.sample_fmt, 0); ++ av_opt_set_int(resample->swresample, "in_sample_rate", ++ resample->in.sample_rate, 0); + av_opt_set_int(resample->swresample, "in_channel_layout", + resample->in.channel_layout, 0); + av_opt_set_double(resample->swresample, "lfe_mix_level", +@@ -212,6 +230,7 @@ int hb_audio_resample_update(hb_audio_re + } + + resample->resample.sample_fmt = resample->in.sample_fmt; ++ resample->resample.sample_rate = resample->in.sample_rate; + resample->resample.channel_layout = resample->in.channel_layout; + resample->resample.channels = + av_get_channel_layout_nb_channels(resample->in.channel_layout); +@@ -255,11 +274,13 @@ hb_buffer_t* hb_audio_resample(hb_audio_ + + if (resample->resample_needed) + { +- out_size = av_samples_get_buffer_size(NULL, +- resample->out.channels, nsamples, ++ out_samples = (nsamples + 1) * resample->out.sample_rate / ++ resample->in.sample_rate; ++ out_size = av_samples_get_buffer_size(NULL, resample->out.channels, ++ out_samples, + resample->out.sample_fmt, 0); + out = hb_buffer_init(out_size); +- out_samples = swr_convert(resample->swresample, &out->data, nsamples, ++ out_samples = swr_convert(resample->swresample, &out->data, out_samples, + samples, nsamples); + + if (out_samples <= 0) +diff -rup HandBrake-1.2.2.orig/libhb/audio_resample.h HandBrake-1.2.2/libhb/audio_resample.h +--- HandBrake-1.2.2.orig/libhb/audio_resample.h 2019-02-22 17:23:51.000000000 +0100 ++++ HandBrake-1.2.2/libhb/audio_resample.h 2019-10-14 14:32:45.006416242 +0200 +@@ -37,6 +37,7 @@ typedef struct + + struct + { ++ int sample_rate; + uint64_t channel_layout; + double lfe_mix_level; + double center_mix_level; +@@ -46,6 +47,7 @@ typedef struct + + struct + { ++ int sample_rate; + int channels; + uint64_t channel_layout; + double lfe_mix_level; +@@ -56,6 +58,7 @@ typedef struct + + struct + { ++ int sample_rate; + int channels; + int sample_size; + uint64_t channel_layout; +@@ -72,6 +75,7 @@ typedef struct + * as the output characteristics (no conversion needed). + */ + hb_audio_resample_t* hb_audio_resample_init(enum AVSampleFormat sample_fmt, ++ int sample_rate, + int hb_amixdown, int normalize_mix); + + /* The following functions set the audio input characteristics. +@@ -91,6 +95,9 @@ void hb_audio_resample_s + void hb_audio_resample_set_sample_fmt(hb_audio_resample_t *resample, + enum AVSampleFormat sample_fmt); + ++void hb_audio_resample_set_sample_rate(hb_audio_resample_t *resample, ++ int sample_rate); ++ + /* Update an hb_audio_resample_t. + * + * Must be called after using any of the above functions. +diff -rup HandBrake-1.2.2.orig/libhb/decavcodec.c HandBrake-1.2.2/libhb/decavcodec.c +--- HandBrake-1.2.2.orig/libhb/decavcodec.c 2019-02-22 17:23:51.000000000 +0100 ++++ HandBrake-1.2.2/libhb/decavcodec.c 2019-10-14 14:32:45.006416242 +0200 +@@ -204,8 +204,13 @@ static int decavcodecaInit( hb_work_obje + /* Downmixing & sample_fmt conversion */ + if (!(w->audio->config.out.codec & HB_ACODEC_PASS_FLAG)) + { ++ // Currently, samplerate conversion is performed in sync.c ++ // So set output samplerate to input samplerate ++ // This should someday get reworked to be part of an audio ++ // filter pipleine. + pv->resample = + hb_audio_resample_init(AV_SAMPLE_FMT_FLT, ++ w->audio->config.in.samplerate, + w->audio->config.out.mixdown, + w->audio->config.out.normalize_mix_level); + if (pv->resample == NULL) +@@ -2308,6 +2313,8 @@ static void decodeAudio(hb_work_private_ + hb_audio_resample_set_channel_layout(pv->resample, channel_layout); + hb_audio_resample_set_sample_fmt(pv->resample, + pv->frame->format); ++ hb_audio_resample_set_sample_rate(pv->resample, ++ pv->frame->sample_rate); + if (hb_audio_resample_update(pv->resample)) + { + hb_log("decavcodec: hb_audio_resample_update() failed"); +Only in HandBrake-1.2.2/libhb: decavcodec.c.orig +diff -rup HandBrake-1.2.2.orig/libhb/declpcm.c HandBrake-1.2.2/libhb/declpcm.c +--- HandBrake-1.2.2.orig/libhb/declpcm.c 2019-02-22 17:23:51.000000000 +0100 ++++ HandBrake-1.2.2/libhb/declpcm.c 2019-10-14 14:32:45.006416242 +0200 +@@ -166,8 +166,12 @@ static int declpcmInit( hb_work_object_t + pv->job = job; + + pv->next_pts = (int64_t)AV_NOPTS_VALUE; ++ // Currently, samplerate conversion is performed in sync.c ++ // So set output samplerate to input samplerate ++ // This should someday get reworked to be part of an audio filter pipleine. + pv->resample = + hb_audio_resample_init(AV_SAMPLE_FMT_FLT, ++ w->audio->config.in.samplerate, + w->audio->config.out.mixdown, + w->audio->config.out.normalize_mix_level); + if (pv->resample == NULL) +@@ -333,6 +337,8 @@ static hb_buffer_t *Decode( hb_work_obje + + hb_audio_resample_set_channel_layout(pv->resample, + hdr2layout[pv->nchannels - 1]); ++ hb_audio_resample_set_sample_rate(pv->resample, ++ pv->samplerate); + if (hb_audio_resample_update(pv->resample)) + { + hb_log("declpcm: hb_audio_resample_update() failed"); +diff -rup HandBrake-1.2.2.orig/libhb/encavcodecaudio.c HandBrake-1.2.2/libhb/encavcodecaudio.c +--- HandBrake-1.2.2.orig/libhb/encavcodecaudio.c 2019-02-22 17:23:51.000000000 +0100 ++++ HandBrake-1.2.2/libhb/encavcodecaudio.c 2019-10-14 14:32:45.006416242 +0200 +@@ -249,13 +249,13 @@ static int encavcodecaInit(hb_work_objec + context->channel_layout, 0); + av_opt_set_int(pv->swresample, "out_channel_layout", + context->channel_layout, 0); ++ av_opt_set_int(pv->swresample, "in_sample_rate", ++ context->sample_rate, 0); ++ av_opt_set_int(pv->swresample, "out_sample_rate", ++ context->sample_rate, 0); + if (hb_audio_dither_is_supported(audio->config.out.codec)) + { + // dithering needs the sample rate +- av_opt_set_int(pv->swresample, "in_sample_rate", +- context->sample_rate, 0); +- av_opt_set_int(pv->swresample, "out_sample_rate", +- context->sample_rate, 0); + av_opt_set_int(pv->swresample, "dither_method", + audio->config.out.dither_method, 0); + }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.