[vlc-devel] [PATCH 05/12] medialibrary: Rename playback_pref to playback_state

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Jul 31 11:20:34 CEST 2019


---
 include/vlc_media_library.h                   | 60 +++++++++----------
 .../gui/qt/components/mediacenter/mlvideo.cpp |  2 +-
 modules/misc/medialibrary/medialib.cpp        | 46 +++++++-------
 3 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index e6205f31ca..cdd15d26d3 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -453,8 +453,8 @@ enum vlc_ml_control
 
     /* Media management */
     VLC_ML_MEDIA_INCREASE_PLAY_COUNT,       /**< arg1: media id; can fail */
-    VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF,   /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: char**; */
-    VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF,   /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: const char*; */
+    VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE,  /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: char**; */
+    VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE,  /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: const char*; */
     VLC_ML_MEDIA_SET_THUMBNAIL,             /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
     VLC_ML_MEDIA_GENERATE_THUMBNAIL,        /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
     VLC_ML_MEDIA_ADD_EXTERNAL_MRL,          /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
@@ -465,32 +465,32 @@ enum vlc_ml_control
  * All values/units are up to the caller and are not interpreted by the media
  * library.
  * All values are stored and returned as strings.
- * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_PREF,
- * the value will be returned stored in the provided char**. If the preference was
+ * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_STATE,
+ * the value will be returned stored in the provided char**. If the state was
  * not set yet, NULL will be returned.
- * When setting a preference, NULL can be provided as a value to unset it.
+ * When setting a state, NULL can be provided as a value to unset it.
  */
-enum vlc_ml_playback_pref
-{
-    VLC_ML_PLAYBACK_PREF_RATING,
-    VLC_ML_PLAYBACK_PREF_PROGRESS,
-    VLC_ML_PLAYBACK_PREF_SPEED,
-    VLC_ML_PLAYBACK_PREF_TITLE,
-    VLC_ML_PLAYBACK_PREF_CHAPTER,
-    VLC_ML_PLAYBACK_PREF_PROGRAM,
-    VLC_ML_PLAYBACK_PREF_SEEN,
-    VLC_ML_PLAYBACK_PREF_VIDEO_TRACK,
-    VLC_ML_PLAYBACK_PREF_ASPECT_RATIO,
-    VLC_ML_PLAYBACK_PREF_ZOOM,
-    VLC_ML_PLAYBACK_PREF_CROP,
-    VLC_ML_PLAYBACK_PREF_DEINTERLACE,
-    VLC_ML_PLAYBACK_PREF_VIDEO_FILTER,
-    VLC_ML_PLAYBACK_PREF_AUDIO_TRACK,
-    VLC_ML_PLAYBACK_PREF_GAIN,
-    VLC_ML_PLAYBACK_PREF_AUDIO_DELAY,
-    VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK,
-    VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY,
-    VLC_ML_PLAYBACK_PREF_APP_SPECIFIC,
+enum vlc_ml_playback_state
+{
+    VLC_ML_PLAYBACK_STATE_RATING,
+    VLC_ML_PLAYBACK_STATE_PROGRESS,
+    VLC_ML_PLAYBACK_STATE_SPEED,
+    VLC_ML_PLAYBACK_STATE_TITLE,
+    VLC_ML_PLAYBACK_STATE_CHAPTER,
+    VLC_ML_PLAYBACK_STATE_PROGRAM,
+    VLC_ML_PLAYBACK_STATE_SEEN,
+    VLC_ML_PLAYBACK_STATE_VIDEO_TRACK,
+    VLC_ML_PLAYBACK_STATE_ASPECT_RATIO,
+    VLC_ML_PLAYBACK_STATE_ZOOM,
+    VLC_ML_PLAYBACK_STATE_CROP,
+    VLC_ML_PLAYBACK_STATE_DEINTERLACE,
+    VLC_ML_PLAYBACK_STATE_VIDEO_FILTER,
+    VLC_ML_PLAYBACK_STATE_AUDIO_TRACK,
+    VLC_ML_PLAYBACK_STATE_GAIN,
+    VLC_ML_PLAYBACK_STATE_AUDIO_DELAY,
+    VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK,
+    VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY,
+    VLC_ML_PLAYBACK_STATE_APP_SPECIFIC,
 };
 
 enum vlc_ml_event_type
@@ -870,14 +870,14 @@ static inline int vlc_ml_media_increase_playcount( vlc_medialibrary_t* p_ml, int
     return vlc_ml_control( p_ml, VLC_ML_MEDIA_INCREASE_PLAY_COUNT, i_media_id );
 }
 
-static inline int vlc_ml_media_get_playback_pref( vlc_medialibrary_t* p_ml, int64_t i_media_id, int i_pref, char** ppsz_result )
+static inline int vlc_ml_media_get_playback_state( vlc_medialibrary_t* p_ml, int64_t i_media_id, int i_state, char** ppsz_result )
 {
-    return vlc_ml_control( p_ml, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF, i_media_id, i_pref, ppsz_result );
+    return vlc_ml_control( p_ml, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE, i_media_id, i_state, ppsz_result );
 }
 
-static inline int vlc_ml_media_set_playback_pref( vlc_medialibrary_t* p_ml, int64_t i_media_id, int i_pref, const char* psz_value )
+static inline int vlc_ml_media_set_playback_state( vlc_medialibrary_t* p_ml, int64_t i_media_id, int i_state, const char* psz_value )
 {
-    return vlc_ml_control( p_ml, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF, i_media_id, i_pref, psz_value );
+    return vlc_ml_control( p_ml, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE, i_media_id, i_state, psz_value );
 }
 
 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t* p_ml, int64_t i_media_id,
diff --git a/modules/gui/qt/components/mediacenter/mlvideo.cpp b/modules/gui/qt/components/mediacenter/mlvideo.cpp
index 4305327be0..10de9fd931 100644
--- a/modules/gui/qt/components/mediacenter/mlvideo.cpp
+++ b/modules/gui/qt/components/mediacenter/mlvideo.cpp
@@ -59,7 +59,7 @@ MLVideo::MLVideo(vlc_medialibrary_t* ml, const vlc_ml_media_t* data, QObject* pa
             break;
         }
     char *psz_progress;
-    if ( vlc_ml_media_get_playback_pref( ml, data->i_id, VLC_ML_PLAYBACK_PREF_PROGRESS,
+    if ( vlc_ml_media_get_playback_state( ml, data->i_id, VLC_ML_PLAYBACK_STATE_PROGRESS,
                                     &psz_progress ) == VLC_SUCCESS && psz_progress != NULL )
     {
         m_progress = atoi( psz_progress );
diff --git a/modules/misc/medialibrary/medialib.cpp b/modules/misc/medialibrary/medialib.cpp
index e4bc4da85f..3cc33ae2ba 100644
--- a/modules/misc/medialibrary/medialib.cpp
+++ b/modules/misc/medialibrary/medialib.cpp
@@ -481,8 +481,8 @@ int MediaLibrary::Control( int query, va_list args )
             return VLC_SUCCESS;
         }
         case VLC_ML_MEDIA_INCREASE_PLAY_COUNT:
-        case VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF:
-        case VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF:
+        case VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE:
+        case VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE:
         case VLC_ML_MEDIA_SET_THUMBNAIL:
         case VLC_ML_MEDIA_GENERATE_THUMBNAIL:
         case VLC_ML_MEDIA_ADD_EXTERNAL_MRL:
@@ -856,43 +856,43 @@ medialibrary::IMedia::MetadataType MediaLibrary::metadataType( int meta )
 {
     switch ( meta )
     {
-        case VLC_ML_PLAYBACK_PREF_RATING:
+        case VLC_ML_PLAYBACK_STATE_RATING:
             return medialibrary::IMedia::MetadataType::Rating;
-        case VLC_ML_PLAYBACK_PREF_PROGRESS:
+        case VLC_ML_PLAYBACK_STATE_PROGRESS:
             return medialibrary::IMedia::MetadataType::Progress;
-        case VLC_ML_PLAYBACK_PREF_SPEED:
+        case VLC_ML_PLAYBACK_STATE_SPEED:
             return medialibrary::IMedia::MetadataType::Speed;
-        case VLC_ML_PLAYBACK_PREF_TITLE:
+        case VLC_ML_PLAYBACK_STATE_TITLE:
             return medialibrary::IMedia::MetadataType::Title;
-        case VLC_ML_PLAYBACK_PREF_CHAPTER:
+        case VLC_ML_PLAYBACK_STATE_CHAPTER:
             return medialibrary::IMedia::MetadataType::Chapter;
-        case VLC_ML_PLAYBACK_PREF_PROGRAM:
+        case VLC_ML_PLAYBACK_STATE_PROGRAM:
             return medialibrary::IMedia::MetadataType::Program;
-        case VLC_ML_PLAYBACK_PREF_SEEN:
+        case VLC_ML_PLAYBACK_STATE_SEEN:
             return medialibrary::IMedia::MetadataType::Seen;
-        case VLC_ML_PLAYBACK_PREF_VIDEO_TRACK:
+        case VLC_ML_PLAYBACK_STATE_VIDEO_TRACK:
             return medialibrary::IMedia::MetadataType::VideoTrack;
-        case VLC_ML_PLAYBACK_PREF_ASPECT_RATIO:
+        case VLC_ML_PLAYBACK_STATE_ASPECT_RATIO:
             return medialibrary::IMedia::MetadataType::AspectRatio;
-        case VLC_ML_PLAYBACK_PREF_ZOOM:
+        case VLC_ML_PLAYBACK_STATE_ZOOM:
             return medialibrary::IMedia::MetadataType::Zoom;
-        case VLC_ML_PLAYBACK_PREF_CROP:
+        case VLC_ML_PLAYBACK_STATE_CROP:
             return medialibrary::IMedia::MetadataType::Crop;
-        case VLC_ML_PLAYBACK_PREF_DEINTERLACE:
+        case VLC_ML_PLAYBACK_STATE_DEINTERLACE:
             return medialibrary::IMedia::MetadataType::Deinterlace;
-        case VLC_ML_PLAYBACK_PREF_VIDEO_FILTER:
+        case VLC_ML_PLAYBACK_STATE_VIDEO_FILTER:
             return medialibrary::IMedia::MetadataType::VideoFilter;
-        case VLC_ML_PLAYBACK_PREF_AUDIO_TRACK:
+        case VLC_ML_PLAYBACK_STATE_AUDIO_TRACK:
             return medialibrary::IMedia::MetadataType::AudioTrack;
-        case VLC_ML_PLAYBACK_PREF_GAIN:
+        case VLC_ML_PLAYBACK_STATE_GAIN:
             return medialibrary::IMedia::MetadataType::Gain;
-        case VLC_ML_PLAYBACK_PREF_AUDIO_DELAY:
+        case VLC_ML_PLAYBACK_STATE_AUDIO_DELAY:
             return medialibrary::IMedia::MetadataType::AudioDelay;
-        case VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK:
+        case VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK:
             return medialibrary::IMedia::MetadataType::SubtitleTrack;
-        case VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY:
+        case VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY:
             return medialibrary::IMedia::MetadataType::SubtitleDelay;
-        case VLC_ML_PLAYBACK_PREF_APP_SPECIFIC:
+        case VLC_ML_PLAYBACK_STATE_APP_SPECIFIC:
             return medialibrary::IMedia::MetadataType::ApplicationSpecific;
         default:
             vlc_assert_unreachable();
@@ -970,13 +970,13 @@ int MediaLibrary::controlMedia( int query, va_list args )
             if ( m->increasePlayCount() == false )
                 return VLC_EGENERIC;
             return VLC_SUCCESS;
-        case VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF:
+        case VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE:
         {
             auto meta = va_arg( args, int );
             auto res = va_arg( args, char** );
             return getMeta( *m, meta, res );
         }
-        case VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF:
+        case VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE:
         {
             auto meta = va_arg( args, int );
             auto value = va_arg( args, const char* );
-- 
2.20.1



More information about the vlc-devel mailing list