[dvblast-devel] export some error messages to XML

Christophe Massiot git at videolan.org
Mon Oct 6 18:50:06 CEST 2014


dvblast | branch: master | Christophe Massiot <cmassiot at openheadend.tv> | Mon Oct  6 18:49:45 2014 +0200| [71736aae24aad273874f86fdf13a802532e6475d] | committer: Christophe Massiot

export some error messages to XML

> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=71736aae24aad273874f86fdf13a802532e6475d
---

 demux.c   |   22 +++++++++++++++++-----
 dvb.c     |   16 ++++++++++++++--
 en50221.c |   20 ++++++++++++++++----
 3 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/demux.c b/demux.c
index b786515..83e5336 100644
--- a/demux.c
+++ b/demux.c
@@ -455,8 +455,14 @@ static void demux_Handle( block_t *p_ts )
     if ( i_nb_errors > MAX_ERRORS )
     {
         i_nb_errors = 0;
-        msg_Warn( NULL,
-                 "too many transport errors, tuning again" );
+        switch (i_print_type) {
+        case PRINT_XML:
+            printf("<EVENT type=\"reset\" cause=\"transport\" />\n");
+            break;
+        default:
+            msg_Warn( NULL,
+                     "too many transport errors, tuning again" );
+        }
         pf_Reset();
     }
 
@@ -534,9 +540,15 @@ static void demux_Handle( block_t *p_ts )
                     for ( j = 0; j < i_nb_outputs; j++ )
                         pp_outputs[j]->i_nb_errors = 0;
 
-                    msg_Warn( NULL,
-                             "too many errors for stream %s, resetting",
-                             p_output->config.psz_displayname );
+                    switch (i_print_type) {
+                    case PRINT_XML:
+                        printf("<EVENT type=\"reset\" cause=\"scrambling\" />\n");
+                        break;
+                    default:
+                        msg_Warn( NULL,
+                                 "too many errors for stream %s, resetting",
+                                 p_output->config.psz_displayname );
+                    }
                     i_last_reset = i_wallclock;
                     en50221_Reset();
                 }
diff --git a/dvb.c b/dvb.c
index 6873da4..601bcfb 100644
--- a/dvb.c
+++ b/dvb.c
@@ -196,7 +196,13 @@ block_t *dvb_Read( mtime_t i_poll_timeout )
     else if ( !i_frontend_timeout
                 && i_wallclock > i_last_packet + DVR_READ_TIMEOUT )
     {
-        msg_Warn( NULL, "no DVR output, resetting" );
+        switch (i_print_type) {
+        case PRINT_XML:
+            printf("<EVENT type=\"reset\" cause=\"dvr\" />\n");
+            break;
+        default:
+            msg_Warn( NULL, "no DVR output, resetting" );
+        }
         if ( i_frequency )
             FrontendSet(false);
         en50221_Reset();
@@ -230,7 +236,13 @@ block_t *dvb_Read( mtime_t i_poll_timeout )
             }
             exit(EXIT_STATUS_FRONTEND_TIMEOUT);
         }
-        msg_Warn( NULL, "no lock, tuning again" );
+        switch (i_print_type) {
+        case PRINT_XML:
+            printf("<EVENT type=\"reset\" cause=\"nolock\" />\n");
+            break;
+        default:
+            msg_Warn( NULL, "no lock, tuning again" );
+        }
         if ( i_frequency )
             FrontendSet(false);
     }
diff --git a/en50221.c b/en50221.c
index ec15c40..db35910 100644
--- a/en50221.c
+++ b/en50221.c
@@ -2150,7 +2150,14 @@ void en50221_Poll( void )
                 InitSlot( NULL, i_slot );
             else if ( p_slot->i_init_timeout < i_wallclock )
             {
-                msg_Dbg( NULL, "en50221_Poll: resetting slot %d", i_slot );
+                switch (i_print_type) {
+                case PRINT_XML:
+                    printf("<EVENT type=\"reset\" cause=\"cam_mute\" />\n");
+                    break;
+                default:
+                    msg_Warn( NULL, "no answer from CAM, resetting slot %d",
+                              i_slot );
+                }
                 ResetSlot( i_slot );
                 continue;
             }
@@ -2175,9 +2182,14 @@ void en50221_Poll( void )
         {
             if ( TPDUSend( NULL, i_slot, T_DATA_LAST, NULL, 0 ) != 0 )
             {
-                msg_Err( NULL,
-                         "en50221_Poll: couldn't send TPDU on slot %d, resetting",
-                         i_slot );
+                switch (i_print_type) {
+                case PRINT_XML:
+                    printf("<EVENT type=\"reset\" cause=\"cam_error\" />\n");
+                    break;
+                default:
+                    msg_Warn( NULL, "couldn't send TPDU, resetting slot %d",
+                              i_slot );
+                }
                 ResetSlot( i_slot );
             }
         }



More information about the dvblast-devel mailing list