Logo Search packages:      
Sourcecode: ardour version File versions

void ImageFrameSocketHandler::image_socket_callback ( void *  arg,
int32_t  fd,
GdkInputCondition  cond 
) [static]

call back to handle doing the processing work This method is added to the gdk main loop and called when there is data upon the socket.

Definition at line 116 of file imageframe_socket_handler.cc.

References close_connection(), CompositorSocketShutdown, get_instance(), get_message_part(), handle_insert_message(), handle_item_selected(), handle_item_update_message(), handle_remove_message(), handle_rename_message(), handle_request_data(), handle_session_action(), send_return_failure(), and theGdkInputTag.

{
      char buf[ardourvis::MAX_MSG_SIZE + 1] ;
      memset(buf, 0, (ardourvis::MAX_MSG_SIZE + 1)) ;
      buf[ardourvis::MAX_MSG_SIZE] = '\0' ;

      int retcode = ::recv(fd, buf, MAX_MSG_SIZE, 0) ;
      if (retcode == 0)
      {
            //end-of-file, other end closed or shutdown?
            ARDOUR_UI::instance()->popup_error(_("Image Compositor Socket has been shutdown/closed"));
            
            // assume socket has been shutdown, tell, someone interested,
            // and remove the socket from the event loop
            ImageFrameSocketHandler* ifsh = ImageFrameSocketHandler::get_instance() ;
            gdk_input_remove(ifsh->theGdkInputTag) ;
            ifsh->close_connection() ;
             ifsh->CompositorSocketShutdown() ; /* EMIT_SIGNAL */
      }
      if(retcode > 0)
      {
            //std::cout << "Received Msg [" << buf << "]\n" ;
            ImageFrameSocketHandler* ifsh = ImageFrameSocketHandler::get_instance() ;
            
            std::string mType = ifsh->get_message_part(0,2,buf) ;

            if(mType == ardourvis::INSERT_ITEM)
            {
                  ifsh->handle_insert_message(buf) ;
            }
            else if (mType == ardourvis::REMOVE_ITEM)
            {
                  ifsh->handle_remove_message(buf) ;
            }
            else if (mType == ardourvis::RENAME_ITEM)
            {
                  ifsh->handle_rename_message(buf) ;
            }
            else if (mType == ardourvis::ITEM_UPDATE)
            {
                  ifsh->handle_item_update_message(buf) ;
            }
            else if (mType == ardourvis::REQUEST_DATA)
            {
                  ifsh->handle_request_data(buf) ;
            }
            else if (mType == ardourvis::ITEM_SELECTED)
            {
                  ifsh->handle_item_selected(buf) ;
            }
            else if(mType == ardourvis::SESSION_ACTION)
            {
                  ifsh->handle_session_action(buf) ;
            }
            else
            {
                  std::string errMsg = "Unknown Message type : " ; 
                  errMsg.append(mType) ;
                  ifsh->send_return_failure(errMsg) ;
            }     
      }
}


Generated by  Doxygen 1.6.0   Back to index