[SCM] Mumudvb packaging branch, upstream, updated. 24c2efb080b56abb8e7be67bae30ba7fe457759e

Brice DUBOST braice at braice.net
Sat Nov 1 13:31:03 UTC 2008


The following commit has been merged in the upstream branch:
commit dadca7c8be7fa455173a03cde01cc9a6e75f960e
Merge: 24a7e6797c524ef44fc027172dc5c1b34fc81c7a 9f8454d97cbefa26d614a5fcfa0e2a628a0961c4
Author: Brice DUBOST <braice at braice.net>
Date:   Sun Sep 21 13:57:48 2008 +0200

    Merge branch 'master' into sap

diff --combined src/Makefile
index a6e4277,29b1b6b..72bce4c
--- a/src/Makefile
+++ b/src/Makefile
@@@ -1,9 -1,9 +1,9 @@@
  CC	= gcc
- CFLAGS	= -Wall -Wextra -O2
+ CFLAGS	= -Wall -Wextra -O2 -ggdb
  IFLAGS	= -g root -o root
  
  OUT		= mumudvb
- OBJ_FILES	= mumudvb.o tune.o udp.o dvb.o pat_rewrite.o cam.o cam_en50221.o log.o ts.o autoconf.o sap.o
 -OBJ_FILES	= mumudvb.o tune.o udp.o dvb.o pat_rewrite.o cam.o cam_en50221.o log.o ts.o autoconf.o crc32.o
++OBJ_FILES	= mumudvb.o tune.o udp.o dvb.o pat_rewrite.o cam.o cam_en50221.o log.o ts.o autoconf.o sap.o crc32.o
  SRC_FILES	= $(OBJ_FILES:.o=.c)
  
  ifdef DESTDIR
diff --combined src/mumudvb.c
index 5dffe0f,e4679ae..6a70043
--- a/src/mumudvb.c
+++ b/src/mumudvb.c
@@@ -33,6 -33,7 +33,7 @@@
  #include <sys/time.h>
  #include <sys/poll.h>
  #include <sys/stat.h>
+ #include <stdint.h>
  #include <resolv.h>
  #include <fcntl.h>
  #include <unistd.h>
@@@ -51,8 -52,10 +52,9 @@@
  #include "ts.h"
  #include "errors.h"
  #include "autoconf.h"
 -
 -#define VERSION "1.5.0"
 +#include "sap.h"
  
+ extern uint32_t       crc32_table[256];
  
  /* Signal handling code shamelessly copied from VDR by Klaus Schmidinger 
     - see http://www.cadsoft.de/people/kls/vdr/index.htm */
@@@ -81,9 -84,6 +83,9 @@@ char nom_fich_chaines_non_diff[256]
  char nom_fich_pid[256];
  int  write_streamed_channels=1;
  
 +//sap announces
 +mumudvb_sap_message_t sap_messages[MAX_CHANNELS]; //the sap message... //TODO : allocate dynamically
 +int sap=0; //do we send sap announces ?
  
  //autoconfiguration
  int autoconfiguration = 0;           //Do we use autoconfiguration ?
@@@ -106,10 -106,6 +108,6 @@@ access_sys_t *cam_sys_access
  // file descriptors
  fds_t fds; // defined in dvb.h
  
- 
- //CRC table for PAT rebuilding and cam support
- unsigned long       crc32_table[256];
- 
  // prototypes
  static void SignalHandler (int signum);
  int mumudvb_close(int Interrupted, mumudvb_ts_packet_t *cam_pmt_ptr);
@@@ -212,7 -208,6 +210,6 @@@ main (int argc, char **argv
  
    //do we rewrite the pat pid ?
    int rewrite_pat = 0;
-   unsigned long crc32_table_temp_var[3];
  
    //do we support conditionnal access modules ?
    int i;
@@@ -237,8 -232,6 +234,8 @@@
    };
    int c, option_index = 0;
  
 +  //paranoia
 +  sap_organisation[0]=0;
  
    // Initialise PID map
    for (k = 0; k < 8192; k++)
@@@ -381,37 -374,6 +378,37 @@@
  			"!!! You have enabled the support for autoconfiguration, this is a beta feature.Please report any bug/comment\n");
  	    }
  	}
 +      else if (!strcmp (substring, "sap"))
 +	{
 +	  substring = strtok (NULL, delimiteurs);
 +	  sap = atoi (substring);
 +	  if(autoconfiguration)
 +	    {
 +	      log_message( MSG_WARN,
 +			"!!! You have enabled the support for autoconfiguration, this is a beta feature.Please report any bug/comment\n");
 +	    }
 +	}
 +      else if (!strcmp (substring, "sap"))
 +	{
 +	  substring = strtok (NULL, delimiteurs);
 +	  sap = atoi (substring);
 +	  if(autoconfiguration)
 +	    {
 +	      log_message( MSG_WARN,
 +			"!!! You have enabled the support for autoconfiguration, this is a beta feature.Please report any bug/comment\n");
 +	    }
 +	}
 +      else if (!strcmp (substring, "sap_organisation"))
 +	{
 +	  // other substring extraction method in order to keep spaces
 +	  substring = strtok (NULL, delimiteurs);
 +	  if (!(strlen (substring) >= 255 - 1))
 +	    strcpy(sap_organisation,strtok(substring,"\n"));	
 +	  else
 +	    {
 +		log_message( MSG_INFO,"Sap Organisation name too long\n");
 +	    }
 +	}
        else if (!strcmp (substring, "freq"))
  	{
  	  substring = strtok (NULL, delimiteurs);
@@@ -667,7 -629,6 +664,7 @@@
    //end of config file reading
    /******************************************************/
  
 +
    number_of_channels = curr_channel;
    if (curr_channel > MAX_CHANNELS)
      {
@@@ -690,8 -651,8 +687,8 @@@
  		   nom_fich_chaines_diff, strerror (errno));
        //exit(ERROR_CREATE_FILE);
      }
- 
-   fclose (chaines_diff);
+   else
+     fclose (chaines_diff);
  
    chaines_non_diff = fopen (nom_fich_chaines_non_diff, "w");
    if (chaines_diff == NULL)
@@@ -702,8 -663,8 +699,8 @@@
  		   nom_fich_chaines_non_diff, strerror (errno));
        //exit(ERROR_CREATE_FILE);
      }
- 
-   fclose (chaines_non_diff);
+   else
+     fclose (chaines_non_diff);
  
    
    log_message( MSG_INFO, "Streaming. Freq %lu pol %c srate %lu\n",
@@@ -711,23 -672,6 +708,6 @@@
  
  
    /******************************************************/
-   //we compute the crc32 tables for cam support,
-   // autoconfiguration or pat rewriting
-   /******************************************************/
-   if(cam_support||rewrite_pat||autoconfiguration)
-     {
-       //CRC32 table initialisation (taken from the xine project), we can also use static tables if we want
-       for( crc32_table_temp_var[0] = 0 ; crc32_table_temp_var[0] < 256 ; crc32_table_temp_var[0]++ ) {
- 	crc32_table_temp_var[2] = 0;
- 	for (crc32_table_temp_var[1] = (crc32_table_temp_var[0] << 24) | 0x800000 ; crc32_table_temp_var[1] != 0x80000000 ; crc32_table_temp_var[1] <<= 1) {
- 	  crc32_table_temp_var[2] = (crc32_table_temp_var[2] << 1) ^ (((crc32_table_temp_var[2] ^ crc32_table_temp_var[1]) & 0x80000000) ? 0x04c11db7 : 0);
- 	}
- 	crc32_table[crc32_table_temp_var[0]] = crc32_table_temp_var[2];
-       }
-     }
- 
- 
-   /******************************************************/
    // Card tuning
    /******************************************************/
    // alarm for tuning timeout
@@@ -738,6 -682,8 +718,8 @@@
    alarm (timeout_accord);
  
    // We tune the card
+   tune_retval =-1;
+ 
    if ((freq > 100000000))
      {
        if (open_fe (&fds.fd_frontend, card))
@@@ -954,23 -900,6 +936,23 @@@
        channels[curr_channel].socketOut = makeclientsocket (channels[curr_channel].ipOut, channels[curr_channel].portOut, DEFAULT_TTL, &channels[curr_channel].sOut);
      }
  
 +
 +  /*****************************************************/
 +  // init sap
 +  /*****************************************************/
 +
 +  if(sap)
 +    {
 +      //For sap announces, we open the socket
 +      sap_socketOut =  makeclientsocket (SAP_IP, SAP_PORT, SAP_TTL, &sap_sOut);
 +      if(!strlen(sap_organisation))
 +	sprintf(sap_organisation,"mumudvb");
 +      sap_serial= 1 + (int) (424242.0 * (rand() / (RAND_MAX + 1.0)));
 +      sap_last_time_sent = 0;
 +      //todo : loop to create the version
 +    }
 +
 +
    /*****************************************************/
    // Information about streamed channels
    /*****************************************************/
@@@ -1370,23 -1299,6 +1352,23 @@@ SignalHandler (int signum
        //end of autoconfiguration
        else //we are not doing autoconfiguration we can do something else
  	{
 +	  //sap announces
 +	  if(!sap_last_time_sent)
 +	    {
 +	      // it's the first time we are here, we initialize all the channels
 +	      for (curr_channel = 0; curr_channel < number_of_channels; curr_channel++)
 +		{
 +		  sap_update(channels[curr_channel], &sap_messages[curr_channel]);
 +		}
 +	      sap_last_time_sent=now-SAP_INTERVAL-1;
 +	    }
 +	  if((now-sap_last_time_sent)>=SAP_INTERVAL)
 +	    {
 +	      sap_send(sap_messages, number_of_channels);
 +	      sap_last_time_sent=now;
 +	    }
 +	  //end of sap announces
 +
  	  for (curr_channel = 0; curr_channel < number_of_channels; curr_channel++)
  	    if ((channels[curr_channel].streamed_channel >= 100) && (!channels[curr_channel].streamed_channel_old))
  	      {
@@@ -1394,7 -1306,6 +1376,7 @@@
  			     "Channel \"%s\" back.Card %d\n",
  			     channels[curr_channel].name, card);
  		channels[curr_channel].streamed_channel_old = 1;	// update
 +		sap_update(channels[curr_channel], &sap_messages[curr_channel]);
  	      }
  	    else if ((channels[curr_channel].streamed_channel_old) && (channels[curr_channel].streamed_channel < 30))
  	      {
@@@ -1402,7 -1313,6 +1384,7 @@@
  			     "Channel \"%s\" down.Card %d\n",
  			     channels[curr_channel].name, card);
  		channels[curr_channel].streamed_channel_old = 0;	// update
 +		sap_update(channels[curr_channel], &sap_messages[curr_channel]);
  	      }
  
  	  /*******************************************/

-- 
Mumudvb packaging



More information about the pkg-vdr-dvb-changes mailing list