Commit b4fd2a7e authored by Steve Lhomme's avatar Steve Lhomme
Browse files

input:item: store the item type with the enum

parent d65cdf19
......@@ -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 ) \
......
......@@ -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 );
......
......@@ -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:
......
......@@ -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] );
......
......@@ -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) )
......
......@@ -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 );
......
......@@ -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 );
......
Supports Markdown
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