mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.76k stars 2.84k forks source link

ad_spdif: set codec params #14188

Closed kasper93 closed 1 month ago

kasper93 commented 1 month ago

It seems that we decode small portion of the audio to determine codec params. We can remember that information.

Fixes: #14178

kasper93 commented 1 month ago

@mitzsch: Could you test this to see if it is what you expect?

github-actions[bot] commented 1 month ago

Download the artifacts for this pull request:

Windows * [mpv-i686-w64-mingw32](https://nightly.link/mpv-player/mpv/actions/artifacts/1520308005.zip) * [mpv-x86_64-w64-mingw32](https://nightly.link/mpv-player/mpv/actions/artifacts/1520310181.zip) * [mpv-x86_64-windows-msvc](https://nightly.link/mpv-player/mpv/actions/artifacts/1520329150.zip)
macOS * [mpv-macos-12-intel](https://nightly.link/mpv-player/mpv/actions/artifacts/1520307791.zip) * [mpv-macos-13-intel](https://nightly.link/mpv-player/mpv/actions/artifacts/1520306978.zip) * [mpv-macos-14-arm](https://nightly.link/mpv-player/mpv/actions/artifacts/1520303579.zip)
mitzsch commented 1 month ago

Thanks for your work! Unfortunately, I´m off my AVR system again for some time - so I can only test with -ao=null.

It now shows => image or image

So it now shows the codec (nice!) but not the profile. Would it be possible now to also show the profile?

image

kasper93 commented 1 month ago

Updated, there was not so correct assumption, that got outdated over the years.

mitzsch commented 1 month ago

Perfect! Works!!!

image

Edit: On DTSX Files it only show DTS-HD MA (same file) - all other DTS modes (HRA/MA/DTS96/24) are correctly identified.

image

image

kasper93 commented 1 month ago

To little data is decoded while probing probably. But since, the decoding anything in the first place is not that great, I doubt this will change. Unless it is required for proper playback.

Also maybe just in case it is in fact detected, it would be good to add those profiles. But since it is not detected anyway. I would not change that, unless there are playback issues.

diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c
index 3f83ab240e..0f0252cb83 100644
--- a/audio/decode/ad_spdif.c
+++ b/audio/decode/ad_spdif.c
@@ -231,6 +231,8 @@ static int init_filter(struct mp_filter *da)
     case AV_CODEC_ID_DTS: {
         bool is_hd = profile == AV_PROFILE_DTS_HD_HRA ||
                      profile == AV_PROFILE_DTS_HD_MA  ||
+                     profile == AV_PROFILE_DTS_HD_MA_X  ||
+                     profile == AV_PROFILE_DTS_HD_MA_X_IMAX  ||
                      profile == AV_PROFILE_UNKNOWN;

         // Apparently, DTS-HD over SPDIF is specified to be 7.1 (8 channels)
mitzsch commented 1 month ago

To little data is decoded while probing probably.

Ok, I see, but I guess it's fine with the new state introduced by this commit. Having it to show the codec + profile is a nice addition. Thanks! :)