コード例 #1
0
ファイル: sock.c プロジェクト: afghanistanyn/websshproxy
conn_t* get_conns_slot()
{
	if ( NULL == free_conn ) {
		log_message( LOG_WARNING, "fullcons:%d is full.", fullcnt );
		return NULL;
	}

	conn_t *pconn = free_conn;
	pconn->read_closed = pconn->write_closed = 0;
	free_conn = free_conn->data;
	++ fullcnt;
	log_message( LOG_DEBUG, "fullcons:%d.", fullcnt );

	if ( NULL != pconn->read_buffer ) {
		log_message( LOG_ERROR, "read_buffer not release" );
		delete_buffer( pconn->read_buffer);
		pconn->read_buffer = NULL;
	}
	if ( NULL != pconn->write_buffer ) {
		log_message( LOG_ERROR, "write_buffer not release" );
		delete_buffer( pconn->write_buffer);
		pconn->write_buffer = NULL;
	}

	return pconn;
}
コード例 #2
0
ファイル: sock.c プロジェクト: afghanistanyn/websshproxy
void release_conns_slot( conn_t *pconn )
{
	if ( NULL == pconn )
		return;

	//只有两个conn都删除时才会delete buffer
	if ( NULL == pconn->server_conn ) {		//read_buffer write是client_conn server_conn共用的
		if ( NULL != pconn->read_buffer ) {
			delete_buffer( pconn->read_buffer );
		}
		if ( NULL != pconn->write_buffer ) {
			delete_buffer( pconn->write_buffer );
		}
	}

	pconn->read_buffer = pconn->write_buffer = NULL;
	if ( NULL != pconn->server_conn ) {
		pconn->server_conn->server_conn = NULL;
		pconn->server_conn = NULL;
	}

	/*
	 * it's very important
	 */
	close( pconn->fd );		//必定不是监听套接字,只有一个进程使用这个fd

	pconn->data = free_conn;
	free_conn = pconn;
	-- fullcnt;

	log_message( LOG_CONN, "release conn[%s:%d:%d], fullcons:%d.", inet_ntoa(pconn->addr.sin_addr),
			ntohs(pconn->addr.sin_port), pconn->fd, fullcnt );
}	
コード例 #3
0
static
void send_data()
{
  int data_size = 0;
  static unsigned temperature;

  temperature = 21;
  clear_buffer(outputBuffer);
  clear_buffer(payload_buf);
  generate_payload(payload_buf,temperature);

  if(init_buffer(COAP_DATA_BUFF_SIZE)){
    coap_packet_t* request =\
    (coap_packet_t*)allocate_buffer(sizeof(coap_packet_t));
    init_packet(request);
    coap_set_method(request, COAP_POST);
    request->tid = xact_id++;
    request->type = MESSAGE_TYPE_CON;
    coap_set_header_uri(request,service_uri);
    coap_set_option(request, Option_Type_Uri_Host,
      sizeof(char)*strlen(server_ip), (uint8_t*)server_ip);
    coap_set_option(request, Option_Type_Proxy_Uri,
    sizeof(char)*strlen(proxy_uri), (uint8_t*)proxy_uri);
    coap_set_payload(request,(uint8_t*)payload_buf,
    sizeof(char)*strlen(payload_buf));
    data_size = serialize_packet(request, (uint8_t*)outputBuffer);

    PRINTF("Now sending request to base station [");
    PRINTF(&client_conn->ripaddr);
    PRINTF("]:%u/%s\n",REMOTE_PORT,service_uri);
    uip_udp_packet_send(client_conn, outputBuffer, data_size);
    delete_buffer();
  }
}
コード例 #4
0
ファイル: window.c プロジェクト: philipdexter/vx
void attach_buffer(Window *window, Buffer *buffer)
{
	if (window->buffer) {
		delete_buffer(window->buffer);
	}
	window->buffer = buffer;
}
コード例 #5
0
ファイル: gui_surface.cpp プロジェクト: AMD-FirePro/oclraster
void gui_surface::resize(const float2& buffer_size_) {
	uint2 buffer_size_abs_ = ((flags & SURFACE_FLAGS::ABSOLUTE_SIZE) == SURFACE_FLAGS::ABSOLUTE_SIZE ?
							  buffer_size_.rounded() :
							  buffer_size_ * float2(oclraster::get_width(), oclraster::get_height()));
	if(buffer.get_attachment_count() != 0 &&
	   buffer_size_abs.x == buffer_size_abs_.x && buffer_size_abs.y == buffer_size_abs_.y) {
		// same size, nothing to do here
		return;
	}
	buffer_size = buffer_size_;
	buffer_size_abs = buffer_size_abs_;
	
	delete_buffer();
	
	const bool has_depth = ((flags & SURFACE_FLAGS::NO_DEPTH) != SURFACE_FLAGS::NO_DEPTH);
	buffer = framebuffer::create_with_images(buffer_size_abs.x, buffer_size_abs.y,
											 { { IMAGE_TYPE::UINT_8, IMAGE_CHANNEL::RGBA } },
											 {
												 has_depth ? IMAGE_TYPE::FLOAT_32 : IMAGE_TYPE::NONE,
												 has_depth ? IMAGE_CHANNEL::R : IMAGE_CHANNEL::NONE
											 });
	
	// set blit vbo rectangle data
	set_offset(offset);
	
	//
	redraw();
}
コード例 #6
0
static void
send_data(void)
{
  char buf[MAX_PAYLOAD_LEN];

  if (init_buffer(COAP_DATA_BUFF_SIZE)) {
    int data_size = 0;
    coap_packet_t* request = (coap_packet_t*)allocate_buffer(sizeof(coap_packet_t));
    init_packet(request);

    coap_set_method(request, COAP_POST);
    request->tid = xact_id++;
    request->type = MESSAGE_TYPE_NON;
    coap_set_header_uri(request, service_url);

    data_size = serialize_packet(request, buf);

//    PRINTF("Client sending request to:[");
//    PRINT6ADDR(&client_conn->ripaddr);
//    PRINTF("]:%u/%s\n", (uint16_t)REMOTE_PORT, service_urls[service_id]);
    uip_udp_packet_send(client_conn, buf, data_size);

    delete_buffer();
  }
}
コード例 #7
0
ファイル: window.c プロジェクト: philipdexter/vx
void delete_window(Window *window)
{
	delwin(window->curses_window);
	if (window->buffer)
		delete_buffer(window->buffer);
	free(window);
}
コード例 #8
0
ファイル: recordvideo.C プロジェクト: knutj/cinelerra
RecordVideo::~RecordVideo()
{
	stop_recording();
	delete_buffer();
	delete trigger_lock;
        delete pause_record_lock;
        delete record_paused_lock;
}
コード例 #9
0
ファイル: conns.c プロジェクト: OPSF/uClinux
void
destroy_conn(struct conn_s *connptr)
{
	assert(connptr != NULL);

	if (connptr->client_fd != -1)
		if (close(connptr->client_fd) < 0)
			log_message(LOG_INFO, "Client (%d) close message: %s",
			            connptr->client_fd, strerror(errno));
	if (connptr->server_fd != -1)
		if (close(connptr->server_fd) < 0)
			log_message(LOG_INFO, "Server (%d) close message: %s",
				    connptr->server_fd, strerror(errno));

	if (connptr->cbuffer)
		delete_buffer(connptr->cbuffer);
	if (connptr->sbuffer)
		delete_buffer(connptr->sbuffer);

	if (connptr->request_line)
		safefree(connptr->request_line);

	if (connptr->error_variables) {
		int i;

		for (i = 0; i != connptr->error_variable_count; ++i) {
			safefree(connptr->error_variables[i]->error_key);
			safefree(connptr->error_variables[i]->error_val);
			safefree(connptr->error_variables[i]);
		}

		safefree(connptr->error_variables);
	}

	if (connptr->error_string)
		safefree(connptr->error_string);

	if (connptr->client_ip_addr)
		safefree(connptr->client_ip_addr);
	if (connptr->client_string_addr)
		safefree(connptr->client_string_addr);

	safefree(connptr);

	update_stats(STAT_CLOSE);
}
コード例 #10
0
ファイル: array.hpp プロジェクト: jonathandrnd/meld
   inline void wipeout(const vm::predicate *pred, mem::node_allocator *alloc,
                       vm::candidate_gc_nodes &gc_nodes) {
      if (!data) return;

      for (auto it(begin(pred)), e(end(pred)); it != e; ++it) {
         vm::tuple *tpl(*it);
         tpl->destructor(pred, gc_nodes);
      }
      delete_buffer(pred, (utils::byte*)data, cap, alloc);
   }
コード例 #11
0
ファイル: gtkterm.c プロジェクト: Jeija/gtkterm
int main(int argc, char *argv[])
{
	gchar *message;

	config_file = g_strdup_printf("%s/.gtktermrc", getenv("HOME"));

	bindtextdomain(PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(PACKAGE, "UTF-8");
	textdomain(PACKAGE);

	gtk_init(&argc, &argv);

	create_buffer();

	create_main_window();

	if(read_command_line(argc, argv) < 0)
	{
		delete_buffer();
		exit(1);
	}

	Config_port();

	message = get_port_string();
	Set_window_title(message);
	Set_status_message(message);
	g_free(message);

	add_shortcuts();

	set_view(ASCII_VIEW);

	gtk_main();

	delete_buffer();

	Close_port();

	return 0;
}
コード例 #12
0
ファイル: buffer.c プロジェクト: Asterios/contiki-tls-dtls
uint8_t*
init_buffer(uint16_t size)
{
  delete_buffer();
  data_buffer = (uint8_t*)malloc(size);
  if (data_buffer) {
    buffer_size = size;
  }
  buffer_index = 0;

  return data_buffer;
}
コード例 #13
0
ファイル: rtt.cpp プロジェクト: a2flo/a2elight
rtt::~rtt() {
    log_debug("deleting rtt object");

    glBindFramebuffer(GL_FRAMEBUFFER, A2E_DEFAULT_FRAMEBUFFER);

    const vector<fbo*> buffer_copy(buffers); // copy, b/c delete_buffer will operate on buffers
    for(const auto& buffer : buffer_copy) {
        delete_buffer(buffer);
    }
    buffers.clear();

    log_debug("rtt object deleted");
}
コード例 #14
0
ファイル: array.hpp プロジェクト: jonathandrnd/meld
 inline vm::tuple* expand(const vm::predicate *pred, mem::node_allocator *alloc) {
    if (num_tuples == cap) {
       if (num_tuples == 0)
          init(1, pred, alloc);
       else {
          const size_t old_cap(cap);
          utils::byte *old((utils::byte *)data);
          init(cap * 2, pred, alloc);
          memcpy(data, old, compute_size(pred, old_cap));
          delete_buffer(pred, old, old_cap, alloc);
       }
    }
    return add_next(pred);
 }
コード例 #15
0
static void
handle_incoming_data()
{
  PRINTF("Incoming packet size: %u \n", (u16_t)uip_datalen());
  if (init_buffer(COAP_DATA_BUFF_SIZE)) {
    if (uip_newdata()) {
      coap_packet_t* response = (coap_packet_t*)allocate_buffer(sizeof(coap_packet_t));
      parse_message(response, uip_appdata, uip_datalen());
      if (response) {
        response_handler(response);
      }
    }
    delete_buffer();
  }
}
コード例 #16
0
ファイル: log.cpp プロジェクト: jeffrey-lee/AppleSeed
void NLog::run()
{
    unsigned long this_diff = 0;
    unsigned long this_count = 0;

    while ( active_ )
    {
        list_head buf_list;
        INIT_LIST_HEAD( &buf_list );
        int ret = get_write_buffer_list( buf_list );
        if( ret == 0 ) {

            this_diff = msec();

            BufferNode *buffer = NULL; 
            while( !list_empty( &buf_list ) ) {
                list_head *pos = buf_list.next;
                list_del( pos );
                buffer = list_entry( pos, BufferNode, link_ );
                if( !buffer ) {
                    ERR(2)("[LOG] err!!! run invalid buffer ...");
                    continue;
                }

                this_count++;

                switch ( buffer->type ) {
                    // 控制台模式,所有的log都显示在终端
                    // 可以配置显示颜色
                    if( buffer->type == LOG_TYPE_ERROR &&  !daemon_mode_ ) {
                        FILE *file = log_[buffer->type];
                        /* 红色 */
                        char head[] = "\e[31m\e[1m";
                        char tail[] = "\e[0m";
                        fwrite( head, strlen(head), sizeof(char), file );
                        fwrite( buffer->buff, buffer->len, sizeof(char), file );
                        fwrite( tail, strlen(tail), sizeof(char), file );
                        fflush( file );
                    } else {
                        FILE *file = log_[buffer->type];
                        fwrite( buffer->buff, buffer->len, sizeof(char), file );
                        fflush( file );
                    }
                }

                delete_buffer( buffer );
            }
コード例 #17
0
  Projection const Image_processor::
  read_tiff(const std::string & name,unsigned long threshold) throw(Exception)
  {
    uint16 width,height;
    std::vector<float> data;

    TIFF* tiff = TIFFOpen((path_+name).c_str(),"r");

    if(tiff)
    {
      const unsigned short information_number = 4;
      unsigned short field = TIFFGetField(tiff,TIFFTAG_IMAGEWIDTH,&width);
      field += TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&height);
      field += TIFFGetField(tiff,TIFFTAG_SAMPLESPERPIXEL,&channel_number_);
      field += TIFFGetField(tiff,TIFFTAG_BITSPERSAMPLE,&channel_size_);

      if(field != information_number)
      
        throw(Exception
        ("image processing error : missing image information ->" + name));

      auto line_size = TIFFScanlineSize(tiff);
      buffer_ = _TIFFmalloc(line_size);
      buffer_count_ = width;

      for(uint16 row = 0 ; row < height ; ++row)
      {
        if(TIFFReadScanline(tiff,buffer_,row) == -1) 
        
          throw(Exception
          ("\nimage processing error : unknown compression scheme ->" + name));

        std::vector<float> row_data(process_buffer(threshold));
        data.insert(data.end(),row_data.begin(),row_data.end());
      }

      delete_buffer();
      TIFFClose(tiff);
    }

    else throw(Exception
    ("\nimage processing error : unknown file -> " + path_+name));

    return ct::Projection(data,width,height);
  }
コード例 #18
0
ファイル: gui_surface.cpp プロジェクト: AMD-FirePro/oclraster
gui_surface::~gui_surface() {
	delete_buffer();
	if(vbo_rectangle != nullptr) ocl->delete_buffer(vbo_rectangle);
	if(rectangle_indices != nullptr) ocl->delete_buffer(rectangle_indices);
}
コード例 #19
0
 Image_processor::~Image_processor() noexcept
 {
   delete_buffer();
 }
コード例 #20
0
ファイル: server.c プロジェクト: aephynsa/remy2015
int request_custom_command(buffer* recv_buf, server_stat* status) {
    unsigned char http_message[1000];      // used to hold http message from robot
    buffer* http_data = create_buffer(BUFFER_LEN);
    int n, retries;
    cst_header request_header;   // header from the client
    buffer* response;        // buffer to send to client
    struct timeval timeout;

    timeout.tv_sec = 0;
    timeout.tv_usec = 500000;

    fprintf(stdout, "\tProcessing request\n");

    // acknowledgement of command to client
    udp_send(recv_buf, status);

    // create the http request
    memset(http_message, '\0', 1000);
    request_header = extract_custom_header(recv_buf);
    switch (request_header.data[CST_COMMAND]) {
        case IMAGE:
            fprintf(stdout, "\t\tContacting image port\n");
            snprintf((char*)http_message, 100, "GET /snapshot?topic=/robot_%d/image?width=600?height=500 HTTP/1.1\r\n\r\n", status->r_stat.id);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, IMAGE_PORT);
            break;
        case GPS:
            fprintf(stdout, "\t\tContacting gps port\n");
            snprintf((char*)http_message, 100, "GET /state?id=%s HTTP/1.1\r\n\r\n", status->r_stat.name);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, GPS_PORT);
            break;
        case LASERS:
            fprintf(stdout, "\t\tContacting lasers port\n");
            snprintf((char*)http_message, 100, "GET /state?id=%s HTTP/1.1\r\n\r\n", status->r_stat.name);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, LASERS_PORT);
            break;
        case dGPS:
            fprintf(stdout, "\t\tContacting dgps port\n");
            snprintf((char*)http_message, 100, "GET /state?id=%s HTTP/1.1\r\n\r\n", status->r_stat.name);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, dGPS_PORT);
            break;
        case MOVE:
            fprintf(stdout, "\t\tContacting move port\n");
            snprintf((char*)http_message, 100, "GET /twist?id=%s&lx=1 HTTP/1.1\r\n\r\n", status->r_stat.name);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, GPS_PORT);
            break;
        case TURN:
            fprintf(stdout, "\t\tContacting turn port\n");
            snprintf((char*)http_message, 100, "GET /twist?id=%s&az=1 HTTP/1.1\r\n\r\n", status->r_stat.name);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, GPS_PORT);
            break;
        case STOP:
            fprintf(stdout, "\t\tContacting stop port\n");
            snprintf((char*)http_message, 100, "GET /twist?id=%s&lx=0 HTTP/1.1\r\n\r\n", status->r_stat.name);
            status->r_stat.http_sock = tcp_connect(status->r_stat.hostname, GPS_PORT);
            break;
        default:
            fprintf(stderr, "ERROR: Invalid client request\n");
            return -2;
            break;
    }

    // send the http request
    fprintf(stdout, "\t\tWriting request to server\n");
    timeout_setup(status->r_stat.http_sock, timeout);
    write(status->r_stat.http_sock, (char*)http_message, strlen((char*)http_message));

    // read http message into a buffer
    fprintf(stdout, "\t\tReceiving reply from server\n");
    memset(http_message, '\0', 1000);
    retries = 0;
    while (1) {
        n = read(status->r_stat.http_sock, (char*)http_message, 1000);
        if (n == -1) {
            if (retries > 2) {
                break;
            }
            retries++;
            write(status->r_stat.http_sock, (char*)http_message, strlen((char*)http_message));
            continue;
        } else if (n == 0) {
            break;
        }
        fprintf(stdout, "\t\t\tReceived %d bytes\n", n);
        append_buffer(http_data, (unsigned char*)http_message, n);
        memset(http_message, '\0', 1000);
    }
    fprintf(stdout, "\t\tTotal bytes received: %d\n", http_data->len);


    // see what we go
    fprintf(stdout, "\t\tAssembled Message:\n%s\n", http_data->data);

    // check for '200 OK'
    char ret_code[4];
    memcpy(ret_code, http_data->data + 9, 3); // HTTP/1.1 <ret_code> ~~~~
    ret_code[3] = '\0';
    if (atoi(ret_code) != 200) {
        fprintf(stderr, "ERROR: bad http request\n");
        response = create_custom_message(GROUP_NUMBER, status->password, HTTP_ERROR, 0, 0, 0);
        udp_send(response, status);
        return 0;
    }

    // send it to client
    int http_header_len = http_get_data(http_data->data) - http_data->data;
    int a = 0;
    while ((a + http_header_len) < http_data->len) {
        response = create_custom_message(request_header.data[CST_VERSION],
                request_header.data[CST_PASSWORD],
                request_header.data[DATA],
                request_header.data[CST_SEQUENCE],
                (http_data->len - http_header_len),
                ((http_data->len - (a + http_header_len)) > CST_MAX_PAYLOAD ? CST_MAX_PAYLOAD:(http_data->len - (a + http_header_len))));

        append_buffer(response, http_data->data + a + http_header_len, CST_MAX_PAYLOAD);
        fprintf(stdout, "\n\t\tAssembled packet:\n");
        print_header(response);
        fprintf(stdout, "%s\n", response->data + UP_HEADER_LEN);
        fprintf(stdout, "\t\tSending packet\n");
        udp_send(response, status);
        fprintf(stdout, "\t\tPacket sent\n");
        delete_buffer(response);
        a += 370;
    }
    fprintf(stdout, "\t\tRequest complete!\n");
    return 1;
}
コード例 #21
0
ファイル: gplib.c プロジェクト: jkeuffer/pari
void
pop_buffer(void)
{
  if (s_bufstack.n)
    delete_buffer( bufstack[ --s_bufstack.n ] );
}
コード例 #22
0
ファイル: conns.c プロジェクト: OPSF/uClinux
struct conn_s *
initialize_conn(int client_fd, const char* ipaddr, const char* string_addr)
{
	struct conn_s *connptr;
	struct buffer_s *cbuffer, *sbuffer;

	assert(client_fd >= 0);

	/*
	 * Allocate the memory for all the internal components
	 */
	cbuffer = new_buffer();
	sbuffer = new_buffer();

	if (!cbuffer || !sbuffer)
		goto error_exit;

	/*
	 * Allocate the space for the conn_s structure itself.
	 */
	connptr = safemalloc(sizeof(struct conn_s));
	if (!connptr)
		goto error_exit;

	connptr->client_fd = client_fd;
	connptr->server_fd = -1;

	connptr->cbuffer = cbuffer;
	connptr->sbuffer = sbuffer;

	connptr->request_line = NULL;

	/* These store any error strings */
	connptr->error_variables = NULL;
	connptr->error_variable_count = 0;
	connptr->error_string = NULL;
	connptr->error_number = -1;

	connptr->connect_method = FALSE;
	connptr->show_stats = FALSE;

	connptr->protocol.major = connptr->protocol.minor = 0;

	/* There is _no_ content length initially */
	connptr->content_length.server = connptr->content_length.client = -1;

	connptr->client_ip_addr = safestrdup(ipaddr);
	connptr->client_string_addr = safestrdup(string_addr);

	connptr->upstream_proxy = NULL;

	update_stats(STAT_OPEN);

	return connptr;

error_exit:
	/*
	 * If we got here, there was a problem allocating memory
	 */
	if (cbuffer)
		delete_buffer(cbuffer);
	if (sbuffer)
		delete_buffer(sbuffer);

	return NULL;
}
コード例 #23
0
ファイル: http-server.c プロジェクト: bipson/contiki
PROCESS_THREAD(http_server, ev, data)
{
    connection_state_t *conn_state;

    PROCESS_BEGIN();

    /* if static routes are used rather than RPL */
#if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET)
    set_global_address();
    configure_routing();
#endif /*!UIP_CONF_IPV6_RPL*/

#ifdef CONTIKI_TARGET_SKY
    PRINTF("##RF CHANNEL : %d##\n",RF_CHANNEL);
#endif //CONTIKI_TARGET_SKY

    tcp_listen(uip_htons(HTTP_PORT));

    /*
     * We loop for ever, accepting new connections.
     */
    while(1) {
        PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);

        conn_state = (connection_state_t *)data;

        if(uip_connected()) {
            PRINTF("##Connected##\n");

            if(init_buffer(HTTP_DATA_BUFF_SIZE)) {
                conn_state = (connection_state_t*)allocate_buffer(sizeof(connection_state_t));

                if (conn_state) {
                    tcp_markconn(uip_conn, conn_state);

                    /*initialize connection state*/
                    init_connection(conn_state);

                    /*-1 is needed to be able to null terminate the strings in the buffer, especially good for debugging (to have null terminated strings)*/
                    PSOCK_INIT(&(conn_state->sin), (uint8_t*)conn_state->inputbuf, sizeof(conn_state->inputbuf) - 1);
                    PSOCK_INIT(&(conn_state->sout), (uint8_t*)conn_state->inputbuf, sizeof(conn_state->inputbuf) - 1);
                    PT_INIT(&(conn_state->outputpt));

                    handle_connection(conn_state);
                } else {
                    PRINTF("Memory Alloc Error. Aborting!\n");
                    uip_abort();
                }
            }
        } else if (uip_aborted() || uip_closed() || uip_timedout()) {
            if (conn_state) {
                delete_buffer();

                /*Following 2 lines are needed since this part of code is somehow executed twice so it tries to free the same region twice.
                Potential bug in uip*/
                conn_state = NULL;
                tcp_markconn(uip_conn, conn_state);
            }
        } else {
            handle_connection(conn_state);
        }
    }

    PROCESS_END();
}
コード例 #24
0
ファイル: signpr_mean.c プロジェクト: rick/gramosplit
void
delete_simple_mean_filter (parampointer_t parampointer)
{
  delete_buffer (&parampointer->buffer);
}
コード例 #25
0
void
delete_experiment_filter (parampointer_t parampointer)
{
  delete_buffer (&parampointer->buffer);
}
コード例 #26
0
ファイル: recordvideo.C プロジェクト: knutj/cinelerra
void RecordVideo::run()
{
// Number of frames for user to know about.
	gui->reset_video();

// Wait for trigger
	trigger_lock->lock("RecordVideo::run");

	while( !done && !write_result ) {
		if( recording_paused ) {
			pause_record_lock->unlock();
			record_paused_lock->lock();
		}
		if( done ) break;
		VideoDevice *vdevice = record->vdevice;
		VFrame *capture_frame = get_buffer();
		vdevice->set_field_order(record->reverse_interlace);
// Capture a frame
		grab_result = read_buffer(capture_frame);
		if( done ) break;
		if( vdevice->config_updated() ) {
			flush_buffer();
			delete_buffer();
			config_update();
			gui->reset_video();
			record->record_monitor->reconfig();
			continue;
		}
		if( grab_result ) {
			Timer::delay(250);
			continue;
		}
		decompress_buffer(capture_frame);
		record->resync();
		write_buffer();
		if( record->monitor_video && capture_frame->get_data() )
			if( !writing_file || !record->is_behind() )
				record->record_monitor->update(capture_frame);
		if( writing_file && record->fill_underrun_frames ) {
			VFrame *last_frame = capture_frame;
			int fill = record->dropped;
			while( --fill >= 0 ) {
				capture_frame = get_buffer();
				capture_frame->copy_from(last_frame);
				last_frame = capture_frame;
				write_buffer();
			}
		}
		else
			record->written_frames += record->dropped;
		if( record->single_frame ) {
			record->single_frame = 0;
			record->stop_writing_file();
		}
		if( done ) break;
		if( !done ) done = write_result;
		if( done ) break;
		record->check_batch_complete();
	}

SET_TRACE
	flush_buffer();
	delete_buffer();
SET_TRACE
//TRACE("RecordVideo::run 2");
	if( write_result ) {
		ErrorBox error_box(PROGRAM_NAME ": Error",
			mwindow->gui->get_abs_cursor_x(1),
			mwindow->gui->get_abs_cursor_y(1));
			error_box.create_objects(_("No space left on disk."));
		error_box.run_window();
	}
SET_TRACE
}
コード例 #27
0
ファイル: signpr_mono.c プロジェクト: rick/gramosplit
void
delete_monoize_filter (parampointer_t parampointer)
{
  delete_buffer (&parampointer->buffer);
}
コード例 #28
0
ファイル: client.c プロジェクト: martinnagelberg/chatroom
void deinit_client(){

    delete_buffer(client_send_buffer);
    delete_buffer(client_recv_buffer);
    //destruir arg1 y arg2? free
}