testing code
---
 avconv.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/avconv.c b/avconv.c
index edce1e5..348f312 100644
--- a/avconv.c
+++ b/avconv.c
@@ -46,6 +46,7 @@
 #include "libavutil/libm.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/time.h"
+#include "libavutil/downmix_info.h"
 #include "libavformat/os_support.h"
 
 # include "libavfilter/avfilter.h"
@@ -1073,6 +1074,45 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
         return ret;
     }
 
+    /* log AVDownmixInfo side data for the first frame */
+    static int dirty_counter = 0;
+    if (!dirty_counter) {
+        AVFrameSideData *side_data;
+        if ((side_data = av_frame_get_side_data(decoded_frame,
+                                                AV_FRAME_DATA_DOWNMIX_INFO))) {
+            AVDownmixInfo *downmix_info = (AVDownmixInfo*)side_data->data;
+            switch (downmix_info->preferred_downmix_type) {
+            case AV_DOWNMIX_TYPE_LORO:
+                av_log(NULL, AV_LOG_FATAL,
+                       "Preferred downmix:  Lo/Ro\n");
+                break;
+            case AV_DOWNMIX_TYPE_UNKNOWN:
+                av_log(NULL, AV_LOG_FATAL,
+                       "Preferred downmix:  Unknown\n");
+                break;
+            case AV_DOWNMIX_TYPE_DPLII:
+                av_log(NULL, AV_LOG_FATAL,
+                       "Preferred downmix:  Dolby Pro Logic II\n");
+                break;
+            case AV_DOWNMIX_TYPE_LTRT:
+                av_log(NULL, AV_LOG_FATAL,
+                       "Preferred downmix:  Lt/Rt (Dolby Surround)\n");
+                break;
+            default:
+                break;
+            }
+            av_log(NULL, AV_LOG_FATAL, "Center   mix level: %lf ltrt: %lf\n",
+                   downmix_info->center_mix_level,
+                   downmix_info->center_mix_level_ltrt);
+            av_log(NULL, AV_LOG_FATAL, "Surround mix level: %lf ltrt: %lf\n",
+                   downmix_info->surround_mix_level,
+                   downmix_info->surround_mix_level_ltrt);
+            av_log(NULL, AV_LOG_FATAL, "LFE      mix level: %lf\n",
+                   downmix_info->lfe_mix_level);
+        }
+        dirty_counter = 1;
+    }
+
     /* if the decoder provides a pts, use it instead of the last packet pts.
        the decoder could be delaying output by a packet or more. */
     if (decoded_frame->pts != AV_NOPTS_VALUE)
-- 
1.8.3.4 (Apple Git-47)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to