mirror of
https://github.com/game-stop/veejay.git
synced 2026-01-06 15:05:28 +01:00
be verbosive when memory allocation fails
added verbose logging to sayVIMS, commandline option -v added vj_mem_init bump sayVIMS to 1.1.4
This commit is contained in:
@@ -27,13 +27,17 @@
|
||||
#include <unistd.h>
|
||||
#include <aclib/ac.h>
|
||||
#include <aclib/imgconvert.h>
|
||||
#include <errno.h>
|
||||
#ifdef STRICT_CHECKING
|
||||
#include <assert.h>
|
||||
#endif
|
||||
extern void find_best_memcpy(void);
|
||||
extern void find_best_memset(void);
|
||||
extern int find_best_threaded_memcpy(int w, int h);
|
||||
extern void yuyv_plane_init();
|
||||
|
||||
static int MEM_ALIGNMENT_SIZE = 0;
|
||||
static int CACHE_LINE_SIZE = 16;
|
||||
static int CACHE_LINE_SIZE = 64;
|
||||
|
||||
|
||||
#ifdef ARCH_X86
|
||||
@@ -179,9 +183,26 @@ void *vj_malloc_(size_t size)
|
||||
return NULL;
|
||||
void *ptr = NULL;
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
posix_memalign( &ptr, MEM_ALIGNMENT_SIZE, size );
|
||||
size_t aligned_size = (size + 3) & ~0x03;
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( MEM_ALIGNMENT_SIZE > 0 );
|
||||
#endif
|
||||
int err = posix_memalign( &ptr, MEM_ALIGNMENT_SIZE, aligned_size );
|
||||
if( err == EINVAL )
|
||||
{
|
||||
veejay_msg(0, "Memory is not a multiple of %d : %d", sizeof(void*), aligned_size );
|
||||
return NULL;
|
||||
}
|
||||
if( err == ENOMEM )
|
||||
{
|
||||
veejay_msg(0, "Unable to allocate %d bytes of memory",size );
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE_MEMALIGN
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( MEM_ALIGNMENT_SIZE > 0 );
|
||||
#endif
|
||||
ptr = memalign( MEM_ALIGNMENT_SIZE, size );
|
||||
#else
|
||||
ptr = malloc ( size ) ;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl AC_INIT
|
||||
AC_INIT([veejay-utils],[1.1.3],[veejay-users@lists.sourceforge.net])
|
||||
AC_INIT([veejay-utils],[1.1.4],[veejay-users@lists.sourceforge.net])
|
||||
AC_PREREQ(2.57)
|
||||
AC_CONFIG_SRCDIR([src/sayVIMS.c])
|
||||
|
||||
VEEJAY_MAJOR_VERSION=1
|
||||
VEEJAY_MINOR_VERSION=1
|
||||
VEEJAY_MICRO_VERSION=3
|
||||
VEEJAY_MICRO_VERSION=4
|
||||
VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION
|
||||
VEEJAY_CODENAME="Veejay Utilities - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION"
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
#include <sys/socket.h>
|
||||
#include <veejay/vims.h>
|
||||
#include <veejay/vj-client.h>
|
||||
#include <veejay/vjmem.h>
|
||||
#include <veejay/vj-msg.h>
|
||||
static int interactive = 0;
|
||||
static int port_num = 3490;
|
||||
static char *filename = NULL;
|
||||
static char *group_name = NULL;
|
||||
static char *host_name = NULL;
|
||||
static vj_client *sayvims = NULL;
|
||||
@@ -40,10 +41,10 @@ static int colors = 0;
|
||||
static int fd_in = 0; // stdin
|
||||
static int single_msg = 0;
|
||||
static int dump = 0;
|
||||
|
||||
static int verbose = 0;
|
||||
/* count played frames (delay) */
|
||||
static void vj_flush(int frames) {
|
||||
int n = 0;
|
||||
|
||||
char status[100];
|
||||
bzero(status,100);
|
||||
|
||||
@@ -87,6 +88,7 @@ static void Usage(char *progname)
|
||||
fprintf(stderr, " -m\t\tSend single message\n");
|
||||
fprintf(stderr, " -c\t\tColored output\n");
|
||||
fprintf(stderr, " -d\t\tDump status to stdout\n");
|
||||
fprintf(stderr, " -v\t\t\n");
|
||||
fprintf(stderr, "Messages to send to veejay must be wrapped in quotes\n");
|
||||
fprintf(stderr, "You can send multiple messages by seperating them with a whitespace\n");
|
||||
fprintf(stderr, "Example: %s \"600:;\"\n",progname);
|
||||
@@ -129,6 +131,10 @@ static int set_option(const char *name, char *value)
|
||||
{
|
||||
dump = 1;
|
||||
}
|
||||
else if(strcmp(name,"v") == 0 )
|
||||
{
|
||||
verbose = 1;
|
||||
}
|
||||
else err++;
|
||||
|
||||
return err;
|
||||
@@ -159,18 +165,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int n = 0;
|
||||
int x = 0;
|
||||
int k =0;
|
||||
char msg[20];
|
||||
char option[2];
|
||||
char ibuf[1024];
|
||||
int err = 0;
|
||||
FILE *infile;
|
||||
|
||||
veejay_set_debug_level(1);
|
||||
veejay_set_debug_level(verbose);
|
||||
|
||||
// parse commandline parameters
|
||||
while( ( n = getopt(argc,argv, "h:g:p:micd")) != EOF)
|
||||
while( ( n = getopt(argc,argv, "h:g:p:micdv")) != EOF)
|
||||
{
|
||||
sprintf(option,"%c",n);
|
||||
err += set_option( option,optarg);
|
||||
@@ -182,6 +184,10 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
vj_mem_init();
|
||||
|
||||
veejay_set_debug_level( verbose );
|
||||
|
||||
sayvims = sayvims_connect();
|
||||
|
||||
if(!sayvims) {
|
||||
@@ -220,7 +226,6 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
/* read from stdin*/
|
||||
int not_done = 1;
|
||||
infile = fdopen( fd_in, "r" );
|
||||
if(!infile)
|
||||
{
|
||||
@@ -251,6 +256,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
vj_flush(1);
|
||||
vj_client_close(sayvims);
|
||||
vj_client_free(sayvims);
|
||||
|
||||
Reference in New Issue
Block a user