[vlc-commits] input: add input_item_SetEpgEvent

Francois Cartegnie git at videolan.org
Tue Dec 20 21:42:46 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 19 14:35:37 2016 +0100| [94f0635d2d15e4538144e96dfbd5b9ec22865daf] | committer: Francois Cartegnie

input: add input_item_SetEpgEvent

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

 src/input/input_interface.h |  1 +
 src/input/item.c            | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/src/input/input_interface.h b/src/input/input_interface.h
index 0ec778c..f271439 100644
--- a/src/input/input_interface.h
+++ b/src/input/input_interface.h
@@ -35,6 +35,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_SetEpgEvent( input_item_t *p_item, const vlc_epg_event_t *p_epg_evt );
 void input_item_SetEpgOffline( input_item_t * );
 
 /**
diff --git a/src/input/item.c b/src/input/item.c
index c5f4977..b4bab85 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -897,6 +897,41 @@ void input_item_MergeInfos( input_item_t *p_item, info_category_t *p_cat )
     vlc_event_send( &p_item->event_manager, &event );
 }
 
+void input_item_SetEpgEvent( input_item_t *p_item, const vlc_epg_event_t *p_epg_evt )
+{
+    bool b_changed = false;
+    vlc_mutex_lock( &p_item->lock );
+
+    for( int i = 0; i < p_item->i_epg; i++ )
+    {
+        vlc_epg_t *p_epg = p_item->pp_epg[i];
+        for( size_t j = 0; j < p_epg->i_event; j++ )
+        {
+            /* Same event can exist in more than one table */
+            if( p_epg->pp_event[j]->i_id == p_epg_evt->i_id )
+            {
+                vlc_epg_event_t *p_dup = vlc_epg_event_Duplicate( p_epg_evt );
+                if( p_dup )
+                {
+                    if( p_epg->p_current == p_epg->pp_event[j] )
+                        p_epg->p_current = p_dup;
+                    vlc_epg_event_Delete( p_epg->pp_event[j] );
+                    p_epg->pp_event[j] = p_dup;
+                    b_changed = true;
+                }
+                break;
+            }
+        }
+    }
+    vlc_mutex_unlock( &p_item->lock );
+
+    if ( b_changed )
+    {
+        vlc_event_t event = { .type = vlc_InputItemInfoChanged, };
+        vlc_event_send( &p_item->event_manager, &event );
+    }
+}
+
 #define EPG_DEBUG
 void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_update )
 {



More information about the vlc-commits mailing list