fix REG_RIP, fix preview locking veejay, fix jumping quick select

git-svn-id: svn://code.dyne.org/veejay/trunk@1393 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2010-02-22 21:09:46 +00:00
parent b2a8162ef7
commit 6172b2c0b8
8 changed files with 65 additions and 29 deletions

View File

@@ -939,7 +939,7 @@ int v4lvideo_copy_framebuffer_to( void *vv, uint8_t *dstY, uint8_t *dstU, uint8_
return -1;
}
lock_(v);
lock_(v);
if(!v->v4l ) {
unlock_(v);
return 0;
@@ -993,6 +993,8 @@ static void __v4lvideo_copy_framebuffer_to(v4lvideo_t *v1, v4lvideo_template_t *
yuv_init_swscaler( srcf,dstf,&(v1->sws_templ), yuv_sws_get_cpu_flags());
lock_(v2);
yuv_convert_and_scale( v1->scaler, srcf, dstf );
v1->has_video = 1;
unlock_(v2);
} else if ( v1->native == 2 ) {
@@ -1021,6 +1023,8 @@ static void __v4lvideo_copy_framebuffer_to(v4lvideo_t *v1, v4lvideo_template_t *
srcf->data[2] = tmp[2];
lock_(v2);
yuv_convert_and_scale( v1->scaler, srcf, dstf );
v1->has_video = 1;
unlock_(v2);
} else {
VJFrame *srcf = v1->info->src;
@@ -1047,10 +1051,12 @@ static void __v4lvideo_copy_framebuffer_to(v4lvideo_t *v1, v4lvideo_template_t *
lock_(v2);
yuv_convert_and_scale_from_rgb( v1->scaler, srcf, dstf );
v1->has_video = 1;
unlock_(v2);
// }
}
v1->has_video = 1;
// v1->has_video = 1;
}

View File

@@ -1516,15 +1516,13 @@ int vj_tag_try_filename(int t1, char *filename, int format)
static int vj_tag_start_encoder(vj_tag *tag, int format, long nframes)
{
char descr[100];
char cformat = vj_avcodec_find_lav( format );
int sample_id = tag->id;
tag->encoder = vj_avcodec_start( _tag_info->edit_list , format, tag->encoder_destination );
if(!tag->encoder)
{
veejay_msg(0, "Unable to use %s encoder, please select another",
descr );
veejay_msg(0, "Unable to use selected encoder, please choose another.");
return 0;
}
tag->encoder_active = 1;
@@ -1594,8 +1592,7 @@ static int vj_tag_start_encoder(vj_tag *tag, int format, long nframes)
}
}
veejay_msg(VEEJAY_MSG_INFO, "Recording to %s file [%s] %ldx%ld@%2.2f %d/%d/%d >%09ld<",
descr,
veejay_msg(VEEJAY_MSG_INFO, "Recording to file [%s] %ldx%ld@%2.2f %d/%d/%d >%09ld<",
tag->encoder_destination,
_tag_info->edit_list->video_width,
_tag_info->edit_list->video_height,

View File

@@ -1,7 +1,7 @@
/*
* Linux VeeJay
*
* Copyright(C)2002-2004 Niels Elburg <nwelburg@gmail.com>
* Copyright(C)2002-2010 Niels Elburg <nwelburg@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,8 +21,8 @@
/**
* Printing the stack trace, explanation by Jaco Kroon:
* http://tlug.up.ac.za/wiki/index.php/Obtaining_a_stack_trace_in_C_upon_SIGSEGV
* Jaco Kroon <jaco@kroon.co.za>
*
* Author: Jaco Kroon <jaco@kroon.co.za>
* Copyright (C) 2005 - 2008 Jaco Kroon
*/
#include <config.h>
@@ -197,12 +197,17 @@ void veejay_backtrace_handler(int n , void *dist, void *x)
veejay_msg(VEEJAY_MSG_WARNING, "No fresh ale found in the fridge."); //@
veejay_msg(VEEJAY_MSG_INFO, "Running with sub-atomic precision..."); //@
#if defined(SIGSEGV_STACK_IA64) || defined(SIGSEGV_STACK_X86)
#if defined(SIGSEGV_STACK_X86)
veejay_msg(VEEJAY_MSG_INFO,"(%s) invalid access to %p at %x",
strerr,ist->si_addr, puc->uc_mcontext.gregs[REG_EIP]);
veejay_addr2line_bt( 0, puc->uc_mcontext.gregs[REG_EIP] , puc->uc_mcontext.gregs[REG_EIP] );
#elif defined(SIGSEGV_STACK_IA64)
veejay_msg(VEEJAY_MSG_INFO,"(%s) invalid access to %p at %x",
strerr,ist->si_addr, puc->uc_mcontext.gregs[REG_RIP]);
veejay_addr2line_bt( 0, puc->uc_mcontext.gregs[REG_RIP] );
#endif
#endif
for( i = 0; i < NGREG; i ++ ) {
veejay_msg(VEEJAY_MSG_INFO, "\tregister [%2d]\t=%x",i,puc->uc_mcontext.gregs[i]);
}
@@ -242,8 +247,13 @@ void veejay_backtrace_handler(int n , void *dist, void *x)
break;
}
#if defined(SIGSEGV_STACK_IA64) || defined(SIGSEGV_STACK_X86)
#if defined(SIGSEGV_STACK_IA64)
veejay_print_backtrace(puc->uc_mcontext.gregs[REG_RIP]);
#elif defined(SIGSEGV_STACK_X86)
veejay_print_backtrace(puc->uc_mcontext.gregs[REG_EIP]);
#endif
#endif
//@ Bye
veejay_msg(VEEJAY_MSG_ERROR, "Bugs compromised the system.");

View File

@@ -137,9 +137,9 @@ int sock_t_poll_w(vj_sock_t *s )
int status;
fd_set fds;
struct timeval no_wait;
memset( &no_wait, 0, sizeof(no_wait) );
no_wait.tv_sec = TIMEOUT;
no_wait.tv_usec = 0;
memset( &no_wait, 0, sizeof(no_wait) );
FD_ZERO( &fds );
FD_SET( s->sock_fd, &fds );
@@ -176,6 +176,7 @@ int sock_t_poll( vj_sock_t *s )
FD_SET( s->sock_fd, &fds );
status = select( s->sock_fd + 1, &fds, 0, 0, &no_wait );
if( status < 0 )
{
veejay_msg(VEEJAY_MSG_ERROR, "Unable to poll socket for immediate read: %s", strerror(errno));
@@ -188,19 +189,18 @@ int sock_t_poll( vj_sock_t *s )
return 0;
}
/*
static int timed_recv( int fd, void *buf, const int len, int timeout )
{
fd_set fds;
int n;
struct timeval tv;
memset( &tv, 0,sizeof(timeval));
FD_ZERO(&fds);
FD_SET( fd,&fds );
tv.tv_sec = TIMEOUT;
tv.tv_usec = 0;
n = select( fd + 1, &fds, NULL, NULL, &tv );
if( n == 0 ) {
@@ -214,7 +214,7 @@ static int timed_recv( int fd, void *buf, const int len, int timeout )
return -5;
return recv( fd, buf, len, 0 );
}
}*/
int sock_t_recv_w( vj_sock_t *s, void *dst, int len )
{
@@ -255,6 +255,13 @@ int sock_t_recv_w( vj_sock_t *s, void *dst, int len )
return 0;
}
void sock_t_set_timeout( vj_sock_t *s, int t )
{
int opt = t;
setsockopt( s->sock_fd, SOL_SOCKET, SO_SNDTIMEO, (char*) &opt, sizeof(int));
setsockopt( s->sock_fd, SOL_SOCKET, SO_RCVTIMEO, (char*) &opt, sizeof(int));
}
int sock_t_recv( vj_sock_t *s, void *dst, int len )
{
int done = 0;
@@ -265,11 +272,9 @@ int sock_t_recv( vj_sock_t *s, void *dst, int len )
while( done < len )
{
n = timed_recv( s->sock_fd, dst+done,bytes_left, TIMEOUT );
if( n == -5 ) {
veejay_msg(VEEJAY_MSG_DEBUG, "Timeout while receiving data");
return -1;
} else if ( n == -1 ) {
//@ setup socket with SO_RCVTIMEO
n = recv( s->sock_fd, dst+done,bytes_left, 0 );
if ( n == -1 ) {
veejay_msg(VEEJAY_MSG_ERROR, "%s", strerror(errno));
return -1;
}

View File

@@ -48,4 +48,5 @@ int sock_t_send( vj_sock_t *s, unsigned char *buf, int len );
int sock_t_send_fd( int fd, int sndsize, unsigned char *buf, int len );
void sock_t_close( vj_sock_t *s );
int sock_t_connect_and_send_http( vj_sock_t *s, char *host, int port, char *buf, int buf_len );
void sock_t_set_timeout( vj_sock_t *s, int t );
#endif

View File

@@ -410,6 +410,19 @@ int vj_client_get_status_fd(vj_client *v, int sock_type )
}
return 0;
}
int vj_client_setup_timeout( vj_client *v, int sock_type, int timeout )
{
if( sock_type == V_STATUS )
{
sock_t_set_timeout( v->c[1], timeout );
}
if( sock_type == V_CMD )
{
sock_t_set_timeout( v->c[0], timeout );
}
}
int vj_client_read_no_wait(vj_client *v, int sock_type, uint8_t *dst, int bytes )
{
if( sock_type == V_STATUS )

View File

@@ -77,5 +77,6 @@ int vj_client_window_sizes( int socket_fd, int *r, int *s );
int vj_client_connect_dat(vj_client *v, char *host, int port_id );
int vj_client_setup_timeout( vj_client *v, int sock_type, int timeout );
#endif

View File

@@ -374,21 +374,24 @@ int vj_server_link_can_write( vj_server *vje, int link_id, int timeout )
struct timeval tv;
memset( &tv, 0,sizeof(struct timeval));
tv.tv_sec = timeout;
// if( timeout ) {
// tv.tv_sec = 1;
// }
int err = select( link[link_id]->handle+1, NULL, &wds, &eds,&tv );
if( err < 0 )
if( err <= 0 )
{
veejay_msg(0, "Unable to poll for immediate write: %s", link_id,strerror(errno));
return 0;
}
if( err == 0 )
/* if( err == 0 )
{
veejay_msg(0, "Timeout expired");
return 1;
}
*/
if( FD_ISSET( link[link_id]->handle, &eds ))
{
veejay_msg(0, "An exception occured to link %d", link_id );