[vlc-commits] input:item: store the item type with the enum
Steve Lhomme
git at videolan.org
Thu Jul 26 10:00:37 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jul 26 08:33:14 2018 +0200| [b4fd2a7ebf21b7cedbcca6d39d0def7606016dea] | committer: Steve Lhomme
input:item: store the item type with the enum
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b4fd2a7ebf21b7cedbcca6d39d0def7606016dea
---
include/vlc_input_item.h | 34 +++++++++++-----------
lib/media.c | 2 +-
modules/gui/qt/components/epg/EPGWidget.hpp | 3 +-
.../gui/qt/components/playlist/playlist_model.cpp | 2 +-
src/input/item.c | 2 +-
src/input/meta.c | 2 +-
src/preparser/preparser.c | 2 +-
7 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 82ad4e4733..ae55453499 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -55,6 +55,21 @@ struct info_category_t
struct vlc_list infos; /**< Infos in the category */
};
+enum input_item_type_e
+{
+ ITEM_TYPE_UNKNOWN,
+ ITEM_TYPE_FILE,
+ ITEM_TYPE_DIRECTORY,
+ ITEM_TYPE_DISC,
+ ITEM_TYPE_CARD,
+ ITEM_TYPE_STREAM,
+ ITEM_TYPE_PLAYLIST,
+ ITEM_TYPE_NODE,
+
+ /* This one is not a real type but the number of input_item types. */
+ ITEM_TYPE_NUMBER
+};
+
/**
* Describes an input and is used to spawn input_thread_t objects.
*/
@@ -95,7 +110,7 @@ struct input_item_t
vlc_mutex_t lock; /**< Lock for the item */
- uint8_t i_type; /**< Type (file, disc, ... see input_item_type_e) */
+ enum input_item_type_e i_type; /**< Type (file, disc, ... see input_item_type_e) */
bool b_net; /**< Net: always true for TYPE_STREAM, it
depends for others types */
bool b_error_when_reading;/**< Error When Reading */
@@ -111,21 +126,6 @@ struct input_item_t
#define INPUT_DURATION_ZERO 0
#define INPUT_DURATION_UNKNOWN (-1)
-enum input_item_type_e
-{
- ITEM_TYPE_UNKNOWN,
- ITEM_TYPE_FILE,
- ITEM_TYPE_DIRECTORY,
- ITEM_TYPE_DISC,
- ITEM_TYPE_CARD,
- ITEM_TYPE_STREAM,
- ITEM_TYPE_PLAYLIST,
- ITEM_TYPE_NODE,
-
- /* This one is not a real type but the number of input_item types. */
- ITEM_TYPE_NUMBER
-};
-
enum input_item_net_type
{
ITEM_NET_UNKNOWN,
@@ -335,7 +335,7 @@ VLC_API void input_item_MergeInfos( input_item_t *, info_category_t * );
*/
VLC_API input_item_t * input_item_NewExt( const char *psz_uri,
const char *psz_name,
- vlc_tick_t i_duration, int i_type,
+ vlc_tick_t i_duration, enum input_item_type_e i_type,
enum input_item_net_type i_net ) VLC_USED;
#define input_item_New( psz_uri, psz_name ) \
diff --git a/lib/media.c b/lib/media.c
index 7fc44d5c65..0b121d06b3 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -1070,7 +1070,7 @@ libvlc_media_type_t libvlc_media_get_type( libvlc_media_t *p_md )
{
assert( p_md );
- int i_type;
+ enum input_item_type_e i_type;
input_item_t *p_input_item = p_md->p_input_item;
vlc_mutex_lock( &p_input_item->lock );
diff --git a/modules/gui/qt/components/epg/EPGWidget.hpp b/modules/gui/qt/components/epg/EPGWidget.hpp
index ba5f497a0c..ff89c77515 100644
--- a/modules/gui/qt/components/epg/EPGWidget.hpp
+++ b/modules/gui/qt/components/epg/EPGWidget.hpp
@@ -27,6 +27,7 @@
#include "qt.hpp"
#include <vlc_epg.h>
+#include <vlc_input_item.h>
#include <QWidget>
#include <QStackedWidget>
@@ -59,7 +60,7 @@ private:
EPGChannels *m_channelsWidget;
QStackedWidget *rootWidget;
- uint8_t i_event_source_type;
+ enum input_item_type_e i_event_source_type;
bool b_input_type_known;
signals:
diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index 9003acd505..41e9d53131 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -347,7 +347,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
{
PLItem *item = getItem( index );
/* Used to segfault here because i_type wasn't always initialized */
- int idx = item->inputItem()->i_type;
+ enum input_item_type_e idx = item->inputItem()->i_type;
if( item->inputItem()->b_net && item->inputItem()->i_type == ITEM_TYPE_FILE )
idx = ITEM_TYPE_STREAM;
return QVariant( icons[idx] );
diff --git a/src/input/item.c b/src/input/item.c
index 9952aa597d..5d8c023ee9 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1054,7 +1054,7 @@ void input_item_SetEpgOffline( input_item_t *p_item )
input_item_t *
input_item_NewExt( const char *psz_uri, const char *psz_name,
- vlc_tick_t duration, int type, enum input_item_net_type i_net )
+ vlc_tick_t duration, enum input_item_type_e type, enum input_item_net_type i_net )
{
input_item_owner_t *owner = calloc( 1, sizeof( *owner ) );
if( unlikely(owner == NULL) )
diff --git a/src/input/meta.c b/src/input/meta.c
index e9c8bab798..b02cb25d6a 100644
--- a/src/input/meta.c
+++ b/src/input/meta.c
@@ -247,7 +247,7 @@ int input_item_WriteMeta( vlc_object_t *obj, input_item_t *p_item )
return VLC_ENOMEM;
p_export->p_item = p_item;
- int type;
+ enum input_item_type_e type;
vlc_mutex_lock( &p_item->lock );
type = p_item->i_type;
vlc_mutex_unlock( &p_item->lock );
diff --git a/src/preparser/preparser.c b/src/preparser/preparser.c
index f58a474623..fc055e03d8 100644
--- a/src/preparser/preparser.c
+++ b/src/preparser/preparser.c
@@ -170,7 +170,7 @@ void input_preparser_Push( input_preparser_t *preparser,
return;
vlc_mutex_lock( &item->lock );
- int i_type = item->i_type;
+ enum input_item_type_e i_type = item->i_type;
int b_net = item->b_net;
vlc_mutex_unlock( &item->lock );
More information about the vlc-commits
mailing list