mirror of https://github.com/mpv-player/mpv
parent
9c03b7569b
commit
83bad548d2
|
@ -37,6 +37,12 @@
|
||||||
|
|
||||||
#define OUTBUF_SIZE 65536
|
#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_HRA
|
||||||
|
#define AV_PROFILE_DTS_HD_MA FF_PROFILE_DTS_HD_MA
|
||||||
|
#endif
|
||||||
|
|
||||||
struct spdifContext {
|
struct spdifContext {
|
||||||
struct mp_log *log;
|
struct mp_log *log;
|
||||||
enum AVCodecID codec_id;
|
enum AVCodecID codec_id;
|
||||||
|
@ -90,7 +96,7 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
|
||||||
int *out_profile, int *out_rate)
|
int *out_profile, int *out_rate)
|
||||||
{
|
{
|
||||||
struct spdifContext *spdif_ctx = da->priv;
|
struct spdifContext *spdif_ctx = da->priv;
|
||||||
int profile = FF_PROFILE_UNKNOWN;
|
int profile = AV_PROFILE_UNKNOWN;
|
||||||
AVCodecContext *ctx = NULL;
|
AVCodecContext *ctx = NULL;
|
||||||
AVFrame *frame = NULL;
|
AVFrame *frame = NULL;
|
||||||
|
|
||||||
|
@ -115,7 +121,7 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
|
||||||
av_parser_close(parser);
|
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;
|
return;
|
||||||
|
|
||||||
const AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);
|
const AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);
|
||||||
|
@ -145,7 +151,7 @@ done:
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
avcodec_free_context(&ctx);
|
avcodec_free_context(&ctx);
|
||||||
|
|
||||||
if (profile == FF_PROFILE_UNKNOWN)
|
if (profile == AV_PROFILE_UNKNOWN)
|
||||||
MP_WARN(da, "Failed to parse codec profile.\n");
|
MP_WARN(da, "Failed to parse codec profile.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +161,7 @@ static int init_filter(struct mp_filter *da)
|
||||||
|
|
||||||
AVPacket *pkt = spdif_ctx->avpkt;
|
AVPacket *pkt = spdif_ctx->avpkt;
|
||||||
|
|
||||||
int profile = FF_PROFILE_UNKNOWN;
|
int profile = AV_PROFILE_UNKNOWN;
|
||||||
int c_rate = 0;
|
int c_rate = 0;
|
||||||
determine_codec_params(da, pkt, &profile, &c_rate);
|
determine_codec_params(da, pkt, &profile, &c_rate);
|
||||||
MP_VERBOSE(da, "In: profile=%d samplerate=%d\n", profile, c_rate);
|
MP_VERBOSE(da, "In: profile=%d samplerate=%d\n", profile, c_rate);
|
||||||
|
@ -208,9 +214,9 @@ static int init_filter(struct mp_filter *da)
|
||||||
num_channels = 2;
|
num_channels = 2;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_DTS: {
|
case AV_CODEC_ID_DTS: {
|
||||||
bool is_hd = profile == FF_PROFILE_DTS_HD_HRA ||
|
bool is_hd = profile == AV_PROFILE_DTS_HD_HRA ||
|
||||||
profile == FF_PROFILE_DTS_HD_MA ||
|
profile == AV_PROFILE_DTS_HD_MA ||
|
||||||
profile == FF_PROFILE_UNKNOWN;
|
profile == AV_PROFILE_UNKNOWN;
|
||||||
|
|
||||||
// Apparently, DTS-HD over SPDIF is specified to be 7.1 (8 channels)
|
// 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
|
// for DTS-HD MA, and stereo (2 channels) for DTS-HD HRA. The bit
|
||||||
|
|
Loading…
Reference in New Issue