Skip to content

Commit

Permalink
ad_spdif: handle deprecated FF_PROFILE_* definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dudemanguy committed Mar 4, 2024
1 parent 9ac791c commit 4678215
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions audio/decode/ad_spdif.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@

#define OUTBUF_SIZE 65536

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 26, 100)
#define AV_PROFILE_UNKNOWN FF_PROFILE_UNKNOWN
#define AV_PROFILE_DTS_HD_HRA FF_PROFILE_DTS_HD_MA
#define AV_PROFILE_DTS_HD_MA AV_PROFILE_UNKNOWN
#endif

struct spdifContext {
struct mp_log *log;
enum AVCodecID codec_id;
Expand Down Expand Up @@ -90,7 +96,7 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
int *out_profile, int *out_rate)
{
struct spdifContext *spdif_ctx = da->priv;
int profile = FF_PROFILE_UNKNOWN;
int profile = AV_PROFILE_UNKNOWN;
AVCodecContext *ctx = NULL;
AVFrame *frame = NULL;

Expand All @@ -115,7 +121,7 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
av_parser_close(parser);
}

if (profile != FF_PROFILE_UNKNOWN || spdif_ctx->codec_id != AV_CODEC_ID_DTS)
if (profile != AV_PROFILE_UNKNOWN || spdif_ctx->codec_id != AV_CODEC_ID_DTS)
return;

const AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);
Expand Down Expand Up @@ -145,7 +151,7 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
av_frame_free(&frame);
avcodec_free_context(&ctx);

if (profile == FF_PROFILE_UNKNOWN)
if (profile == AV_PROFILE_UNKNOWN)
MP_WARN(da, "Failed to parse codec profile.\n");
}

Expand All @@ -155,7 +161,7 @@ static int init_filter(struct mp_filter *da)

AVPacket *pkt = spdif_ctx->avpkt;

int profile = FF_PROFILE_UNKNOWN;
int profile = AV_PROFILE_UNKNOWN;
int c_rate = 0;
determine_codec_params(da, pkt, &profile, &c_rate);
MP_VERBOSE(da, "In: profile=%d samplerate=%d\n", profile, c_rate);
Expand Down Expand Up @@ -208,9 +214,9 @@ static int init_filter(struct mp_filter *da)
num_channels = 2;
break;
case AV_CODEC_ID_DTS: {
bool is_hd = profile == FF_PROFILE_DTS_HD_HRA ||
profile == FF_PROFILE_DTS_HD_MA ||
profile == FF_PROFILE_UNKNOWN;
bool is_hd = profile == AV_PROFILE_DTS_HD_HRA ||
profile == AV_PROFILE_DTS_HD_MA ||
profile == AV_PROFILE_UNKNOWN;

// Apparently, DTS-HD over SPDIF is specified to be 7.1 (8 channels)
// for DTS-HD MA, and stereo (2 channels) for DTS-HD HRA. The bit
Expand Down

0 comments on commit 4678215

Please sign in to comment.