Commit 00fe8c52 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Provide a binding for libvlc_audio_output_device_t

parent 124bef84
......@@ -145,9 +145,16 @@ std::vector<AudioOutputDescription> Instance::audioOutputList()
return res;
}
libvlc_audio_output_device_t * Instance::audioOutputDeviceList(const std::string& aout)
std::vector<AudioOutputDeviceDescription> Instance::audioOutputDeviceList(const std::string& aout)
{
return libvlc_audio_output_device_list_get(m_obj, aout.c_str());
libvlc_audio_output_device_t* devices = libvlc_audio_output_device_list_get( m_obj, aout.c_str() );
std::vector<AudioOutputDeviceDescription> res;
if ( devices == NULL )
return res;
for ( libvlc_audio_output_device_t* p = devices; p != NULL; p = p->p_next )
res.push_back( AudioOutputDeviceDescription( p ) );
libvlc_audio_output_device_list_release( devices );
return res;
}
Instance::Instance(Internal::InternalPtr ptr)
......
......@@ -238,7 +238,7 @@ public:
*
* \version LibVLC 2.1.0 or later.
*/
libvlc_audio_output_device_t * audioOutputDeviceList(const std::string& aout);
std::vector<AudioOutputDeviceDescription> audioOutputDeviceList(const std::string& aout);
private:
Instance(InternalPtr ptr);
......
......@@ -331,9 +331,16 @@ int MediaPlayer::outputSet(const std::string& psz_name)
return libvlc_audio_output_set(m_obj, psz_name.c_str());
}
libvlc_audio_output_device_t * MediaPlayer::outputDeviceEnum()
{
return libvlc_audio_output_device_enum(m_obj);
std::vector<AudioOutputDeviceDescription> MediaPlayer::outputDeviceEnum()
{
libvlc_audio_output_device_t* devices = libvlc_audio_output_device_enum(m_obj);
std::vector<AudioOutputDeviceDescription> res;
if ( devices == NULL )
return res;
for ( libvlc_audio_output_device_t* p = devices; p != NULL; p = p->p_next )
res.push_back( AudioOutputDeviceDescription( p ) );
libvlc_audio_output_device_list_release( devices );
return res;
}
void MediaPlayer::outputDeviceSet(const std::string& module, const std::string& device_id)
......
......@@ -588,7 +588,7 @@ public:
*
* \version LibVLC 2.2.0 or later.
*/
libvlc_audio_output_device_t * outputDeviceEnum();
std::vector<AudioOutputDeviceDescription> outputDeviceEnum();
/**
* Configures an explicit audio output device.
......
......@@ -203,4 +203,22 @@ TrackDescription::TrackDescription( libvlc_track_description_t* c )
m_name = c->psz_name;
}
const std::string&AudioOutputDeviceDescription::device() const
{
return m_device;
}
const std::string&AudioOutputDeviceDescription::description() const
{
return m_description;
}
AudioOutputDeviceDescription::AudioOutputDeviceDescription( libvlc_audio_output_device_t* d )
{
if ( d->psz_device != NULL )
m_device = d->psz_device;
if ( d->psz_description != NULL )
m_device = d->psz_description;
}
} // namespace VLC
......@@ -121,6 +121,23 @@ private:
friend class Instance;
};
class AudioOutputDeviceDescription
{
public:
/**< Device identifier string */
const std::string& device() const;
/**< User-friendly device description */
const std::string& description() const;
private:
AudioOutputDeviceDescription( libvlc_audio_output_device_t* d );
std::string m_device;
std::string m_description;
friend class Instance;
friend class MediaPlayer;
};
class TrackDescription
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment