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


C++ set_format函数代码示例

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


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

示例1: audio_open

int
audio_open (int dev, struct fileinfo *file)
{
  int             ret;
  int             bits;
  int             dev_type = dev & 0x0f;
  int             mode = file->mode & O_ACCMODE;

  dev = dev >> 4;

  if (dev_type == SND_DEV_DSP16)
    bits = 16;
  else
    bits = 8;

  if ((ret = DMAbuf_open (dev, mode)) < 0)
    return ret;

  if (audio_devs[dev]->coproc)
    if ((ret = audio_devs[dev]->coproc->
	 open (audio_devs[dev]->coproc->devc, COPR_PCM)) < 0)
      {
	audio_release (dev, file);
	printk ("Sound: Can't access coprocessor device\n");

	return ret;
      }

  local_conversion[dev] = 0;

  if (DMAbuf_ioctl (dev, SNDCTL_DSP_SETFMT, (caddr_t) bits, 1) != bits)
    {
      printk ("audio: Can't set number of bits on device %d\n", dev);
      audio_release (dev, file);
      return -(ENXIO);
    }

  if (dev_type == SND_DEV_AUDIO)
    {
      set_format (dev, AFMT_MU_LAW);
    }
  else
    set_format (dev, bits);

  audio_mode[dev] = AM_NONE;
  dev_nblock[dev] = 0;

  return ret;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:49,代码来源:audio.c

示例2: set_format

    //--------------------------------------------------------------------------
    int CLI::set_format(const std::string& f)
    {
        if (f == "Text" || f == "text")
            return set_format(MediaConchLib::format_Text);
        if (f == "XML" || f == "xml")
            return set_format(MediaConchLib::format_Xml);
        if (f == "MAXML" || f == "maxml")
            return set_format(MediaConchLib::format_MaXml);
        if (f == "JSTREE" || f == "jstree")
            return set_format(MediaConchLib::format_JsTree);
        if (f == "HTML" || f == "html")
            return set_format(MediaConchLib::format_Html);

        return -1;
    }
开发者ID:ablwr,项目名称:MediaConch_SourceCode,代码行数:16,代码来源:CLI.cpp

示例3: thread_process_message_wave_info

static int
thread_process_message_wave_info(rdpsndPlugin * plugin, char * data, int data_size)
{
	int wFormatNo;
	int error;

	if (plugin->device_plugin)
		error = plugin->device_plugin->open(plugin->device_plugin);
	else
		error = 1;

	plugin->wTimeStamp = GET_UINT16(data, 0); /* time in ms */
	plugin->local_time_stamp = get_mstime(); /* time in ms */
	wFormatNo = GET_UINT16(data, 2);
	LLOGLN(10, ("thread_process_message_wave_info: data_size %d "
		"wFormatNo %d", data_size, wFormatNo));
	plugin->cBlockNo = GET_UINT8(data, 4);
	plugin->waveDataSize = data_size - 8;
	memcpy(plugin->waveData, data + 8, 4);
	if (wFormatNo != plugin->current_format && !error)
	{
		plugin->current_format = wFormatNo;
		set_format(plugin);
	}
	plugin->expectingWave = 1;
	return error;
}
开发者ID:alama,项目名称:freerdp,代码行数:27,代码来源:rdpsnd_main.c

示例4: load_driver_devices

static HRESULT load_driver_devices(EDataFlow flow)
{
    WCHAR **ids;
    GUID *guids;
    UINT num, def, i;
    HRESULT hr;

    if(!drvs.pGetEndpointIDs)
        return S_OK;

    hr = drvs.pGetEndpointIDs(flow, &ids, &guids, &num, &def);
    if(FAILED(hr))
        return hr;

    for(i = 0; i < num; ++i){
        MMDevice *dev;
        dev = MMDevice_Create(ids[i], &guids[i], flow, DEVICE_STATE_ACTIVE,
                def == i);
        set_format(dev);
    }

    HeapFree(GetProcessHeap(), 0, guids);
    HeapFree(GetProcessHeap(), 0, ids);

    return S_OK;
}
开发者ID:reactos,项目名称:reactos,代码行数:26,代码来源:devenum.c

示例5: set_format

void LogManager::initDefaultConsoleLogger() {

    default_console_appender_->setName(WIND_LOG_TEXT("default_console_appender"));
    set_format(default_console_appender_, default_console_format_);
    default_console_logger_.addAppender(default_console_appender_);
    default_console_logger_.setLogLevel(LogLevel::Trace);
}
开发者ID:askforwind,项目名称:swordGL,代码行数:7,代码来源:LogManager.cpp

示例6: init_device

void init_device()
{
	set_format();
	request_buffer();
	query_buf_and_mmap();
	queue_buffer();
}
开发者ID:ShiHong-Zhang,项目名称:lmts-gtk,代码行数:7,代码来源:webcam.c

示例7: LOG_WARNING

    std::shared_ptr<stream_profile_interface> software_sensor::add_video_stream(rs2_video_stream video_stream)
    {
        auto exist = (std::find_if(_profiles.begin(), _profiles.end(), [&](std::shared_ptr<stream_profile_interface> profile)
        {
            if (profile->get_unique_id() == video_stream.uid)
            {
                return true;
            }
            return false;
        } ) != _profiles.end());

        if (exist)
        {
            LOG_WARNING("Stream unique ID already exist!");
            throw rs2::error("Stream unique ID already exist!");
        }

        auto profile = std::make_shared<video_stream_profile>(
            platform::stream_profile{ (uint32_t)video_stream.width, (uint32_t)video_stream.height, (uint32_t)video_stream.fps, 0 });
        profile->set_dims(video_stream.width, video_stream.height);
        profile->set_format(video_stream.fmt);
        profile->set_framerate(video_stream.fps);
        profile->set_stream_index(video_stream.index);
        profile->set_stream_type(video_stream.type);
        profile->set_unique_id(video_stream.uid);
        profile->set_intrinsics([=]() {return video_stream.intrinsics; });
        _profiles.push_back(profile);

        return profile;
    }
开发者ID:OakwoodAI,项目名称:librealsense,代码行数:30,代码来源:software-device.cpp

示例8: throw

/// Initializes the empty object. \p operation is the function that returned the error code.
libc_exception::libc_exception (const char* operation) throw()
: exception(),
  m_Errno (errno),
  m_Operation (operation)
{
    set_format (xfmt_LibcException);
}
开发者ID:embarkmobile,项目名称:ustl-symbian,代码行数:8,代码来源:uexception.cpp

示例9: set_layout

static void
set_layout(GnmStyle * style,const psiconv_sheet_cell_layout psi_layout)
{
	GnmColor *color;

	set_format(style,psi_layout->numberformat);
	gnm_style_set_font_size(style,psi_layout->character->font_size);
	gnm_style_set_font_italic(style,psi_layout->character->italic?TRUE:FALSE);
	gnm_style_set_font_bold(style,psi_layout->character->bold?TRUE:FALSE);
	gnm_style_set_font_uline(style,
	                      psi_layout->character->underline?TRUE:FALSE);
	gnm_style_set_font_strike(style,
	                       psi_layout->character->strikethrough?TRUE:FALSE);
	gnm_style_set_font_name(style,
			     (const char *) psi_layout->character->font->name);
	color = get_color(psi_layout->character->color);
	if (color)
		gnm_style_set_font_color (style, color);
	/* TODO: Character level layouts: super_sub */
	/* TODO: Paragraph level layouts: all */
	/* TODO: Background color: add transparant if white */
#if 0
	color = get_color(psi_layout->paragraph->back_color);
	if (color) {
		gnm_style_set_back_color(style, color);
		gnm_style_set_pattern_color(style, color);
		/* TODO: Replace 24 with some symbol */
		gnm_style_set_pattern(style,1);
	}
#endif
}
开发者ID:UIKit0,项目名称:gnumeric,代码行数:31,代码来源:psiconv-read.c

示例10: vertex_size_

Mesh::Mesh(const void *vertex_data, int count, int vertex_size,
           const Attribute *format, vec3 *max_position, vec3 *min_position)
    : vertex_size_(vertex_size),
      bone_transforms_(nullptr),
      bone_global_transforms_(nullptr) {
  set_format(format);
  GL_CALL(glGenBuffers(1, &vbo_));
  GL_CALL(glBindBuffer(GL_ARRAY_BUFFER, vbo_));
  GL_CALL(glBufferData(GL_ARRAY_BUFFER, count * vertex_size, vertex_data,
                       GL_STATIC_DRAW));

  // Determine the min and max position
  if (max_position && min_position) {
    max_position_ = *max_position;
    min_position_ = *min_position;
  } else {
    auto data = static_cast<const float *>(vertex_data);
    const Attribute *attribute = format;
    data += VertexSize(attribute, kPosition3f) / sizeof(float);
    int step = vertex_size / sizeof(float);
    min_position_ = vec3(data);
    max_position_ = min_position_;
    for (int vertex = 1; vertex < count; vertex++) {
      data += step;
      min_position_ = vec3::Min(min_position_, vec3(data));
      max_position_ = vec3::Max(max_position_, vec3(data));
    }
  }
}
开发者ID:ezhangle,项目名称:fplbase,代码行数:29,代码来源:mesh.cpp

示例11: LOG_WARNING

    std::shared_ptr<stream_profile_interface> software_sensor::add_motion_stream(rs2_motion_stream motion_stream)
    {
        auto exist = (std::find_if(_profiles.begin(), _profiles.end(), [&](std::shared_ptr<stream_profile_interface> profile)
        {
            return profile->get_unique_id() == motion_stream.uid;
        }) != _profiles.end());

        if (exist)
        {
            LOG_WARNING("Motion stream unique ID already exist!");
            throw rs2::error("Stream unique ID already exist!");
        }

        auto profile = std::make_shared<motion_stream_profile>(
            platform::stream_profile{ 0, 0, (uint32_t)motion_stream.fps, 0 });
        profile->set_format(motion_stream.fmt);
        profile->set_framerate(motion_stream.fps);
        profile->set_stream_index(motion_stream.index);
        profile->set_stream_type(motion_stream.type);
        profile->set_unique_id(motion_stream.uid);
        profile->set_intrinsics([=]() {return motion_stream.intrinsics; });
        _profiles.push_back(profile);

        return profile;
    }
开发者ID:UnaNancyOwen,项目名称:librealsense,代码行数:25,代码来源:software-device.cpp

示例12: open_audio_out

static void open_audio_out()
{
  int fd;
  int flags = O_WRONLY;
  if( nonblock )
  {
    flags |= O_NONBLOCK;
  }
  fd = open("/dev/dsp", flags, 0777);
  if( fd < 0 )
  {
    perror("open dsp");
  }
  else
  {
    int setting, result;

    ioctl(fd, SNDCTL_DSP_RESET);
    setting = 0x00040009;
    result = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &setting);
    if( result )
    {
      perror("ioctl(SNDCTL_DSP_SETFRAGMENT)");
    }
    set_format(fd, 0x10, 2, rate);

    fdw = fd;
  }
}
开发者ID:jinxinzheng,项目名称:GSConferencing,代码行数:29,代码来源:netplay.c

示例13: main

int
main (int argc,
      char *argv[])
{
   unicap_handle_t handle;
   unicap_format_t format;
   
   /* Initialize */
   gtk_init (&argc, &argv);
   g_thread_init(NULL);
   gdk_threads_init ();
   gtk_gl_init (&argc, &argv);
   init_extensions ();
   init_gl_resources ();

   handle = open_device();
   set_format( handle );
   unicap_get_format( handle, &format );
   if( ( format.size.width != 640 ) ||
       ( format.size.height != 480 ) )
   {
      g_warning( "The default .cg file assumes a video format of 640x480 pixels. \nYou need to change the yuv.cg file to match your size.\n" );
   }
   
   prepare_yuv_buffer(&yuvbuffer, &format);
   unicap_register_callback( handle, UNICAP_EVENT_NEW_FRAME, (unicap_callback_t)new_frame_cb, NULL ); 
   unicap_start_capture( handle );
   

   /* Gtk window & container */
   GtkWindow *window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
   glarea = gtk_drawing_area_new ();
   gtk_widget_set_size_request (GTK_WIDGET (glarea), WINDOW_WIDTH, WINDOW_HEIGHT);
   g_signal_connect (glarea, "expose-event", G_CALLBACK (on_expose), NULL);
   g_signal_connect (glarea, "configure-event", G_CALLBACK (on_configure), NULL);
   g_signal_connect (glarea, "map-event", G_CALLBACK (on_mapped), NULL);
   g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL);

   GdkGLConfig *gl_config;
   gl_config = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGBA | GDK_GL_MODE_DOUBLE);

   if (gl_config == NULL) 
      g_critical ("Failed to setup a double-buffered RGB visual");

   if (! gtk_widget_set_gl_capability (GTK_WIDGET (glarea), 
				       gl_config,
				       NULL,
				       TRUE,
				       GDK_GL_RGBA_TYPE))
      g_critical ("Failed to add gl capability");

   gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (glarea));
   gtk_widget_show_all (GTK_WIDGET (window));


   /* Main loop */
   gtk_main ();
   return 0;
}
开发者ID:fabienchateau,项目名称:CCV-Calibrage-rond,代码行数:59,代码来源:gl-video.c

示例14: sscape_audio_ioctl

static int
sscape_audio_ioctl(int dev, u_int cmd, ioctl_arg arg, int local)
{
    sscape_info    *devc = (sscape_info *) audio_devs[dev]->devc;

    switch (cmd) {
    case SOUND_PCM_WRITE_RATE:
	if (local)
	    return set_speed(devc, (int) arg);
	return *(int *) arg = set_speed(devc, (*(int *) arg));

    case SOUND_PCM_READ_RATE:
	if (local)
	    return 8000;
	return *(int *) arg = 8000;

    case SNDCTL_DSP_STEREO:
	if (local)
	    return set_channels(devc, (int) arg + 1) - 1;
	return *(int *) arg = set_channels(devc, (*(int *) arg) + 1) - 1;

    case SOUND_PCM_WRITE_CHANNELS:
	if (local)
	    return set_channels(devc, (int) arg);
	return *(int *) arg = set_channels(devc, (*(int *) arg));

    case SOUND_PCM_READ_CHANNELS:
	if (local)
	    return 1;
	return *(int *) arg = 1;

    case SNDCTL_DSP_SAMPLESIZE:
	if (local)
	    return set_format(devc, (int) arg);
	return *(int *) arg = set_format(devc, (*(int *) arg));

    case SOUND_PCM_READ_BITS:
	if (local)
	    return 8;
	return *(int *) arg = 8;

    default:;
    }
    return -(EINVAL);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:45,代码来源:sscape.c

示例15: current_locale

void number_formatter_platform_data_t::monitor_locale(const dictionary_t&)
{
    auto_locale_t current_locale(::CFLocaleCopyCurrent());
    std::string   num_format_save(get_format());

    formatter_m.reset(::CFNumberFormatterCreate(NULL, current_locale.get(), kCFNumberFormatterNoStyle));

    set_format(num_format_save);
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:9,代码来源:platform_number_formatter_data.cpp


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