当前位置: 首页>>代码示例>>C++>>正文


C++ printke函数代码示例

本文整理汇总了C++中printke函数的典型用法代码示例。如果您正苦于以下问题:C++ printke函数的具体用法?C++ printke怎么用?C++ printke使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了printke函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: kr_mkv_check_ebml_header

static int kr_mkv_check_ebml_header (kr_mkv_t *mkv) {

  char doctype[64];
  uint32_t version;
  uint32_t read_version;
  

  if (0 > kr_ebml2_unpack_header (mkv->e, doctype, 64,
                                  &version, &read_version)) {
    printke ("Could not read EBML header");
    return -1;                            
  }

  if ((strncmp(doctype, "webm", 4) != 0) &&
      (strncmp(doctype, "matroska", 8) != 0)) {
    printke ("Invalid Doctype: %s", doctype);
    return -1;      
  }
  
  if ((version < 2) || (version > 4) ||
      (read_version < 2) || (read_version > 4)) {
    printke ("Crazy Version Number: %u - %u",
              version, read_version);
    return -1;
  }

  printk ("Got EBML doctype: %s Version %u Read Version %u",
          doctype, version, read_version);

  return 0;
}
开发者ID:brooss,项目名称:krcam,代码行数:31,代码来源:krad_mkv_demux.c

示例2: krad_system_set_thread_name

void *kr_audioport_process_thread (void *arg) {

  kr_audioport_t *kr_audioport = (kr_audioport_t *)arg;
  int ret;
  char buf[1];
  
  krad_system_set_thread_name ("krc_audioport");

  while (kr_audioport->active == 1) {
  
    // wait for socket to have a byte
    ret = read (kr_audioport->sd, buf, 1);
    if (ret != 1) {
      printke ("krad mixer client: unexpected read return value %d in kr_audioport_process_thread", ret);
    }
    //kr_audioport->callback (kr_audioport->kr_shm->buffer, kr_audioport->pointer);
    kr_audioport->callback (1600, kr_audioport->pointer);

    // write a byte to socket
    ret = write (kr_audioport->sd, buf, 1);
    if (ret != 1) {
      printke ("krad mixer client: unexpected write return value %d in kr_audioport_process_thread", ret);
    }

  }

  return NULL;
}
开发者ID:imclab,项目名称:krad_radio,代码行数:28,代码来源:krad_mixer_client.c

示例3: kr_mkv_parse_tracks

static int kr_mkv_parse_tracks (kr_mkv_t *mkv, uint64_t max_pos) {

  int ret;
  uint32_t id;
  uint64_t size;

  while (1) {
    if (mkv->e->pos >= max_pos) {
      printk ("Got to end of tracks info");
      break;
    }  
    ret = kr_ebml2_unpack_id (mkv->e, &id, &size);
    if (ret < 0) {
      printke ("Read error...");
      return -1;
    }
    if ((id == MKV_CLUSTER) || (id == EID_VOID) ||
        (id == EID_CRC32) || (id == MKV_TAGS) || (id == MKV_CUES) ||
        (id == MKV_ATTACHMENTS) || (id == MKV_CHAPTERS)) {
      printk ("Done with tracks. Got %d", mkv->track_count);
      return 0;
    }
    if (id != MKV_TRACK) {
      printke ("No Track :/");
      return -1;
    }
    printk ("Got Track!");
    ret = kr_mkv_parse_track (mkv, mkv->e->pos + size);
    if (ret < 0) {
      printke ("Track parse error...");
      return -1;
    }
  }
  return 0;
}
开发者ID:brooss,项目名称:krcam,代码行数:35,代码来源:krad_mkv_demux.c

示例4: kr_vorbis_encode

int32_t kr_vorbis_encode (krad_vorbis_t *vorbis,
                          kr_codeme_t *codeme,
                          kr_medium_t *medium) {
  int32_t bo_ret;
  int32_t ret;
  int c;
  float **pcm;
  ogg_packet op;

  if (medium != NULL) {
    if (medium->a.count > 0) {
      pcm = vorbis_analysis_buffer (&vorbis->vdsp, medium->a.count);
      for (c = 0; c < vorbis->channels; c++) {
        memcpy (pcm[c], medium->a.samples[c], medium->a.count * 4);
      }
    } else {
      printk ("KR Vorbis Encoder: Got finish notice");
    }
    ret = vorbis_analysis_wrote (&vorbis->vdsp, medium->a.count);
    if (ret < 0) {
      vorbis->error = ret;
      vorbis->state_str = "Krad Vorbis Encoder: vorbis_analysis_wrote fail";
      printke (vorbis->state_str);
      return -1;
    }
    //printk ("KR Vorbis Encoder: wrote %d samples", medium->a.count);
  }

  bo_ret = vorbis_analysis_blockout (&vorbis->vdsp, &vorbis->vblock);
  if (bo_ret < 0) {
    vorbis->error = bo_ret;
    vorbis->state_str = "Krad Vorbis Encoder: vorbis_analysis_blockout fail";
    printke (vorbis->state_str);
    return -1;
  }
  if (bo_ret == 1) {
    ret = vorbis_analysis (&vorbis->vblock, &op);
    if (ret < 0) {
      vorbis->error = ret;
      vorbis->state_str = "Krad Vorbis Encoder: vorbis_analysis fail";
      printke (vorbis->state_str);
      return -1;
    }
    //printk ("KR Vorbis Encoder: op gpos: %"PRIi64" size %ld",
    //        op.granulepos, op.bytes);
    codeme->sz = op.bytes;
    codeme->count = op.granulepos - vorbis->frames;
    vorbis->frames = op.granulepos;

    memcpy (codeme->data, op.packet, codeme->sz);

    //printk ("KR Vorbis Encoder: codeme size: %zu Count: %d",
    //        codeme->sz, codeme->count);
  }

  return bo_ret;
}
开发者ID:kripton,项目名称:krad_radio-1,代码行数:57,代码来源:krad_vorbis.c

示例5: krad_transmitter_transmission_transmit_header

int krad_transmitter_transmission_transmit_header (krad_transmission_t *krad_transmission,
											krad_transmission_receiver_t *krad_transmission_receiver) {

  int wrote;

  wrote = 0;

  while (krad_transmission_receiver->wrote_http_header == 0) {
	  wrote = write (krad_transmission_receiver->fd,
				   krad_transmission->http_header + krad_transmission_receiver->http_header_position,
				   krad_transmission->http_header_len - krad_transmission_receiver->http_header_position);

    if (wrote > 0) {
      krad_transmission_receiver->http_header_position += wrote;
	    if (krad_transmission_receiver->http_header_position == krad_transmission->http_header_len) {
		    krad_transmission_receiver->wrote_http_header = 1;
	    } else {
        return 0;
      }
    } else {
		  if (wrote == -1) {
			  if (errno != EAGAIN) {
				  printke ("Krad Transmitter: transmission error writing to socket");
				  krad_transmitter_receiver_destroy (krad_transmission_receiver);
			  }
      }
      return 0;
    }
  }

  while (krad_transmission_receiver->wrote_header == 0) {
	  wrote = write (krad_transmission_receiver->fd,
				   krad_transmission->header + krad_transmission_receiver->header_position,
				   krad_transmission->header_len - krad_transmission_receiver->header_position);

    if (wrote > 0) {
      krad_transmission_receiver->header_position += wrote;
	    if (krad_transmission_receiver->header_position == krad_transmission->header_len) {
		    krad_transmission_receiver->wrote_header = 1;
	    } else {
        return 0;
      }
    } else {
		  if (wrote == -1) {
			  if (errno != EAGAIN) {
				  printke ("Krad Transmitter: transmission error writing to socket");
				  krad_transmitter_receiver_destroy (krad_transmission_receiver);
			  }
      }
      return 0;
    }
  }

  krad_transmission_receiver->position = krad_transmission->sync_point;
  return 1;

}
开发者ID:bawNg,项目名称:krad_radio,代码行数:57,代码来源:krad_transmitter.c

示例6: krad_vpx_fail

static void krad_vpx_fail (vpx_codec_ctx_t *ctx, const char *s) {
    
    const char *detail = vpx_codec_error_detail(ctx);
    
    printke ("%s: %s\n", s, vpx_codec_error(ctx));

	if (detail) {
    	printke ("%s\n", detail);
	}

    failfast ("");
}
开发者ID:imclab,项目名称:krad_radio,代码行数:12,代码来源:krad_vpx.c

示例7: marlin_priv_cmd

int marlin_priv_cmd(struct net_device *ndev, struct ifreq *ifr)
{
	struct wlan_vif_t *vif;
	struct android_wifi_priv_cmd priv_cmd;
	char *command = NULL;
	u8 addr[ETH_ALEN] = {0};
	int bytes_written = 0;
	int ret = 0;

	vif =  ndev_to_vif(ndev);
	if (!ifr->ifr_data)
		return -EINVAL;
	if (copy_from_user(&priv_cmd, ifr->ifr_data,
			   sizeof(struct android_wifi_priv_cmd)))
		return -EFAULT;

	command = kmalloc(priv_cmd.total_len, GFP_KERNEL);
	if (!command) {
		printke("%s: Failed to allocate command!\n", __func__);
		return -ENOMEM;
	}
	if (copy_from_user(command, priv_cmd.buf, priv_cmd.total_len)) {
		ret = -EFAULT;
		goto exit;
	}

	if (strnicmp(command, CMD_BLACKLIST_ENABLE,
		     strlen(CMD_BLACKLIST_ENABLE)) == 0) {
		int skip = strlen(CMD_BLACKLIST_ENABLE) + 1;

		printke("%s, Received regular blacklist enable command\n",
			 __func__);
		sscanf(command + skip, "" MACSTR "", STR2MAC(addr));
		bytes_written = wlan_cmd_add_blacklist(vif, addr);
	} else if (strnicmp(command, CMD_BLACKLIST_DISABLE,
			    strlen(CMD_BLACKLIST_DISABLE)) == 0) {
		int skip = strlen(CMD_BLACKLIST_DISABLE) + 1;

		printke("%s, Received regular blacklist disable command\n",
			   __func__);
		sscanf(command + skip, "" MACSTR "", STR2MAC(addr));
		bytes_written = wlan_cmd_del_blacklist(vif, addr);
	}

	if (bytes_written < 0)
		ret = bytes_written;

exit:
	kfree(command);

	return ret;
}
开发者ID:ShinySide,项目名称:SM-G361H,代码行数:52,代码来源:wlan_core.c

示例8: wlan_rx_process

static int wlan_rx_process(unsigned char *buf, unsigned int max_len)
{
	static unsigned int cnt;
	static unsigned int skb;
	unsigned int p = 0;
	r_msg_hdr_t *msg = NULL;
	unsigned char vif_id;
	unsigned char *pData = NULL;
	unsigned short len;
	unsigned char event;
	if ((NULL == buf) || (0 == max_len)) {
		printke("[%s][ERROR]\n", __func__);
		return OK;
	}
	buf = buf + 8;
	msg = (r_msg_hdr_t *) (buf);
	max_len = max_len - 8;
	while (p < max_len) {

		vif_id = msg->mode;
		pData = (unsigned char *)(msg + 1);
		len = msg->len;

		if ((0xFF == msg->type) || (0xFF == msg->subtype))
			break;
		if (HOST_SC2331_PKT == msg->type) {
			pData = pData + msg->subtype;
			len = len - msg->subtype;
			wlan_rx_skb_process(vif_id, pData, len);
		} else if (HOST_SC2331_WAPI == msg->type) {
			wlan_rx_wapi_process(vif_id, pData, len);
		} else if (SC2331_HOST_RSP == msg->type) {
			wlan_rx_rsp_process(vif_id, msg);
		} else if (HOST_SC2331_CMD == msg->type) {
			event = msg->subtype;
			wlan_rx_event_process(vif_id, event, pData, len);
		} else {
			printke("[%s][RX DATA ERR]\n", __func__);
			break;
		}
		p = p + sizeof(t_msg_hdr_t) + ALIGN_4BYTE(msg->len);
		msg = (r_msg_hdr_t *) (buf + p);
		skb++;
	}
	cnt++;
	if (1000 == cnt) {
		printkd("r%d\n", skb);
		cnt = 0;
		skb = 0;
	}
	return OK;
}
开发者ID:ShinySide,项目名称:SM-G361H,代码行数:52,代码来源:wlan_core.c

示例9: kr_interweb_server_socket_setup

static int kr_interweb_server_socket_setup(char *interface, int port) {

    char port_string[6];
    struct addrinfo hints;
    struct addrinfo *result, *rp;
    int s;
    int sfd = 0;
    char *interface_actual;

    interface_actual = interface;

    printk ("Krad Interweb Server: interface: %s port %d", interface, port);
    snprintf (port_string, 6, "%d", port);
    memset (&hints, 0, sizeof (struct addrinfo));
    hints.ai_family = AF_UNSPEC;     /* Return IPv4 and IPv6 choices */
    hints.ai_socktype = SOCK_STREAM; /* We want a TCP socket */
    hints.ai_flags = AI_PASSIVE;     /* All interfaces */
    if ((strlen(interface) == 7) && (strncmp(interface, "0.0.0.0", 7) == 0)) {
        hints.ai_family = AF_INET;
        interface_actual = NULL;
    }
    if ((strlen(interface) == 4) && (strncmp(interface, "[::]", 4) == 0)) {
        hints.ai_family = AF_INET6;
        interface_actual = NULL;
    }
    s = getaddrinfo (interface_actual, port_string, &hints, &result);
    if (s != 0) {
        printke ("getaddrinfo: %s\n", gai_strerror (s));
        return -1;
    }
    for (rp = result; rp != NULL; rp = rp->ai_next) {
        sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
        if (sfd == -1) {
            continue;
        }
        set_socket_reuseaddr(sfd);
        s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
        if (s == 0) {
            /* We managed to bind successfully! */
            break;
        }
        close (sfd);
    }
    if (rp == NULL) {
        printke ("Could not bind %d\n", port);
        return -1;
    }
    freeaddrinfo (result);

    return sfd;
}
开发者ID:kripton,项目名称:krad_radio-1,代码行数:51,代码来源:socket.c

示例10: kr_mkv_parse_segment_header

static int kr_mkv_parse_segment_header (kr_mkv_t *mkv) {

  int ret;
  uint32_t id;
  uint64_t size;

  ret = kr_ebml2_unpack_id (mkv->e, &id, &size);
  if (ret < 0) {
    printke ("Read error...");
    return -1;
  }
  if (id != MKV_SEGMENT) {
    printke ("No Segment :/");
    return -1;
  }
  
  printk ("Got Segment");

  while (1) {
  
    ret = kr_ebml2_unpack_id (mkv->e, &id, &size);
    if (ret < 0) {
      printke ("Read error..");
      return -1;
    }

    switch (id) {
      case MKV_TRACKS:
        mkv->tracks_info_data = mkv->e->bufstart + mkv->e->pos;
        mkv->tracks_info_data_size = size;
        if (kr_mkv_parse_tracks (mkv, mkv->e->pos + size) < 0) {
          return -1;
        } else {
          return 0;
        }
      case MKV_SEGMENT_INFO:
        mkv->segment_info_data = mkv->e->bufstart + mkv->e->pos;
        mkv->segment_info_data_size = size;
        printk ("Got Segment Info: %"PRIu64" bytes", size);
        if (kr_mkv_parse_segment_info (mkv, mkv->e->pos + size) < 0) {
          return -1;
        }
        break;        
      default:
        printk ("Skipping unknown element: %"PRIu64" bytes", size);
        kr_ebml2_advance (mkv->e, size);
        break;
    }
  }
  return 0;
}
开发者ID:brooss,项目名称:krcam,代码行数:51,代码来源:krad_mkv_demux.c

示例11: krad_ipc_server_tcp_socket_create

int krad_ipc_server_tcp_socket_create (int port) {

	char port_string[6];
	struct addrinfo hints;
	struct addrinfo *result, *rp;
	int s;
	int sfd = 0;

	snprintf (port_string, 6, "%d", port);

	memset (&hints, 0, sizeof (struct addrinfo));
	hints.ai_family = AF_UNSPEC;     /* Return IPv4 and IPv6 choices */
	hints.ai_socktype = SOCK_STREAM; /* We want a TCP socket */
	hints.ai_flags = AI_PASSIVE;     /* All interfaces */

	s = getaddrinfo (NULL, port_string, &hints, &result);
	if (s != 0) {
		printke ("getaddrinfo: %s\n", gai_strerror (s));
		return -1;
	}

	for (rp = result; rp != NULL; rp = rp->ai_next) {
		
		sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
		
		if (sfd == -1) {
			continue;
		}

		s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
		
		if (s == 0) {
			/* We managed to bind successfully! */
			break;
		}

		close (sfd);
	}

	if (rp == NULL) {
		printke ("Could not bind %d\n", port);
		return -1;
	}

	freeaddrinfo (result);

	return sfd;
}
开发者ID:bawNg,项目名称:krad_radio,代码行数:48,代码来源:krad_ipc_server.c

示例12: hw_tx

static int hw_tx(const unsigned short chn, unsigned char *buf, unsigned int len)
{
	int ret;
	static unsigned int cnt;
	static unsigned int skb;
	tx_big_hdr_t *big_hdr;

	big_hdr = (tx_big_hdr_t *) buf;
	if ((PKT_AGGR_NUM < big_hdr->msg_num) || (0 == big_hdr->msg_num)) {
		ASSERT();
		return ERROR;
	}
	big_hdr->tx_cnt = g_wlan.hw.tx_cnt;
	printkp("[tx][%d][%d]\n", big_hdr->tx_cnt, chn);
	len = (len + 1023) & 0xFC00;
	wlan_tx_buf_decode(buf, len);
	ret = sdio_dev_write(chn, buf, len);
	if (0 != ret) {
		printke("call sdio_dev_write err:%d\n", ret);
		return HW_WRITE_ERROR;
	}
	skb = skb + big_hdr->msg_num;
	cnt++;
	if (1000 == cnt) {
		printkd("w%d\n", skb);
		cnt = 0;
		skb = 0;
	}
	g_wlan.hw.tx_cnt++;
	return OK;
}
开发者ID:ShinySide,项目名称:SM-G361H,代码行数:31,代码来源:wlan_core.c

示例13: kr_io2_output

int kr_io2_output(kr_io2_t *io) {

  ssize_t ret;

  if (!kr_io2_want_out(io)) {
    return 0;
  }
  ret = kr_io2_write(io);

  //printk("kr_io2_output wrote: %zu old len: %zu new len: %zu",
  //       ret, io->len, io->len - ret);


  if (ret != io->len) {
	  if (ret < 1) {
      	printke("its bad we should certainly fail, ret %zu len %zu",
         ret, io->len);
      	return ret;
	  } else {
	    io->len -= ret;
	    io->wr_buf += ret;		
	  }
	  return 0;
  }
  kr_io2_restart(io);
  return 0;
}
开发者ID:dsheeler,项目名称:krad_radio,代码行数:27,代码来源:krad_io2.c

示例14: krad_opus_decoder_write

int krad_opus_decoder_write (krad_opus_t *krad_opus,
                             uint8_t *buffer,
                             int length) {

  int i;
  int frames_decoded;

  frames_decoded = 0;

  krad_opus->opus_decoder_error = opus_multistream_decode_float (krad_opus->decoder,
                                  buffer,
                                  length,
                                  krad_opus->interleaved_samples,
                                  2880 * 2,
                                  0);

  if (krad_opus->opus_decoder_error < 0) {
    printke ("Krad Opus decoder error: %s\n",
              opus_strerror (krad_opus->opus_decoder_error));
  } else {
    frames_decoded = krad_opus->opus_decoder_error;
  }

  for (i = 0; i < frames_decoded; i++) {
    krad_opus->samples[0][i] = krad_opus->interleaved_samples[i * 2 + 0];
    krad_opus->samples[1][i] = krad_opus->interleaved_samples[i * 2 + 1];
  }

  krad_ringbuffer_write (krad_opus->ringbuf[0], (char *)krad_opus->samples[0], (frames_decoded * 4) );
  krad_ringbuffer_write (krad_opus->ringbuf[1], (char *)krad_opus->samples[1], (frames_decoded * 4) );

  return 0;
}
开发者ID:kripton,项目名称:krad_radio-1,代码行数:33,代码来源:krad_opus.c

示例15: calloc

kr_app_client *kr_app_connect(char *sysname, int timeout_ms) {
  kr_app_client *client;
  client = calloc(1, sizeof(kr_app_client));
  if (client == NULL) {
    failfast("Krad APP Client mem alloc fail");
    return NULL;
  }
  uname (&client->unixname);
  if (krad_valid_host_and_port (sysname)) {
    krad_get_host_and_port (sysname, client->host, &client->tcp_port);
  } else {
    strncpy (client->sysname, sysname, sizeof (client->sysname));
    if (strncmp(client->unixname.sysname, "Linux", 5) == 0) {
      client->on_linux = 1;
      client->api_path_pos = sprintf(client->api_path, "@krad_radio_%s_api", sysname);
    } else {
      client->api_path_pos = sprintf(client->api_path, "%s/krad_radio_%s_api", "/tmp", sysname);
    }
    if (!client->on_linux) {
      if(stat(client->api_path, &client->info) != 0) {
        kr_app_disconnect(client);
        failfast ("Krad APP Client: API PATH Failure\n");
        return NULL;
      }
    }
  }
  if (kr_app_client_init(client, timeout_ms) == 0) {
    printke ("Krad APP Client: Failed to init!");
    kr_app_disconnect(client);
    return NULL;
  }
  return client;
}
开发者ID:kripton,项目名称:krad_radio-1,代码行数:33,代码来源:krad_app_client.c


注:本文中的printke函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。