[vlc-devel] commit: Fixed offline EPG state. (Laurent Aimar )

git version control git at videolan.org
Tue Sep 22 22:59:45 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep 22 22:29:41 2009 +0200| [4afebbfaaf219ea1769c09a1b66da5775bdb8c3d] | committer: Laurent Aimar 

Fixed offline EPG state.

The info panel is flushed and the current epg event is undefined when
stopping the associated input.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4afebbfaaf219ea1769c09a1b66da5775bdb8c3d
---

 src/input/es_out.c          |    3 +++
 src/input/input_interface.h |    1 +
 src/input/item.c            |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index e647aa1..f944502 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -371,6 +371,9 @@ static void EsOutDelete( es_out_t *out )
         free( p_pgrm );
     }
     TAB_CLEAN( p_sys->i_pgrm, p_sys->pgrm );
+
+    input_item_SetEpgOffline( p_sys->p_input->p->p_item );
+
     vlc_mutex_destroy( &p_sys->lock );
 
     free( p_sys );
diff --git a/src/input/input_interface.h b/src/input/input_interface.h
index 9c3183b..7f7347d 100644
--- a/src/input/input_interface.h
+++ b/src/input/input_interface.h
@@ -38,6 +38,7 @@ 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_SetEpgOffline( input_item_t * );
 
 int input_Preparse( vlc_object_t *, input_item_t * );
 
diff --git a/src/input/item.c b/src/input/item.c
index d3030b7..c11cd65 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -790,6 +790,39 @@ signal:
     }
 }
 
+void input_item_SetEpgOffline( input_item_t *p_item )
+{
+    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 );
+    vlc_mutex_unlock( &p_item->lock );
+
+#ifdef EPG_DEBUG
+    vlc_mutex_lock( &p_item->lock );
+    const int i_epg_info = p_item->i_epg;
+    char *ppsz_epg_info[i_epg_info];
+    for( int i = 0; i < p_item->i_epg; i++ )
+    {
+        const vlc_epg_t *p_epg = p_item->pp_epg[i];
+        if( asprintf( &ppsz_epg_info[i], "EPG %s", p_epg->psz_name ? p_epg->psz_name : "unknown" ) < 0 )
+            ppsz_epg_info[i] = NULL;
+    }
+    vlc_mutex_unlock( &p_item->lock );
+
+    for( int i = 0; i < i_epg_info; i++ )
+    {
+        if( !ppsz_epg_info[i] )
+            continue;
+        input_item_DelInfo( p_item, ppsz_epg_info[i], NULL );
+        free( ppsz_epg_info[i] );
+    }
+#endif
+
+    vlc_event_t event = { .type = vlc_InputItemInfoChanged, };
+    vlc_event_send( &p_item->event_manager, &event );
+}
+
+
 input_item_t *__input_item_NewExt( vlc_object_t *p_obj, const char *psz_uri,
                                   const char *psz_name,
                                   int i_options,




More information about the vlc-devel mailing list