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

Use bool instead of int

parent b79a1963
......@@ -124,12 +124,10 @@ public:
* held upon entering this function.
*
* \param p_md a media instance
*
* \return 0 on success, -1 if the media list is read-only
*/
int addMedia(Media& md)
bool addMedia(Media& md)
{
return libvlc_media_list_add_media( *this, getInternalPtr<libvlc_media_t>( md ) );
return libvlc_media_list_add_media( *this, getInternalPtr<libvlc_media_t>( md ) ) == 0;
}
/**
......@@ -139,12 +137,10 @@ public:
* \param p_md a media instance
*
* \param i_pos position in array where to insert
*
* \return 0 on success, -1 if the media list is read-only
*/
int insertMedia(Media& md, int pos)
bool insertMedia(Media& md, int pos)
{
return libvlc_media_list_insert_media( *this, getInternalPtr<libvlc_media_t>( md ), pos );
return libvlc_media_list_insert_media( *this, getInternalPtr<libvlc_media_t>( md ), pos ) == 0;
}
/**
......@@ -152,13 +148,10 @@ public:
* libvlc_media_list_lock should be held upon entering this function.
*
* \param i_pos position in array where to insert
*
* \return 0 on success, -1 if the list is read-only or the item was not
* found
*/
int removeIndex(int i_pos)
bool removeIndex(int i_pos)
{
return libvlc_media_list_remove_index(*this,i_pos);
return libvlc_media_list_remove_index( *this, i_pos ) == 0;
}
/**
......@@ -210,7 +203,7 @@ public:
*/
bool isReadonly()
{
return libvlc_media_list_is_readonly(*this) != 0;
return libvlc_media_list_is_readonly(*this) == 1;
}
/**
......
......@@ -144,25 +144,21 @@ public:
* Play media list item at position index
*
* \param i_index index in media list to play
*
* \return 0 upon success -1 if the item wasn't found
*/
int playItemAtIndex(int i_index)
bool playItemAtIndex(int i_index)
{
return libvlc_media_list_player_play_item_at_index(*this, i_index);
return libvlc_media_list_player_play_item_at_index(*this, i_index) == 0;
}
/**
* Play the given media item
*
* \param p_md the media instance
*
* \return 0 upon success, -1 if the media is not part of the media list
*/
int playItem(const Media& md)
bool playItem(const Media& md)
{
return libvlc_media_list_player_play_item( *this,
getInternalPtr<libvlc_media_t>( md ) );
getInternalPtr<libvlc_media_t>( md ) ) == 0;
}
/**
......@@ -175,22 +171,18 @@ public:
/**
* Play next item from media list
*
* \return 0 upon success -1 if there is no next item
*/
int next()
bool next()
{
return libvlc_media_list_player_next(*this);
return libvlc_media_list_player_next(*this) == 0;
}
/**
* Play previous item from media list
*
* \return 0 upon success -1 if there is no previous item
*/
int previous()
bool previous()
{
return libvlc_media_list_player_previous(*this);
return libvlc_media_list_player_previous(*this) == 0;
}
/**
......
......@@ -880,13 +880,10 @@ public:
/**
* Get current mute status.
*
* \return the mute status (boolean) if defined, -1 if
* undefined/unapplicable
*/
int mute()
bool mute()
{
return libvlc_audio_get_mute(*this);
return libvlc_audio_get_mute( *this ) == 1;
}
/**
......@@ -923,12 +920,10 @@ public:
* Set current software audio volume.
*
* \param i_volume the volume in percents (0 = mute, 100 = 0dB)
*
* \return 0 if the volume was set, -1 if it was out of range
*/
int setVolume(int i_volume)
bool setVolume(int i_volume)
{
return libvlc_audio_set_volume(*this, i_volume);
return libvlc_audio_set_volume(*this, i_volume) == 0;
}
/**
......@@ -967,12 +962,10 @@ public:
* Set current audio track.
*
* \param i_track the track ID (i_id field from track description)
*
* \return 0 on success, -1 on error
*/
int setAudioTrack(int i_track)
bool setAudioTrack(int i_track)
{
return libvlc_audio_set_track(*this, i_track);
return libvlc_audio_set_track(*this, i_track) == 0;
}
/**
......@@ -993,12 +986,10 @@ public:
* \param channel the audio channel,
*
* \see libvlc_audio_output_channel_t
*
* \return 0 on success, -1 on error
*/
int setChannel(int channel)
bool setChannel(int channel)
{
return libvlc_audio_set_channel(*this, channel);
return libvlc_audio_set_channel(*this, channel) == 0;
}
/**
......
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