[vlc-commits] sout: sdi: check maximum channels

Francois Cartegnie git at videolan.org
Mon Oct 8 18:35:09 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct  8 18:30:17 2018 +0200| [27891ce8bee764593758e8e2db7421e2ed3e5ba1] | committer: Francois Cartegnie

sout: sdi: check maximum channels

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=27891ce8bee764593758e8e2db7421e2ed3e5ba1
---

 modules/stream_out/sdi/DBMSDIOutput.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/modules/stream_out/sdi/DBMSDIOutput.cpp b/modules/stream_out/sdi/DBMSDIOutput.cpp
index a513e13798..a95762d774 100644
--- a/modules/stream_out/sdi/DBMSDIOutput.cpp
+++ b/modules/stream_out/sdi/DBMSDIOutput.cpp
@@ -272,6 +272,7 @@ error:
 int DBMSDIOutput::ConfigureAudio(const audio_format_t *)
 {
     HRESULT result;
+    IDeckLinkAttributes *p_attributes = NULL;
 
     if(FAKE_DRIVER)
         return VLC_SUCCESS;
@@ -285,6 +286,20 @@ int DBMSDIOutput::ConfigureAudio(const audio_format_t *)
     if (audio.i_channels > 0)
     {
         uint8_t maxchannels = audioMultiplex->config.getMultiplexedFramesCount() * 2;
+
+        result = p_card->QueryInterface(IID_IDeckLinkAttributes, (void**)&p_attributes);
+        CHECK("Could not get IDeckLinkAttributes");
+
+        int64_t i64;
+        result = p_attributes->GetInt(BMDDeckLinkMaximumAudioChannels, &i64);
+        CHECK("Could not get BMDDeckLinkMaximumAudioChannels");
+        if(i64 < maxchannels)
+        {
+            msg_Err(p_stream, "requested channels %" PRIu8 " exceeds supported maximum: %" PRId64,
+                    maxchannels, i64);
+            goto error;
+        }
+
         msg_Dbg(p_stream, "configuring audio output with %d", maxchannels);
         result = p_output->EnableAudioOutput(
                     bmdAudioSampleRate48kHz,
@@ -293,10 +308,14 @@ int DBMSDIOutput::ConfigureAudio(const audio_format_t *)
                     bmdAudioOutputStreamTimestamped);
         CHECK("Could not start audio output");
         audio.b_configured = true;
+
+        p_attributes->Release();
     }
     return VLC_SUCCESS;
 
 error:
+    if(p_attributes)
+        p_attributes->Release();
     return VLC_EGENERIC;
 }
 



More information about the vlc-commits mailing list