コード例 #1
0
AudioReencodeBuffer::AudioReencodeBuffer(AudioFormat audio_format,
                                         int audio_channels, bool passthru)
  : m_last_audiotime(0),        m_audioFrameSize(0),
    m_initpassthru(passthru),   m_saveBuffer(NULL)
{
    Reset();
    const AudioSettings settings(audio_format, audio_channels, 0, 0, false);
    Reconfigure(settings);
}
コード例 #2
0
ファイル: PosixDaemon.c プロジェクト: alhazred/onarm
int		main(int argc, char **argv)
	{
	#define mDNSRecord mDNSStorage
	mDNS_PlatformSupport	platformStorage;
	mStatus					err;

	bzero(&mDNSRecord, sizeof mDNSRecord);
	bzero(&platformStorage, sizeof platformStorage);

	ParseCmdLinArgs(argc, argv);

	LogMsgIdent(mDNSResponderVersionString, "starting");

	err = mDNS_Init(&mDNSRecord, &platformStorage, gRRCache, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses, 
					mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext); 

	if (mStatus_NoError == err)
		err = udsserver_init();
		
	Reconfigure(&mDNSRecord);

	// Now that we're finished with anything privileged, switch over to running as "nobody"
	if (mStatus_NoError == err)
		{
		const struct passwd *pw = getpwnam(MDNSD_USER);
		if (pw != NULL)
			setuid(pw->pw_uid);
		else 
#ifdef MDNSD_NOROOT
		     {
			LogMsg("WARNING: mdnsd exiting because user \""MDNSD_USER"\" does not exist");
			err = mStatus_Invalid;
		     }
#else
			LogMsg("WARNING: mdnsd continuing as root because user \""MDNSD_USER"\" does not exist");
#endif
		}

	if (mStatus_NoError == err)
		err = MainLoop(&mDNSRecord);
 
	LogMsgIdent(mDNSResponderVersionString, "stopping");

	mDNS_Close(&mDNSRecord);

	if (udsserver_exit() < 0)
		LogMsg("ExitCallback: udsserver_exit failed");
 
 #if MDNS_DEBUGMSGS > 0
	printf("mDNSResponder exiting normally with %ld\n", err);
 #endif
 
	return err;
	}
コード例 #3
0
AudioOutputPulseAudio::AudioOutputPulseAudio(const AudioSettings &settings) :
    AudioOutputBase(settings),
    pcontext(NULL), pstream(NULL), mainloop(NULL),
    m_aosettings(NULL)
{
    volume_control.channels = 0;
    for (unsigned int i = 0; i < PA_CHANNELS_MAX; ++i)
        volume_control.values[i] = PA_VOLUME_MUTED;

    InitSettings(settings);
    if (settings.init)
        Reconfigure(settings);
}
コード例 #4
0
	PostProcessing::PostProcessing(AmbientOcclusionConfig _aoConfig) :
		m_screenOutputEffect(nullptr),
		m_ambientOcclusionEffect(nullptr),
		m_ambientOcclusionBlurXEffect(nullptr),
		m_ambientOcclusionBlurYEffect(nullptr)
	{
		for (int i = 0; i < 2; ++i)
		{
			m_ambientOcclusionFB[i] = nullptr;
			m_ambientOcclusion[i] = nullptr;
		}

		Reconfigure(_aoConfig);
	}
コード例 #5
0
AudioOutputPulseAudio::AudioOutputPulseAudio(const AudioSettings &settings) :
    AudioOutputBase(settings),
    pcontext(NULL), pstream(NULL), mainloop(NULL),
    m_aosettings(NULL)
{
    volume_control.channels = 0;
    for (unsigned int i = 0; i < PA_CHANNELS_MAX; ++i)
        volume_control.values[i] = PA_VOLUME_MUTED;

    // unecessary initialization to keep coverity happy
    memset(&sample_spec, 0, sizeof(sample_spec));
    memset(&channel_map, 0, sizeof(channel_map));

    InitSettings(settings);
    if (settings.init)
        Reconfigure(settings);
}
コード例 #6
0
ファイル: PosixDaemon.c プロジェクト: CadeLaRen/illumos-gate
mDNSlocal mStatus MainLoop(mDNS *m) // Loop until we quit.
{
    sigset_t signals;
    mDNSBool gotData = mDNSfalse;

    mDNSPosixListenForSignalInEventLoop(SIGINT);
    mDNSPosixListenForSignalInEventLoop(SIGTERM);
    mDNSPosixListenForSignalInEventLoop(SIGUSR1);
    mDNSPosixListenForSignalInEventLoop(SIGUSR2);
    mDNSPosixListenForSignalInEventLoop(SIGINFO);
    mDNSPosixListenForSignalInEventLoop(SIGPIPE);
    mDNSPosixListenForSignalInEventLoop(SIGHUP) ;

    for (; ;)
    {
        // Work out how long we expect to sleep before the next scheduled task
        struct timeval timeout;
        mDNSs32 ticks;

        // Only idle if we didn't find any data the last time around
        if (!gotData)
        {
            mDNSs32 nextTimerEvent = mDNS_Execute(m);
            nextTimerEvent = udsserver_idle(nextTimerEvent);
            ticks = nextTimerEvent - mDNS_TimeNow(m);
            if (ticks < 1) ticks = 1;
        }
        else    // otherwise call EventLoop again with 0 timemout
            ticks = 0;

        timeout.tv_sec = ticks / mDNSPlatformOneSecond;
        timeout.tv_usec = (ticks % mDNSPlatformOneSecond) * 1000000 / mDNSPlatformOneSecond;

        (void) mDNSPosixRunEventLoopOnce(m, &timeout, &signals, &gotData);

        if (sigismember(&signals, SIGHUP )) Reconfigure(m);
        if (sigismember(&signals, SIGINFO)) DumpStateLog(m);
        if (sigismember(&signals, SIGUSR1)) ToggleLog();
        if (sigismember(&signals, SIGUSR2)) ToggleLogPacket();
        // SIGPIPE happens when we try to write to a dead client; death should be detected soon in request_callback() and cleaned up.
        if (sigismember(&signals, SIGPIPE)) LogMsg("Received SIGPIPE - ignoring");
        if (sigismember(&signals, SIGINT) || sigismember(&signals, SIGTERM)) break;
    }
    return EINTR;
}
コード例 #7
0
ファイル: Simple.c プロジェクト: fjardon/motif
/******************************************************************************
 *
 *  SetValues:
 *     Called by the Intrinsics when an application attempts to
 *     change the value of a resource.  
 *
 *****************************************************************************/
static Boolean 
SetValues (
        Widget old_w,
        Widget request_w,
        Widget new_w,
        ArgList args,
        Cardinal *num_args
          )
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass)XtClass(new_w);
 ExmSimpleWidget cw = (ExmSimpleWidget)old_w;
 ExmSimpleWidget rw = (ExmSimpleWidget)request_w;
 ExmSimpleWidget nw = (ExmSimpleWidget)new_w;
 Boolean redisplayFlag = False;

 /* Validate the value of ExmNsimpleShape by calling XmRepTypeValidValue. */
   if (nw->simple.simple_shape != cw->simple.simple_shape) {
     if (!XmRepTypeValidValue (simpleShapeId, nw->simple.simple_shape, 
                               (Widget)nw))
       nw->simple.simple_shape = cw->simple.simple_shape;
     else
       redisplayFlag = True;
   }

 /* Redisplay on change in sensitivity */
 if (XtIsSensitive(new_w) != XtIsSensitive(old_w))
   redisplayFlag = True;

 /* If the widget's foreground or background color changes, 
    then we must update the GC. */ 
   if (nw->primitive.foreground != cw->primitive.foreground ||
       nw->core.background_pixel != cw->core.background_pixel) {
     if (wc->simple_class.destroy_gc)
       (*(wc->simple_class.destroy_gc))((Widget)cw);
     if (wc->simple_class.create_gc)
       (*(wc->simple_class.create_gc))((Widget)nw);
     redisplayFlag = True;
   }

 /* Check for application geometry settings. '0' means 'ideal size' */
   if (rw->core.width == FIND_NATURAL_SIZE) {
     nw->core.width = FIND_NATURAL_SIZE;
     nw->simple.need_to_compute_width = True;
   }
   else if (rw->core.width != cw->core.width) {
     nw->core.width = rw->core.width;
     nw->simple.pref_width = rw->core.width;
     nw->simple.need_to_compute_width = False;
   }

   if (rw->core.height == FIND_NATURAL_SIZE) {
     nw->core.height = FIND_NATURAL_SIZE;
     nw->simple.need_to_compute_height = True;
   }
   else if (rw->core.height != cw->core.height) {
     nw->core.height = rw->core.height;
     nw->simple.pref_height = rw->core.height;
     nw->simple.need_to_compute_height = False;
   }

 /* Check for any changes in total widget set, margin size, or 
    window decoration size.  If any are found, call Reconfigure. */ 
   nw->simple.need_to_reconfigure = False;
   if (nw->core.width != cw->core.width ||
       nw->core.height != cw->core.height ||
       nw->simple.margin_width != cw->simple.margin_width ||
       nw->simple.margin_height != cw->simple.margin_height ||
       nw->primitive.shadow_thickness != cw->primitive.shadow_thickness ||
       nw->primitive.highlight_thickness != cw->primitive.highlight_thickness
      ) 
   Reconfigure (exmSimpleWidgetClass, new_w, old_w);

   return (redisplayFlag);
}
コード例 #8
0
ファイル: planarity.c プロジェクト: BlairArchibald/sage
int menu(void)
{
char Choice;

     do {
    	ProjectTitle();

        Message("\n"
                "P. Planar embedding and Kuratowski subgraph isolation\n"
                "D. Planar graph drawing\n"
                "O. Outerplanar embedding and obstruction isolation\n"
                "2. Search for subgraph homeomorphic to K_{2,3}\n"
                "3. Search for subgraph homeomorphic to K_{3,3}\n"
                "4. Search for subgraph homeomorphic to K_4\n"
        		"C. Color the vertices of the graph\n"
        		"H. Help message for command line version\n"
                "R. Reconfigure options\n"
                "X. Exit\n"
        		"\n"
        );

        Prompt("Enter Choice: ");
        fflush(stdin);
        scanf(" %c", &Choice);
        Choice = tolower(Choice);

        if (Choice == 'h')
        	helpMessage(NULL);

        else if (Choice == 'r')
        	Reconfigure();

        else if (Choice != 'x')
        {
        	char *secondOutfile = NULL;
        	if (Choice == 'p'  || Choice == 'o' || Choice == 'd')
        		secondOutfile ="";

            switch (tolower(Mode))
            {
                case 's' : SpecificGraph(Choice, NULL, NULL, secondOutfile); break;
                case 'r' : RandomGraphs(Choice, 0, 0); break;
                case 'm' : RandomGraph(Choice, 0, 0, NULL, NULL); break;
                case 'n' : RandomGraph(Choice, 1, 0, NULL, NULL); break;
            }
        }

        if (Choice != 'r' && Choice != 'x')
        {
            Prompt("\nPress a key then hit ENTER to continue...");
            fflush(stdin);
            scanf(" %*c");
            fflush(stdin);
            Message("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            FlushConsole(stdout);
        }

     }  while (Choice != 'x');

     // Certain debuggers don't terminate correctly with pending output content
     FlushConsole(stdout);
     FlushConsole(stderr);

     return 0;
}