forked from macports/macports-ports
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Link ffmpeg6, new debug variant
- Loading branch information
i0ntempest
committed
May 12, 2024
1 parent
f475201
commit cd90aeb
Showing
2 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- ip/ffmpeg.c.orig 2024-05-11 16:04:09 | ||
+++ ip/ffmpeg.c 2024-05-11 21:19:10 | ||
@@ -60,7 +60,7 @@ | ||
struct ffmpeg_private { | ||
AVCodecContext *codec_context; | ||
AVFormatContext *input_context; | ||
- AVCodec const *codec; | ||
+ AVCodec *codec; | ||
SwrContext *swr; | ||
|
||
struct ffmpeg_input *input; | ||
@@ -141,7 +141,8 @@ | ||
int err = 0; | ||
int i; | ||
int stream_index = -1; | ||
- AVCodec const *codec; | ||
+ int64_t channel_layout = 0; | ||
+ AVCodec *codec; | ||
AVCodecContext *cc = NULL; | ||
AVFormatContext *ic = NULL; | ||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101) | ||
@@ -238,26 +239,15 @@ | ||
|
||
/* Prepare for resampling. */ | ||
swr = swr_alloc(); | ||
-#if LIBAVCODEC_VERSION_MAJOR >= 58 | ||
- if (cc->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) | ||
- av_channel_layout_default(&cc->ch_layout, cc->ch_layout.nb_channels); | ||
- av_opt_set_chlayout(swr, "in_chlayout", &cc->ch_layout, 0); | ||
- av_opt_set_chlayout(swr, "out_chlayout", &cc->ch_layout, 0); | ||
-#else | ||
av_opt_set_int(swr, "in_channel_layout", av_get_default_channel_layout(cc->channels), 0); | ||
av_opt_set_int(swr, "out_channel_layout", av_get_default_channel_layout(cc->channels), 0); | ||
-#endif | ||
av_opt_set_int(swr, "in_sample_rate", cc->sample_rate, 0); | ||
av_opt_set_int(swr, "out_sample_rate", cc->sample_rate, 0); | ||
av_opt_set_sample_fmt(swr, "in_sample_fmt", cc->sample_fmt, 0); | ||
priv->swr = swr; | ||
|
||
ip_data->private = priv; | ||
-#if LIBAVCODEC_VERSION_MAJOR >= 58 | ||
- ip_data->sf = sf_rate(cc->sample_rate) | sf_channels(cc->ch_layout.nb_channels); | ||
-#else | ||
ip_data->sf = sf_rate(cc->sample_rate) | sf_channels(cc->channels); | ||
-#endif | ||
switch (cc->sample_fmt) { | ||
case AV_SAMPLE_FMT_U8: | ||
ip_data->sf |= sf_bits(8) | sf_signed(0); | ||
@@ -275,11 +265,8 @@ | ||
} | ||
swr_init(swr); | ||
ip_data->sf |= sf_host_endian(); | ||
-#if LIBAVCODEC_VERSION_MAJOR >= 58 | ||
- channel_map_init_waveex(cc->ch_layout.nb_channels, cc->ch_layout.u.mask, ip_data->channel_map); | ||
-#else | ||
- channel_map_init_waveex(cc->channels, cc->channel_layout, ip_data->channel_map); | ||
-#endif | ||
+ channel_layout = cc->channel_layout; | ||
+ channel_map_init_waveex(cc->channels, channel_layout, ip_data->channel_map); | ||
return 0; | ||
} | ||
|
||
@@ -391,11 +378,7 @@ | ||
if (res < 0) | ||
res = 0; | ||
output->buffer_pos = output->buffer; | ||
-#if LIBAVCODEC_VERSION_MAJOR >= 58 | ||
- output->buffer_used_len = res * cc->ch_layout.nb_channels * sizeof(int16_t); | ||
-#else | ||
output->buffer_used_len = res * cc->channels * sizeof(int16_t); | ||
-#endif | ||
#if LIBAVCODEC_VERSION_MAJOR >= 56 | ||
av_frame_free(&frame); | ||
#else |