Commit 1dd0c0eb authored by massiot's avatar massiot

* ALL: Add status messages where appropriate.


git-svn-id: svn://svn.videolan.org/dvblast/trunk@174 55d3f8b6-4a41-4d2d-a900-313d1436a5b8
parent 653c23ea
......@@ -38,6 +38,8 @@
#include <arpa/inet.h>
#include <errno.h>
#include <bitstream/common.h>
#include "asi.h"
#include "dvblast.h"
......@@ -56,10 +58,12 @@
#define ASI_DEVICE "/dev/asirx%u"
#define ASI_TIMESTAMPS_FILE "/sys/class/asi/asirx%u/timestamps"
#define ASI_BUFSIZE_FILE "/sys/class/asi/asirx%u/bufsize"
#define ASI_LOCK_TIMEOUT 5000000 /* 5 s */
static int i_handle;
static int i_bufsize;
static uint8_t p_pid_filter[8192 / 8];
static mtime_t i_last_packet = 0;
/*****************************************************************************
* Local helpers
......@@ -217,6 +221,18 @@ block_t *asi_Read( mtime_t i_poll_timeout )
block_t *p_ts, **pp_current = &p_ts;
int i, i_len;
if ( !i_last_packet )
{
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
break;
default:
printf("frontend has acquired lock\n" );
}
}
i_last_packet = i_wallclock;
for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
{
*pp_current = block_New();
......@@ -247,6 +263,18 @@ block_t *asi_Read( mtime_t i_poll_timeout )
return p_ts;
}
else if ( i_last_packet && i_last_packet + ASI_LOCK_TIMEOUT < i_wallclock )
{
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"0\"/>\n");
break;
default:
printf("frontend has lost lock\n" );
}
i_last_packet = 0;
}
return NULL;
}
......
......@@ -368,7 +368,7 @@ static void FrontendPoll( void )
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
break;
default:
printf("frontend has acquired lock" );
printf("frontend has acquired lock\n" );
}
i_frontend_timeout = 0;
i_last_packet = i_wallclock;
......@@ -392,7 +392,7 @@ static void FrontendPoll( void )
printf("<STATUS type=\"lock\" status=\"0\"/>\n");
break;
default:
printf("frontend has lost lock" );
printf("frontend has lost lock\n" );
}
i_frontend_timeout = i_wallclock + i_frontend_timeout_duration;
}
......
......@@ -38,6 +38,7 @@
#include <arpa/inet.h>
#include <errno.h>
#include <bitstream/common.h>
#include <bitstream/ietf/rtp.h>
#include "dvblast.h"
......@@ -45,11 +46,14 @@
/*****************************************************************************
* Local declarations
*****************************************************************************/
#define UDP_LOCK_TIMEOUT 5000000 /* 5 s */
static int i_handle;
static bool b_udp = false;
static int i_block_cnt;
static uint8_t pi_ssrc[4] = { 0, 0, 0, 0 };
static uint16_t i_cc = 0;
static mtime_t i_last_packet = 0;
/*****************************************************************************
* udp_Open
......@@ -263,6 +267,18 @@ block_t *udp_Read( mtime_t i_poll_timeout )
ssize_t i_len;
uint8_t p_rtp_hdr[RTP_HEADER_SIZE];
if ( !i_last_packet )
{
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
break;
default:
printf("frontend has acquired lock\n" );
}
}
i_last_packet = i_wallclock;
if ( !b_udp )
{
/* FIXME : this is wrong if RTP header > 12 bytes */
......@@ -289,8 +305,6 @@ block_t *udp_Read( mtime_t i_poll_timeout )
goto err;
}
int meuh = i_len;
if ( !b_udp )
{
uint8_t pi_new_ssrc[4];
......@@ -311,6 +325,14 @@ int meuh = i_len;
memcpy( &addr.s_addr, pi_new_ssrc, 4 * sizeof(uint8_t) );
msg_Dbg( NULL, "new RTP source: %s", inet_ntoa( addr ) );
memcpy( pi_ssrc, pi_new_ssrc, 4 * sizeof(uint8_t) );
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"source\" source=\"%s\"/>\n",
inet_ntoa( addr ));
break;
default:
printf("new RTP source: %s\n", inet_ntoa( addr ) );
}
}
i_cc = rtp_get_cc(p_rtp_hdr) + 1;
......@@ -326,15 +348,23 @@ int meuh = i_len;
}
i_wallclock = mdate();
if ( *pp_current )
msg_Dbg( NULL, "partial buffer received %d", meuh );
err:
block_DeleteChain( *pp_current );
*pp_current = NULL;
return p_ts;
}
else if ( i_last_packet && i_last_packet + UDP_LOCK_TIMEOUT < i_wallclock )
{
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"0\"/>\n");
break;
default:
printf("frontend has lost lock\n" );
}
i_last_packet = 0;
}
return NULL;
}
......
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