From 5d4eda9386e8a7678c2d1257c7f1115b4dfa5bf5 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Thu, 13 Oct 2011 16:36:00 +0300 Subject: [PATCH 1/9] configure: readline check should set LDFLAGSCLI. --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 17d10ad0..477ae031 100755 --- a/configure +++ b/configure @@ -633,10 +633,10 @@ fi if [ "$readline" = "auto" ] ; then readline="no" readlineflags="-lreadline" - if cc_check "readline/readline.h" $readlineflags "rl_initialize();" ; then + if cc_check "readline/readline.h" "$readlineflags" "rl_initialize();" ; then readline="yes" define HAVE_READLINE - LDFLAGS="$LDFLAGS $readlineflags" + LDFLAGSCLI="$readlineflags" fi fi From eceddab84c0e18779ae33f49ca8c4d6d44796524 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Thu, 13 Oct 2011 16:36:42 +0300 Subject: [PATCH 2/9] configure: Check if readline needs ncurses. On Slackware readline library is linked with ncurses and when -lncurses is missing from readline check the check fails. --- configure | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure b/configure index 477ae031..f11821ba 100755 --- a/configure +++ b/configure @@ -638,6 +638,12 @@ if [ "$readline" = "auto" ] ; then define HAVE_READLINE LDFLAGSCLI="$readlineflags" fi + readlineflags="-lncurses -lreadline" + if cc_check "readline/readline.h" "$readlineflags" "rl_initialize();" ; then + readline="yes" + define HAVE_READLINE + LDFLAGSCLI="$readlineflags" + fi fi if [ "$readline" = "no" ] ; then From 3307de3065a6bec4f59959b06a23b00e53d63bfb Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Thu, 13 Oct 2011 16:38:37 +0300 Subject: [PATCH 3/9] obe: Do not try to free mux thread resources if the thread is not started. This prevents segfault on exit from obecli. --- obe.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/obe.c b/obe.c index d60e4c54..70f1478d 100644 --- a/obe.c +++ b/obe.c @@ -1028,11 +1028,14 @@ void obe_close( obe_t *h ) /* Cancel mux thread */ - pthread_mutex_lock( &h->mux_mutex ); - h->cancel_mux_thread = 1; - pthread_cond_signal( &h->mux_cv ); - pthread_mutex_unlock( &h->mux_mutex ); - pthread_join( h->mux_thread, &ret_ptr ); + if ( h->mux_thread ) + { + pthread_mutex_lock( &h->mux_mutex ); + h->cancel_mux_thread = 1; + pthread_cond_signal( &h->mux_cv ); + pthread_mutex_unlock( &h->mux_mutex ); + pthread_join( h->mux_thread, &ret_ptr ); + } fprintf( stderr, "mux cancelled \n" ); From 1dc055a9c2f69753bd7e49abe60a30d3268e0a90 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 14 Oct 2011 00:25:20 +0300 Subject: [PATCH 4/9] configure: Use cc_check to check if DeckLink API library exists. --- configure | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/configure b/configure index f11821ba..2fba72ec 100755 --- a/configure +++ b/configure @@ -667,14 +667,9 @@ fi if [ "$decklink" = "auto" ] ; then decklink="no" - log_check "for DeckLink API binary $prefix/lib/libDeckLinkAPI.so" - if [ -f "$prefix/lib/libDeckLinkAPI.so" ] ; then - log_ok - if cxx_check ; then - decklink="yes" - fi - else - log_fail + decklinkflags="-lDeckLinkAPI" + if cc_check "" "$decklinkflags" "" ; then + decklink="yes" fi fi From b5c784d6943fb695a9dd707ffcec40259503dfbb Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 14 Oct 2011 00:29:46 +0300 Subject: [PATCH 5/9] obecli: Add quit command. --- obecli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obecli.c b/obecli.c index 40bf5b0d..8b72535c 100644 --- a/obecli.c +++ b/obecli.c @@ -914,7 +914,8 @@ int main( int argc, char **argv ) if( line_read && *line_read ) { - if( !strcasecmp( line_read, "exit" ) ) + if( !strcasecmp( line_read, "exit" ) || + !strcasecmp( line_read, "quit" ) ) { free( line_read ); break; From b82f7204ad9a348e91dfc672fc86fba732b8b7ae Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 14 Oct 2011 00:44:00 +0300 Subject: [PATCH 6/9] configure: Remove temporary file created by the checks. --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 2fba72ec..fe9b04e8 100755 --- a/configure +++ b/configure @@ -82,6 +82,7 @@ cc_check() { cat conftest.log >> config.log log_msg "--------------------------------------------------" fi + rm conftest.c conftest.o conftest 2>/dev/null return $res } @@ -103,6 +104,7 @@ cpp_check() { cat conftest.log >> config.log log_msg "--------------------------------------------------" fi + rm conftest.c conftest.o conftest 2>/dev/null return $res } @@ -137,6 +139,7 @@ cxx_check() { cat conftest.log >> config.log log_msg "--------------------------------------------------" fi + rm conftest.c conftest.o conftest 2>/dev/null return $res } @@ -159,6 +162,7 @@ as_check() { cat conftest.asm >> config.log log_msg "--------------------------------------------------" fi + rm conftest.asm >/dev/null return $res } From 49a318d1984998cb5054b43bb5c1f2524be5edda Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 14 Oct 2011 00:46:00 +0300 Subject: [PATCH 7/9] gitignore: Add obecli to ignored files. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 682a23c1..7e7b921f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ checkasm .digress_x264 dataDec.txt log.dec + +obecli From 9362b747707e2411c5015ac9d8ca63513c978f3f Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 14 Oct 2011 01:09:18 +0300 Subject: [PATCH 8/9] obe: Do not try to cancel not initialized device threads. This prevents segfault on exit from obecli. --- obe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/obe.c b/obe.c index 70f1478d..50b6c91a 100644 --- a/obe.c +++ b/obe.c @@ -993,11 +993,16 @@ void obe_close( obe_t *h ) { void *ret_ptr; + fprintf( stderr, "closing obe \n" ); + /* Cancel input thread */ for( int i = 0; i < h->num_devices; i++ ) { - pthread_cancel( h->devices[i]->device_thread ); - pthread_join( h->devices[i]->device_thread, &ret_ptr ); + if ( h->devices[i]->device_thread ) + { + pthread_cancel( h->devices[i]->device_thread ); + pthread_join( h->devices[i]->device_thread, &ret_ptr ); + } } fprintf( stderr, "input cancelled \n" ); From a0ebb76ce66934bd2a467e413757e46d55dab86d Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 14 Oct 2011 01:14:47 +0300 Subject: [PATCH 9/9] decklink: Remove sleep in probe_stream(). With this sleep obe segfaults when trying run probe. --- input/sdi/decklink/decklink.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/input/sdi/decklink/decklink.cpp b/input/sdi/decklink/decklink.cpp index cd4ba5c6..96fd0fb3 100644 --- a/input/sdi/decklink/decklink.cpp +++ b/input/sdi/decklink/decklink.cpp @@ -833,8 +833,6 @@ static void *probe_stream( void *ptr ) if( open_card( decklink_opts ) < 0 ) goto finish; - sleep( 1 ); - close_card( decklink_opts ); /* TODO: probe for SMPTE 337M */