• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ slog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: do_packet

static void
do_packet(connection_t *cptr, char *buf)
{
        char *ptr, buf2[BUFSIZE * 2];
        static char tmp[BUFSIZE * 2 + 1];

        while ((ptr = strchr(buf, '\n')))
        {
                snprintf(buf2, (BUFSIZE * 2), "%s%s", tmp, buf);
                *tmp = '\0';

		slog(LG_DEBUG, "-{incoming}-> %s", buf2);
		sendq_add(cptr, buf2, strlen(buf2));

                buf = ptr + 1;
        }

        if (*buf)
        {
                mowgli_strlcpy(tmp, buf, BUFSIZE * 2);
                tmp[BUFSIZE * 2] = '\0';
        }
}
开发者ID:atheme,项目名称:atheme-contrib-modules,代码行数:23,代码来源:gen_echoserver.c


示例2: susb_handle_event

static void susb_handle_event(struct aura_node *node, enum node_event evt, const struct aura_pollfds *fd)
{
	struct aura_buffer *buf;
	struct usb_dev_info *inf = aura_get_transportdata(node);

	ncusb_handle_events_nonblock_once(node, inf->ctx, inf->timer);

	if (inf->cbusy)
		return;

	if (evt == NODE_EVENT_STARTED) {
		aura_etable_activate(inf->etbl);
		/* Activate our export table
		 * Hack: Since libusb tends to send and receive data in one buffer,
		 * we need to adjust argument buffer to fit in return values as well.
		 * It helps us to avoid needless copying.
		 */
		int i;
		for (i = 0; i < inf->etbl->next; i++) {
			struct aura_object *tmp;
			tmp = &inf->etbl->objects[i];
			tmp->arglen += tmp->retlen;
		}
		inf->etbl = NULL;
		ncusb_watch_for_device(inf->ctx, &inf->dev_descr);
		ncusb_start_descriptor_watching(node, inf->ctx);
		slog(1, SLOG_INFO, "usb: Now looking for a device %x:%x %s/%s/%s",
		     inf->dev_descr.vid, inf->dev_descr.pid,
		     inf->dev_descr.vendor, inf->dev_descr.product, inf->dev_descr.serial);
	} else if (inf->state == SUSB_DEVICE_RESTART) {
		susb_offline_transport(inf);
	} else if (inf->state == SUSB_DEVICE_OPERATIONAL) {
		buf = aura_peek_buffer(&node->outbound_buffers);
		if (buf)
			susb_issue_call(node, buf);
	}
}
开发者ID:nekromant,项目名称:aura,代码行数:37,代码来源:transport-susb.c


示例3: usb_start_ops

static int usb_start_ops(struct libusb_device_handle *hndl, void *arg)
{
	/* FixMe: Reading descriptors is synchronos. This is not needed
	 * often, but leaves a possibility of a flaky usb device to 
	 * screw up the event processing.
	 * A proper workaround would be manually reading out string descriptors
	 * from a device in an async fasion in the background. 
	 */
	int ret;
	struct usb_dev_info *inf = arg;
	struct aura_node *node = inf->node; 

	inf->handle = hndl;
	
	libusb_fill_interrupt_transfer(inf->itransfer, inf->handle, 0x81,
				       inf->ibuffer, 8, 
				       cb_interrupt, node, 10000);

	libusb_fill_control_setup(inf->ctrlbuf, 
				  LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN,
				  RQ_GET_DEV_INFO,
				  0, 0, inf->io_buf_size);
	libusb_fill_control_transfer(inf->ctransfer, inf->handle, inf->ctrlbuf, cb_got_dev_info, node, 1500);

	ret = libusb_submit_transfer(inf->ctransfer);
	if (ret!= 0) {
		libusb_close(inf->handle);
		return -1;
	}

	inf->state = AUSB_DEVICE_INIT; /* Change our state */
	inf->cbusy = true;

	slog(4, SLOG_DEBUG, "usb: Device opened, info packet requested");
	return 0;
};
开发者ID:RC-MODULE,项目名称:matlab,代码行数:36,代码来源:transport-usb.c


示例4: template_setup

void template_setup (GuTemplate* t) {
    const gchar *filename;
    char *filepath = NULL;
    GError *error = NULL;
    GtkTreeIter iter;

    gchar *dirpath = g_build_filename (g_get_user_config_dir (), "gummi",
                                      "templates" , NULL);

    GDir* dir = g_dir_open (dirpath, 0, &error);
    if (error) {
        /* print error if directory does not exist */
        slog (L_INFO, "unable to read template directory, creating new..\n");
        g_mkdir_with_parents (dirpath, DIR_PERMS);
        g_free (dirpath);
        return;
    }

    while ( (filename = g_dir_read_name (dir))) {
        filepath = g_build_filename (dirpath, filename, NULL);
        gtk_list_store_append (t->list_templates, &iter);
        gtk_list_store_set (t->list_templates, &iter, 0, filename, 1,
                filepath, -1);
        g_free (filepath);
    }
    g_free (dirpath);

    // disable the add button when there are no tabs opened (#388)
    if (!tabmanager_has_tabs()) {
        gtk_widget_set_sensitive (t->template_add, FALSE);
    }

    gtk_widget_set_sensitive (t->template_open, FALSE);


}
开发者ID:abhi-kumar,项目名称:gummi,代码行数:36,代码来源:template.c


示例5: actor_empty_list

void actor_empty_list()
{
	int i;
	Actor *actor = NULL;
	if(!actorList)
	{
		slog("actorList not initialized");
		return;
	}
	for(i = 0; i < actorMax; ++i)
	{
		actor = &actorList[i];
		actor_free(&actor);
	}
	memset(actorList, 0, sizeof(Actor) * actorMax);
	for(i = 0; i < actorMax; i++)
	{
		if(actorList[i].sprite != NULL)
		{
			sprite_free(&actorList[i].sprite);
		}
	}
	actorNum = 0;
}
开发者ID:egilmore533,项目名称:IT-276-Pep-s-Spicy-Adventure-,代码行数:24,代码来源:actor.c


示例6: user_delete

/*
 * user_delete(user_t *u, const char *comment)
 *
 * Destroys a user object and deletes the object from the users DTree.
 *
 * Inputs:
 *     - user object to delete
 *     - quit comment
 *
 * Outputs:
 *     - nothing
 *
 * Side Effects:
 *     - on success, a user is deleted from the users DTree.
 */
void user_delete(user_t *u, const char *comment)
{
	mowgli_node_t *n, *tn;
	chanuser_t *cu;
	mynick_t *mn;
	char oldnick[NICKLEN];
	bool doenforcer = false;

	return_if_fail(u != NULL);

	if (u->flags & UF_DOENFORCE)
	{
		doenforcer = true;
		mowgli_strlcpy(oldnick, u->nick, sizeof oldnick);
		u->flags &= ~UF_DOENFORCE;
	}

	if (!comment)
		comment = "";

	slog(LG_DEBUG, "user_delete(): removing user: %s -> %s (%s)", u->nick, u->server->name, comment);

	hook_call_user_delete_info((&(hook_user_delete_t){ .u = u,
				.comment = comment}));
开发者ID:Canternet,项目名称:atheme,代码行数:39,代码来源:users.c


示例7: obj_va_search

int obj_va_search(float *v,float *a,int count,float vtarget[3],float atarget[6])
{
    int i;
    if (!v || !a)
    {
        slog("error, missing a buffer to search");
        return -1;/*not found*/
    }
    for (i = 0; i < count; i++)
    {
        if (memcmp(&v[i * 3],vtarget,sizeof(float)*3) != 0)
        {
            /*not equal, keep searching*/
            continue;
        }
        if (memcmp(&a[i * 3],atarget,sizeof(float)*6) != 0)
        {
            /*not equal, keep searching*/
            continue;
        }
        return i;
    }
    return -1;/*not found*/
}
开发者ID:Clodial,项目名称:GummyShips2,代码行数:24,代码来源:obj.c


示例8: font_draw_text

void font_draw_text(
    char   * text,
    int   x,
    int   y,
    Vec3D  color,
    float alpha,
    Uint32   size
  )
{
  if (!font_initialized())return;
  if (size >= FontSizeMax)
  {
    slog("font: passed a font size outside of available range");
    return;
  }
  font_draw_text_custom(
    text,
    x,
    y,
    color,
    alpha,
    __font_size[size]
  );
}
开发者ID:PhoenixLord1010,项目名称:Flight64,代码行数:24,代码来源:font.c


示例9: audio_empty_pak_list

void audio_empty_pak_list()
{
	int i;
	SoundPak *pak = NULL;
	if(!pakList)
	{
		slog("pakList not initialized");
		return;
	}
	for(i = 0; i < maxPaks; ++i)
	{
		pak = &pakList[i];
		audio_pak_free(&pak);
	}
	memset(pakList, 0, sizeof(SoundPak) * maxPaks);
	for(i = 0; i < maxPaks; ++i)
	{
		pakList[i].moving = NULL;
		pakList[i].firing1 = NULL;
		pakList[i].firing2 = NULL;
		pakList[i].death = NULL;
	}
	numPaks = 0;
}
开发者ID:egilmore533,项目名称:IT-276-Pep-s-Spicy-Adventure-,代码行数:24,代码来源:audio.c


示例10: m_tburst

static void m_tburst(sourceinfo_t *si, int parc, char *parv[])
{
	time_t chants = atol(parv[0]);
	channel_t *c = channel_find(parv[1]);
	time_t topicts = atol(parv[2]);
 
	if (c == NULL)
		return;

	/* Our uplink is trying to change the topic during burst,
	 * and we have already set a topic. Assume our change won.
	 * -- jilles */
	if (si->s != NULL && si->s->uplink == me.me &&
			!(si->s->flags & SF_EOB) && c->topic != NULL)
		return;

	if (c->ts < chants || (c->ts == chants && c->topicts >= topicts))
	{
		slog(LG_DEBUG, "m_tburst(): ignoring topic on %s", c->name);
		return;
	}

	handle_topic_from(si, c, parv[3], topicts, parv[4]);
}
开发者ID:ItsAGeekThing,项目名称:Xtheme,代码行数:24,代码来源:hybrid.c


示例11: main

/* main routine */
int main(int argc, char **argv)
{
        int listenfd, r;
        unsigned short port;
        struct sockaddr_in serv;
        int mode;
        int *log_level;

        signal(SIGPIPE, SIG_IGN);
        log_level = shmalloc("/log_level", sizeof(int));
        if (!log_level) {
                slog(SLOG_ERROR, "could not allocate shm for slog");
                exit(EXIT_FAILURE);
        }
        *log_level = SLOG_ALL;
        slog_level(log_level);

        if (argc < 2) {
                fprintf(stderr, "Usage: %s <port number> "
                                "[mode: 0=seq,1=thr,2=proc]\n", argv[0]);
                exit(EXIT_FAILURE);
        } else if (argc >= 3) {
                mode = atoi(argv[2]);
                if (argc >= 4) {
                        *log_level = atoi(argv[3]);
                        fprintf(stderr, "%s: *log_level = %d\n",
                                argv[0], *log_level);
                }

        } else {
                fprintf(stderr, "%s: no mode specified. "
                                "defaulting to mode=0 (seq)\n", argv[0]);
                mode = 0;
        }

        if ((port = atoi(argv[1])) <= 0) {
                fprintf(stderr, "%s: bad port\n", argv[0]); 
                exit(EXIT_FAILURE);
        }

        listenfd = socket(AF_INET, SOCK_STREAM, 0);
        if (listenfd == -1) {
                slog_perror("socket");
                exit(EXIT_FAILURE);
        }


        memset(&serv, 0, sizeof(serv));
        serv.sin_family = AF_INET;
        serv.sin_addr.s_addr = htonl(INADDR_ANY);
        serv.sin_port = htons(port);

        r = bind(listenfd, (struct sockaddr *)&serv, sizeof(serv));
        if (r == -1) {
                slog_perror("bind");
                exit(EXIT_FAILURE);
        }

        r = listen(listenfd, LISTENQ);
        if (r == -1) {
                slog_perror("listen");
                exit(EXIT_FAILURE);
        }

        if (mode == 0) {
                proxy_seq(listenfd);
        } else if (mode == 1) {
                proxy_thr(listenfd);
        } else {
                proxy_proc(listenfd);
        }

        r = close(listenfd);
        if (r == -1) {
                slog_perror("close"); 
                exit(EXIT_FAILURE);
        }

        shfree("/log_level", log_level, sizeof(int));
        exit(EXIT_SUCCESS);
}
开发者ID:wyc,项目名称:simple-http-proxy,代码行数:82,代码来源:proxy.c


示例12: main

int main(int argc, char *argv[])
{
	GList* list = NULL;
	json_t *root;

	SDL_Surface *optimized_surface = NULL;
	SDL_Surface *temp = NULL;
	Sound *bg_music = NULL;
	Sound *level_music = NULL;
	int done;
	const Uint8 *keys;
	char imagepath[512];

	game_initialize_system();
	SDL_ShowCursor(SDL_DISABLE);

	bg_music = sound_load_music("sounds/vanguard_bouncy.mp3");
	if(!bg_music)
	{
		slog("Could not load music\n");
	}
	
	level_music = sound_load_music("sounds/chippy_cloud_kid.mp3");
	if(!level_music)
	{
		slog("Could not load music\n");
	}
	Mix_VolumeMusic(5);

	if(temp)
	{
		optimized_surface = SDL_ConvertSurface( temp, graphics_surface->format, NULL );
		SDL_FreeSurface(temp);
		
	}

	SDL_Event e;
	done = 0;

	int lock = true;
	do
	{
		if(menu_flag)
		{
			menu_draw();
			if(lock == false)
			{
				Mix_HaltMusic();
				lock = true;
			}

			if(Mix_PlayingMusic() == 0)
			{
				Mix_PlayMusic(bg_music->music, -1);
			}
		}
		else
		{
			tilemap_render_tile();
			entity_draw_all();
			if(lock == true)
			{
				Mix_HaltMusic();
				lock = false;
			}

			if(Mix_PlayingMusic() == 0)
			{
				Mix_PlayMusic(level_music->music, -1);
			}
		}

		mouse_draw_self();

		graphics_next_frame();
		SDL_PumpEvents();

		entity_think_all();

		while(SDL_PollEvent(&e) != 0)
		{
			if(e.type == SDL_QUIT)
			{
				done = 1;
			}
			
			bool leftclick = false ;
			bool rightclick = false;
			if(e.type == SDL_MOUSEBUTTONDOWN)
			{
				if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT))
				{
					leftclick = true;
				}
				else if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT))
				{
					rightclick = true;
				}
			}

//.........这里部分代码省略.........
开发者ID:yi7,项目名称:MouseAlert,代码行数:101,代码来源:game.c


示例13: slog

void 
D3Drender::render(void)
	{
        if (d3ddev == NULL) 
        { 
            #ifdef D3DSLOG
                slog("D3Drender render-- no device \n");
            #endif

             release(); 
             mHwnd = NULL;

            return; 
        }//endif

          d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

            d3ddev->BeginScene();

		        d3ddev->SetTexture(0, mtex.ptex);
		        d3ddev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
                d3ddev->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
                d3ddev->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
                d3ddev->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );

                // select which vertex format we are using
                d3ddev->SetFVF(CUSTOMFVF);

                // select the vertex buffer to display
                d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));

                //draw our quad
		        d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);

            d3ddev->EndScene();

             d3ddev->Present(NULL, NULL, NULL, NULL);

            //check if the device was lost (but not every render)
             //i have yet to encounter any of these log messages
             //so far device loss seem to be just d3ddev  becoming NULL
            wait += 1;
            if (wait >= 5)
            { 
                wait = 0;

                HRESULT coopResult;
                coopResult = d3ddev->TestCooperativeLevel();

                if (coopResult == D3DERR_DEVICELOST)
                { slog("D3DRender  D3DERR_DEVICELOST \n"); }

                if (coopResult == D3DERR_DEVICENOTRESET)
                { slog("D3DRender  D3DERR_DEVICENOTRESET \n"); }
 
                if (coopResult == D3DERR_DRIVERINTERNALERROR)
                { slog("D3DRender  D3DERR_DRIVERINTERNALERROR \n"); }

                if ((coopResult == D3DERR_DEVICELOST ) || (coopResult == D3DERR_DEVICENOTRESET) || (coopResult == D3DERR_DRIVERINTERNALERROR) )
                {
                  release(); 
                  mHwnd = NULL;
                }//endif
            }//endif

	}//update
开发者ID:xsmart,项目名称:splayer,代码行数:66,代码来源:D3Drender.cpp


示例14: sperror

void sperror(char *message) {
	slog(LOG_ERROR, "%s: %s\n", message, strerror(errno));
}
开发者ID:WuerthPhoenix,项目名称:safed,代码行数:3,代码来源:Misc.c


示例15: atheme_main

int atheme_main(int argc, char *argv[])
{
	int daemonize_pipe[2];
	bool have_conf = false;
	bool have_log = false;
	bool have_datadir = false;
	char buf[32];
	int pid, r;
	FILE *pid_file;
	const char *pidfilename = RUNDIR "/atheme.pid";
	char *log_p = NULL;
	mowgli_getopt_option_t long_opts[] = {
		{ NULL, 0, NULL, 0, 0 },
	};

	atheme_bootstrap();

	/* do command-line options */
	while ((r = mowgli_getopt_long(argc, argv, "c:dhrl:np:D:v", long_opts, NULL)) != -1)
	{
		switch (r)
		{
		  case 'c':
			  config_file = sstrdup(mowgli_optarg);
			  have_conf = true;
			  break;
		  case 'd':
			  log_force = true;
			  break;
		  case 'h':
			  print_help();
			  exit(EXIT_SUCCESS);
			  break;
		  case 'r':
			  readonly = true;
			  break;
		  case 'l':
			  log_p = sstrdup(mowgli_optarg);
			  have_log = true;
			  break;
		  case 'n':
			  runflags |= RF_LIVE;
			  break;
		  case 'p':
			  pidfilename = mowgli_optarg;
			  break;
		  case 'D':
			  datadir = mowgli_optarg;
			  have_datadir = true;
			  break;
		  case 'v':
			  print_version();
			  exit(EXIT_SUCCESS);
			  break;
		  default:
			  printf("usage: atheme [-dhnvr] [-c conf] [-l logfile] [-p pidfile]\n");
			  exit(EXIT_FAILURE);
			  break;
		}
	}

	if (!have_conf)
		config_file = sstrdup(SYSCONFDIR "/atheme.conf");

	if (!have_log)
		log_p = sstrdup(LOGDIR "/atheme.log");

	if (!have_datadir)
		datadir = sstrdup(DATADIR);

	cold_start = true;

	runflags |= RF_STARTING;

	atheme_init(argv[0], log_p);

	slog(LG_INFO, "%s is starting up...", PACKAGE_STRING);

	/* check for pid file */
#ifndef MOWGLI_OS_WIN
	if ((pid_file = fopen(pidfilename, "r")))
	{
		if (fgets(buf, 32, pid_file))
		{
			pid = atoi(buf);

			if (!kill(pid, 0))
			{
				fprintf(stderr, "atheme: daemon is already running\n");
				exit(EXIT_FAILURE);
			}
		}

		fclose(pid_file);
	}
#endif

	if (!(runflags & RF_LIVE))
		daemonize(daemonize_pipe);

//.........这里部分代码省略.........
开发者ID:Acidburn0zzz,项目名称:atheme,代码行数:101,代码来源:atheme.c


示例16: strncpy

/*
 * Class:     sage_DShowCaptureDevice
 * Method:    switchToConnector0
 * Signature: (JIILjava/lang/String;II)V
 */
JNIEXPORT void JNICALL Java_sage_DShowCaptureDevice_switchToConnector0
  (JNIEnv *env, jobject jo, jlong capInfo, jint crossType, jint crossIndex, jstring tuningMode,
  jint countryCode, jint videoFormatCode)
{
	char szTuningMode[16];
	if (!capInfo) return;
	DShowCaptureInfo* pCapInfo = (DShowCaptureInfo*) capInfo;
	pCapInfo->videoFormatCode = videoFormatCode;

	const char* pTuningMode = env->GetStringUTFChars(tuningMode, NULL);
	strncpy( szTuningMode, pTuningMode, sizeof(szTuningMode) );
	env->ReleaseStringUTFChars(tuningMode, pTuningMode);
	slog((env, "switchToConnector0 tuningMode:%s.\r\n", szTuningMode ));

	if ( String2TVType( szTuningMode ) && BDATypeNum( pCapInfo->captureConfig ) > 0 ) //ZQ REMOVE ME
	{
		TV_TYPE newBDAType = String2TVType( szTuningMode );
		if ( pCapInfo->dwBDAType != newBDAType && pCapInfo->dwBDAType > 0 )
		{
			int i, CaptureNum = pCapInfo->captureNum;
			for ( i = 0; i < CaptureNum; i++ )
				if ( pCapInfo->captures[i] && pCapInfo->captures[i]->dwBDAType == pCapInfo->dwBDAType )
					break;
			if ( i >= CaptureNum )
			{
				slog((env, "switchToConnector0 ERROR: Orignal BDA Capture :%d is not found\r\n",  pCapInfo->dwBDAType ));
				ASSERT( 0 );
				return;
			}

			//save back
			memcpy( pCapInfo->captures[i], pCapInfo,  sizeof(DShowCaptureInfo) );

			for ( i = 0; i < CaptureNum; i++ )
				if ( pCapInfo->captures[i] && pCapInfo->captures[i]->dwBDAType == newBDAType )
					break;

			if ( i >= CaptureNum )
			{
				slog((env, "switchToConnector0 ERROR: BDA Capture :%s is not found\r\n",  szTuningMode ));
				ASSERT( 0 );
				return;
			}
			memcpy( pCapInfo, pCapInfo->captures[i], sizeof(DShowCaptureInfo) );
			setChannelDev( (CHANNEL_DATA*)pCapInfo->channel, (void*)pCapInfo );
			slog((env, "switchToConnector0 BDA Capture :%s is switched.\r\n",  szTuningMode ));

		}

		//strncpy( pCapInfo->tvType, szTuningMode, sizeof(pCapInfo->tvType) );
		return;
	}

	if (!pCapInfo->pCrossbar)
		return;
	slog((env, "switchToConnector0 %d type:%d index:%d country:%d format:%d Mode:%s\r\n", 
			(int)capInfo, crossType, crossIndex, countryCode, videoFormatCode, szTuningMode ));


	strncpy( pCapInfo->TuningMode, szTuningMode, sizeof(pCapInfo->TuningMode) );
	// Setup the tuner first since it's upstream from the crossbar
	if (crossType == 1 && pCapInfo->pTVTuner)
	{
		IAMTVTuner* pTunerProps = NULL;
		HRESULT hr = pCapInfo->pTVTuner->QueryInterface(IID_IAMTVTuner, (void**)&pTunerProps);
		if (SUCCEEDED(hr))
		{
			HRESULT ccHr = S_OK;
			if (countryCode)
			{
				long currCountry = 0;
				hr = pTunerProps->get_CountryCode(&currCountry);
				if (FAILED(hr) || currCountry != countryCode)
				{
					hr = ccHr = pTunerProps->put_CountryCode(countryCode);
					HTESTPRINT(hr);
				}
				hr = pTunerProps->put_TuningSpace(countryCode);

				HTESTPRINT(hr);
			}
			AMTunerModeType currMode;
			TunerInputType currTuneType;
			HRESULT currModehr = pTunerProps->get_Mode(&currMode);
			HTESTPRINT(currModehr);
			HRESULT currTypehr = pTunerProps->get_InputType(0, &currTuneType);
			HTESTPRINT(currTypehr);
			AMTunerModeType newMode;
			TunerInputType tuneType;
			slog((env, "Tuning mode:%s; current tuning type:%d current  tuning model:%d\r\n", pCapInfo->TuningMode, currTuneType, currMode  ));
			if (!strcmp(pCapInfo->TuningMode, "Air"))
			{
				newMode = AMTUNER_MODE_TV;
				tuneType = TunerInputAntenna;
			}
//.........这里部分代码省略.........
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:101,代码来源:Crossbar.cpp


示例17: slog

/*
 * Class:     sage_DShowCaptureDevice
 * Method:    autoTuneChannel0
 * Signature: (JLjava/lang/String;I)Z
 */
JNIEXPORT jboolean JNICALL Java_sage_DShowCaptureDevice_autoTuneChannel0
  (JNIEnv *env, jobject jo, jlong capInfo, jstring jnum, jint streamType )
{
	if (!capInfo) return JNI_FALSE;
	DShowCaptureInfo* pCapInfo = (DShowCaptureInfo*)capInfo;

	////ZQ audio leaking
	//pCapInfo->pMC->Run();
	//slog((env, ">>>>  Start (capture:%s) \r\n"));


	//ZQ
	if (capMask(pCapInfo->captureConfig, sage_DShowCaptureDevice_BDA_VIDEO_CAPTURE_MASK ))
	{
		HRESULT hr;
		const char* cnum = env->GetStringUTFChars(jnum, NULL);
		if ( cnum == NULL || *cnum == 0x0 ) cnum = "0";
		slog((env, "autotune0 digital tuner '%s-%d' num=%s (ver 3.1)\r\n", pCapInfo->videoCaptureFilterName, 
			        pCapInfo->videoCaptureFilterNum, cnum ));

		//setup output format
		hr = SetupBDAStreamOutFormat( env, pCapInfo, streamType );

		hr = TurnBDAChannel( env, pCapInfo, cnum );
		env->ReleaseStringUTFChars(jnum, cnum);


		int locked = SageCheckLocked( pCapInfo );
		slog((env, "DONE: autotune0 hr=0x%x locked:%d\r\n", hr, locked ));

		return hr == S_OK ? JNI_TRUE : JNI_FALSE;
        
	}else //ZQ
	{
		if (!pCapInfo->pTVTuner) return JNI_FALSE;
		const char* cnum = env->GetStringUTFChars(jnum, NULL);
		int numericChannel = atoi(cnum);
		env->ReleaseStringUTFChars(jnum, cnum);
		IAMTVTuner* pTunerProps = NULL;
		long tuneResult = 0;
		if ( numericChannel == 0 || numericChannel < 0 )
			return JNI_FALSE;

		long lFreq = 0;
		HRESULT hr = pCapInfo->pTVTuner->QueryInterface(IID_IAMTVTuner, (void**)&pTunerProps);
		slog((env, "autotune0 analog tuner '%s-%d' hr=0x%x num=%d\r\n", pCapInfo->videoCaptureFilterName, 
					pCapInfo->videoCaptureFilterNum,	hr, numericChannel));
		if (SUCCEEDED(hr))
		{
			hr = pTunerProps->AutoTune(numericChannel, &tuneResult);

			HRESULT hr2 = pTunerProps->get_VideoFrequency( &lFreq );
			//if ( tuneResult )
			//	pTunerProps->StoreAutoTune();
			pCapInfo->dwTuneState = 0x01;
			//Fusion Card, FIX: after ATSC tune, fail to tune TV 
			if ( strstr( pCapInfo->videoCaptureFilterName, "Fusion" ) )
				pTunerProps->put_Mode( AMTUNER_MODE_FM_RADIO );  
			pTunerProps->put_Mode( AMTUNER_MODE_TV );  //ZQ. 
			SAFE_RELEASE(pTunerProps);
		}
		slog((env, "DONE: autotune0 %d hr=0x%x result=%d  freq:%d.\r\n", 
			(int)capInfo, hr, tuneResult, lFreq ));
		return (SUCCEEDED(hr) && (tuneResult != 0));
	}
	return JNI_FALSE;
}
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:72,代码来源:Crossbar.cpp


示例18: slog

/* Class:     sage_DShowCaptureDevice
 * Method:    getDevicesInCategory0
 * Signature: (Ljava/lang/String;)[Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_sage_DShowCaptureDevice_scanBDAChannel0
	(JNIEnv *env, jobject jo, jlong capInfo, jstring jnum, jstring jcountry, jint streamType )
{
	static jclass stringClass;

	DShowCaptureInfo* pCapInfo = (DShowCaptureInfo*) capInfo;
	if (!pCapInfo )
	{
		slog((env, "ScanDBAChannel0 failed device is not open or not exist.\r\n"  ));
		return env->NewStringUTF("");
	}

	if ( !capMask(pCapInfo->captureConfig, sage_DShowCaptureDevice_BDA_VIDEO_CAPTURE_MASK ) )
	{
		slog((env, "is not BDA capture device\r\n" ));
		return env->NewStringUTF("");
	}

	TV_TYPE TVType = GetTVType( pCapInfo );
	const char* cnum = env->GetStringUTFChars(jnum, NULL);
	const jchar* country = env->GetStringChars( jcountry, NULL);

	char  countryRegion[256]={0};
	char  tuningString[64]={0};

	if ( country != NULL && country[0] )
		wcstombs( countryRegion, (wchar_t*)country, sizeof(countryRegion)-2 );

	//trime space
	int len = strlen(countryRegion);
	while( len-- > 0 )
	{
		if ( countryRegion[len] == ' ' ) countryRegion[len] = 0x0;
		else break;
	}
	strncpy( pCapInfo->Country, countryRegion, sizeof(pCapInfo->Country) );

	//$NEW
	strncpy( tuningString, cnum, sizeof(tuningString) );
	env->ReleaseStringUTFChars( jnum, cnum);
	env->ReleaseStringChars( jcountry, country);
	
	//if ( pCapInfo->filterState <= 1 )  //in case, CaptureFilters is not ready
	{
		AddBDAVideoCaptureFilters( env, pCapInfo, pCapInfo->pGraph, 0 );             
		BDAGraphSetDebugFileSource( env, pCapInfo, pCapInfo->pGraph  );
		BDAGraphConnectFilter( env, pCapInfo,  pCapInfo->pGraph );
		SetupCAM( env, pCapInfo );
		SetupTunerPlugin( env, pCapInfo, GetTVType( pCapInfo ) );
		BDAGraphConnectDebugRawDumpSink( env, pCapInfo, pCapInfo->pGraph  );
       	BDAGraphConnectDumpSink( env, pCapInfo,  pCapInfo->pGraph );
		ClearUpDebugFileSource(  env, pCapInfo, pCapInfo->pGraph  );
	}

	TV_TYPE BDATVType = GetTVType( pCapInfo ); 
	if ( BDATVType == ATSC )
	{
		if ( !stricmp( pCapInfo->TuningMode, "Cable" ) )
		{
			if ( QAMTunerType( env, pCapInfo ) == 1  )
			{
				BDATVType = QAM;
			}
			else 
			if ( strstr(  pCapInfo->videoCaptureFilterName, "Silicondust HDHomeRun" ) ) //ZQ. hardcode HDHR QAM
			{
				BDATVType = QAM;
				slog( (env, "It's a HDHomeRun QAM tuner\r\n") );
			}
		}

		if ( strcmp( getSourceType( (CHANNEL_DATA*)pCapInfo->channel ), TVTypeString( BDATVType ) ) )
			setSourceType( (CHANNEL_DATA*)pCapInfo->channel, TVTypeString( BDATVType ) );
	}

	if ( BDATVType == DVBS ) 
	{
		if ( atoi( tuningString) == 0 )
			SetupSatelliteLNB( pCapInfo, 1 );
	}

	char* deviceName =  SageGetTunerDeviceName(pCapInfo);	
	slog(( env, "Scan Channel:%s,  country:%s, type:%s...\r\n", 
	                   tuningString, countryRegion, getSourceType( (CHANNEL_DATA*)pCapInfo->channel ) ));	
			   
	char* scanResult = scanChannel( (CHANNEL_DATA*)pCapInfo->channel, deviceName, tuningString,  
		                               countryRegion,  (int)streamType );
	len = strlen( scanResult );
	//trim \r\n
	while ( len > 1 && scanResult[len-1] == '\r' || scanResult[len-1] == '\n' ) 
	{
		scanResult[len-1] = 0; 
		len--;
	};
	if ( scanResult != NULL && len >= 1024 )
		slog(( env, "Scan Channel: scan result too long to log here, check native log\r\n" ));
//.........这里部分代码省略.........
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:101,代码来源:ScanChannel.cpp


示例19: tokenize

/* this splits apart a message with origin and command picked off already */
int tokenize(char *message, char **parv)
{
	char *pos = NULL;
	char *next;
	unsigned int count = 0;

	if (!message)
		return -1;

	/* first we fid out of there's a : in the message, save that string
	 * somewhere so we can set it to the last param in parv
	 * also make sure there's a space before it... if not then we're screwed
	 */
	pos = message;
	while (true)
	{
		if ((pos = strchr(pos, ':')))
		{
			pos--;
			if (*pos != ' ')
			{
				pos += 2;
				continue;
			}
			*pos = '\0';
			pos++;
			*pos = '\0';
			pos++;
			break;
		}
		else
			break;
	}

	/* now we take the beginning of the message and find all the spaces...
	 * set them to \0 and use 'next' to go through the string
	 */

	next = message;
	parv[0] = message;
	count = 1;

	while (*next)
	{
		if (count == MAXPARC)
		{
			/* we've reached one less than our max limit
			 * to handle the parameter we already ripped off
			 */
			slog(LG_DEBUG, "tokenize(): reached para limit");
			return count;
		}
		if (*next == ' ')
		{
			*next = '\0';
			next++;
			/* eat any additional spaces */
			while (*next == ' ')
				next++;
			/* if it's the end of the string, it's simply
			 * an extra space before the :parameter. break.
			 */
			if (*next == '\0')
				break;
			parv[count] = next;
			count++;
		}
		else
			next++;
	}

	if (pos)
	{
		parv[count] = pos;
		count++;
	}

	return count;
}
开发者ID:ItsAGeekThing,项目名称:Xtheme,代码行数:80,代码来源:tokenize.c


示例20: iofunctions_start_autosave

void iofunctions_start_autosave (void) {
    sid = g_timeout_add_seconds (atoi(config_get_value ("autosave_timer")) * 60,
            iofunctions_autosave_cb, NULL);
    slog (L_DEBUG, "Autosaving function started..\n");
}
开发者ID:JasonGross,项目名称:gummi,代码行数:5,代码来源:iofunctions.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ slotCancel函数代码示例发布时间:2022-05-30
下一篇:
C++ slock_unlock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap