Commit e25885c1 authored by François Cartegnie's avatar François Cartegnie 🤞

input: item: point to store current epg table

parent 846fb7c2
......@@ -81,6 +81,7 @@ struct input_item_t
int i_epg; /**< Number of EPG entries */
vlc_epg_t **pp_epg; /**< EPG entries */
const vlc_epg_t *p_epg_table; /** running/selected program cur/next EPG table */
int i_slaves; /**< Number of slaves */
input_item_slave_t **pp_slaves; /**< Slave entries that will be loaded by
......
......@@ -1054,6 +1054,9 @@ static void EsOutProgramSelect( es_out_t *out, es_out_pgrm_t *p_pgrm )
EsOutSelect( out, p_sys->es[i], false );
}
/* Ensure the correct running EPG table is selected */
input_item_ChangeEPGSource( input_priv(p_input)->p_item, p_pgrm->i_id );
/* Update now playing */
input_item_SetESNowPlaying( input_priv(p_input)->p_item,
p_pgrm->p_meta ? vlc_meta_Get( p_pgrm->p_meta, vlc_meta_ESNowPlaying ) : NULL );
......@@ -1359,7 +1362,7 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, const vlc_epg_t *p_epg
epg = *p_epg;
epg.psz_name = psz_cat;
input_item_SetEpg( p_item, &epg );
input_item_SetEpg( p_item, &epg, p_epg->i_source_id == p_pgrm->i_id );
input_SendEventMetaEpg( p_sys->p_input );
/* Update now playing */
......
......@@ -34,7 +34,8 @@ void input_item_SignalPreparseEnded( input_item_t *p_i, int new_status );
void input_item_SetPreparsed( input_item_t *p_i, bool b_preparsed );
void input_item_SetArtNotFound( input_item_t *p_i, bool b_not_found );
void input_item_SetArtFetched( input_item_t *p_i, bool b_art_fetched );
void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_epg );
void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_epg, bool );
void input_item_ChangeEPGSource( input_item_t *p_item, int i_source_id );
void input_item_SetEpgEvent( input_item_t *p_item, const vlc_epg_event_t *p_epg_evt );
void input_item_SetEpgOffline( input_item_t * );
......
......@@ -933,7 +933,7 @@ void input_item_SetEpgEvent( input_item_t *p_item, const vlc_epg_event_t *p_epg_
}
//#define EPG_DEBUG
void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_update )
void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_update, bool b_current_source )
{
vlc_epg_t *p_epg = vlc_epg_Duplicate( p_update );
if( !p_epg )
......@@ -957,6 +957,8 @@ void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_update )
if( pp_epg )
{
vlc_epg_Delete( *pp_epg );
if( *pp_epg == p_item->p_epg_table ) /* current table can have changed */
p_item->p_epg_table = NULL;
*pp_epg = p_epg;
}
else
......@@ -964,6 +966,9 @@ void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_update )
TAB_APPEND( p_item->i_epg, p_item->pp_epg, p_epg );
}
if( b_current_source && p_epg->b_present )
p_item->p_epg_table = p_epg;
vlc_mutex_unlock( &p_item->lock );
if( !p_epg )
......@@ -1010,12 +1015,29 @@ signal:
} while(0);
}
void input_item_SetEpgOffline( input_item_t *p_item )
void input_item_ChangeEPGSource( input_item_t *p_item, int i_source_id )
{
vlc_mutex_lock( &p_item->lock );
for( int i = 0; i < p_item->i_epg; i++ )
vlc_epg_SetCurrent( p_item->pp_epg[i], -1 );
p_item->p_epg_table = NULL;
if( i_source_id > 0 )
{
/* Update pointer to current/next table in the full schedule */
for( int i = 0; i < p_item->i_epg; i++ )
{
if( p_item->pp_epg[i]->i_source_id == i_source_id &&
p_item->pp_epg[i]->b_present )
{
p_item->p_epg_table = p_item->pp_epg[i];
break;
}
}
}
vlc_mutex_unlock( &p_item->lock );
}
void input_item_SetEpgOffline( input_item_t *p_item )
{
input_item_ChangeEPGSource( p_item, -1 );
#ifdef EPG_DEBUG
vlc_mutex_lock( &p_item->lock );
......
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