Exemplo n.º 1
0
/*
** Write a General Position record
*/
void
ACMIRecorder::TodOffsetRecord( ACMITodOffsetRecord *recp )
{
	F4EnterCriticalSection( _csect );
	if ( !_fd )
	{
		F4LeaveCriticalSection( _csect );
		return;
	}

	recp->hdr.type = (BYTE)ACMIRecTodOffset;

	if (!fwrite( recp, sizeof( ACMITodOffsetRecord ), 1, _fd ) )
	{
		StopRecording();
		gACMIRecError = TRUE;
	}

	_bytesWritten += (float)(sizeof( ACMITodOffsetRecord ));
	// check our file size and automaticly start a new recording
	if ( _bytesWritten >= _maxBytesToWrite )
	{
		StopRecording();
		// this tells simdrive to toggle recording at the appropriate time
		SimDriver.doFile = TRUE;
		MonoPrint( "ACMI Recording starting new tape\n" );
	}

	F4LeaveCriticalSection( _csect );
}
Exemplo n.º 2
0
static void PlaybackEvent(void * v, int samples, float * samps, int channel_ct)
{
	struct RecorderPlugin * rp = (struct RecorderPlugin*)v;
	if( !rp->fPlay ) return;

	int r = fread( samps, channel_ct * sizeof( float ), samples, rp->fPlay );
	if( r != samples )
	{
		StopRecording( rp );
		return;
	}
	rp->TimeSinceStart += samples;

	if( rp->TimeSinceStart < rp->BypassLength )
	{
		if( rp->is_recording )
			force_white = 1;
		else
			force_white = 0;

		int r = fwrite( samps, channel_ct * sizeof( float ), samples, rp->fRec );
		if( r != samples )
		{
			StopRecording( rp );
		}
	}
	else
	{
		force_white = 0;
		rp->DunBoop = 1;
	}
}
Exemplo n.º 3
0
/*
** Write a General Position record
*/
void
ACMIRecorder::FlarePositionRecord( ACMIFlarePositionRecord *recp )
{
	F4EnterCriticalSection( _csect );
	if ( !_fd )
	{
		F4LeaveCriticalSection( _csect );
		return;
	}

	recp->hdr.type = (BYTE)ACMIRecFlarePosition;
	// recp->hdr.time = (float)(vuxGameTime/1000) + OTWDriver.todOffset;

// FIX	*(recp->data.label) = NULL;
// FIX	recp->data.teamColor = 0x0;
	
	if (!fwrite( recp, sizeof( ACMIFlarePositionRecord ), 1, _fd ) )
	{
		StopRecording();
		gACMIRecError = TRUE;
	}

	_bytesWritten += (float)(sizeof( ACMIFlarePositionRecord ));
	// check our file size and automaticly start a new recording
	if ( _bytesWritten >= _maxBytesToWrite )
	{
		StopRecording();
		// this tells simdrive to toggle recording at the appropriate time
		SimDriver.doFile = TRUE;
		MonoPrint( "ACMI Recording starting new tape\n" );
	}

	F4LeaveCriticalSection( _csect );
}
Exemplo n.º 4
0
void FWebMRecord::Tick(float DeltaTime)
{
	if (GIsEditor)
	{
		return;
	}

	if (bRecording)
	{
		VideoDeltaTimeAccum += DeltaTime;
		TotalVideoTime += DeltaTime;

		if (TimeLeftToRecord > 0)
		{
			TimeLeftToRecord -= DeltaTime;
			if (TimeLeftToRecord <= 0)
			{
				StopRecording();
			}
		}
	}

	if (bCompressing)
	{
		if (bCompressionComplete)
		{
			bCompressing = false;
			OnCompressingComplete().Broadcast();
		}
	}
}
Exemplo n.º 5
0
bool FWebMRecord::Exec(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar)
{
	if (FParse::Command(&Cmd, TEXT("VIDEORECORD")))
	{
		if (!bRecording)
		{
			StartRecording(-1);
		}
		else
		{
			StopRecording();
		}

		return true;
	}
	// DEBUG: test muxing the audio and video from raw source
	else if (FParse::Command(&Cmd, TEXT("VIDEOMUX")))
	{
		EncodeVideoAndAudio(TEXT(""));

		return true;
	}
	// DEBUG: upload the last video written to youtube
	else if (FParse::Command(&Cmd, TEXT("UPLOADVIDEO")))
	{
		DebugUploadLastVideo(InWorld);
		return true;
	}

	return false;
}
Exemplo n.º 6
0
void OBS::ToggleRecording()
{
    if(!bRecording)
        StartRecording();
    else
        StopRecording();
}
Exemplo n.º 7
0
static void MKeyEvent( void * v, int keycode, int down )
{
	struct RecorderPlugin * rp = (struct RecorderPlugin*)v;
	char c = toupper( keycode );
	if( c == 'R' && down && !rp->is_recording ) StartRecording( rp );
	if( c == 'S' && down &&  rp->is_recording ) StopRecording( rp );
}
uint32 FVoiceEngineSteam::StopLocalVoiceProcessing(uint32 LocalUserNum) 
{
	uint32 Return = E_FAIL;
	if (IsOwningUser(LocalUserNum))
	{
		if (bIsCapturing)
		{
			bIsCapturing = false;
			bPendingFinalCapture = true;

			// Make a call to begin stopping the current VOIP recording session
			StopRecording();

			// Now check/update the status of the recording session
			VoiceCaptureUpdate();
		}

		Return = S_OK;
	}
	else
	{
		UE_LOG(LogVoiceEncode, Error, TEXT("StopLocalVoiceProcessing: Ignoring stop request for non-owning user"));
	}

	return Return;
}
Exemplo n.º 9
0
void GraphicsTracingWidget::OnEmulationStopping() {
    // TODO: Is it safe to access the context here?

    auto context = context_weak.lock();
    if (!context)
        return;

    if (context->recorder) {
        auto reply =
            QMessageBox::question(this, tr("CiTracing still active"),
                                  tr("A CiTrace is still being recorded. Do you want to save it? "
                                     "If not, all recorded data will be discarded."),
                                  QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);

        if (reply == QMessageBox::Yes) {
            StopRecording();
        } else {
            AbortRecording();
        }
    }

    // If the widget was disabled before, enable it now to allow starting
    // tracing before starting the next emulation session
    widget()->setEnabled(true);
}
Exemplo n.º 10
0
void MDFNI_SaveMovie(char *fname, uint32 *fb, MDFN_Rect *LineWidths)
{
    gzFile fp;

    if(current < 0)	/* Can't interrupt playback.*/
        return;

    if(current > 0)	/* Stop saving. */
    {
        StopRecording();
        return;
    }

    memset(&RewindBuffer, 0, sizeof(StateMem));
    RewindBuffer.initial_malloc = 16;

    current=CurrentMovie;

    if(fname)
        fp = gzopen(fname, "wb3");
    else
    {
        fp=gzopen(MDFN_MakeFName(MDFNMKF_MOVIE,CurrentMovie,0).c_str(),"wb3");
    }

    if(!fp) return;

    MDFNSS_SaveFP(fp, fb, LineWidths);
    gzseek(fp, 0, SEEK_END);
    gzflush(fp, Z_SYNC_FLUSH); // Flush output so that previews will still work right while
    // the movie is being recorded.  Purely cosmetic. :)
    slots[current] = fp;
    current++;
    MDFN_DispMessage(_("Movie recording started."));
}
Exemplo n.º 11
0
void FCEUI_StopMovie(void)
{
    if(current < 0) StopPlayback();
#if 0
    if(current > 0) StopRecording();
#endif
}
Exemplo n.º 12
0
void InteractionEventRecorder::CreateQtPartControl( QWidget *parent )
{
  // create GUI widgets from the Qt Designer's .ui file
  m_Controls.setupUi( parent );
  connect( m_Controls.btnStopRecording, SIGNAL(clicked()), this, SLOT(StopRecording()) );
  connect( m_Controls.btnStartRecording, SIGNAL(clicked()), this, SLOT(StartRecording()) );
  connect( m_Controls.btnPlay, SIGNAL(clicked()), this, SLOT(Play()) );
  connect( m_Controls.btnOpenFile, SIGNAL(clicked()), this, SLOT(OpenFile()) );
  connect( m_Controls.rotatePlanes, SIGNAL(clicked()), this, SLOT(RotatePlanes()) );
  connect( m_Controls.rotate3D, SIGNAL(clicked()), this, SLOT(RotateView()) );

  m_CurrentObserver = new mitk::EventRecorder();
  // Register as listener via micro services
  us::ServiceProperties props;

  props["name"] = std::string("EventRecorder");
  m_ServiceRegistration = us::GetModuleContext()->RegisterService<mitk::InteractionEventObserver>(m_CurrentObserver,props);


  /*

delete m_CurrentObserverDEBUG;
  m_ServiceRegistrationDEBUG.Unregister();
  */
}
Exemplo n.º 13
0
void FIFOPlayerWindow::OnEmulationStopped()
{
  // If we have previously been recording, stop now.
  if (FifoRecorder::GetInstance().IsRecording())
    StopRecording();

  UpdateControls();
}
	int32_t fake_audiodevice::Terminate() {
		void* thread_ret;
        
		StopRecording();
		StopPlayout();

		return 0;
	}
Exemplo n.º 15
0
void CWinVideoGrabber::StartPreviewing()
{
	if (!inited) return;
	StopPreviewing();
	StopRecording();
	videomode = VIDEOGRABBERMODE_PREVIEWING;
	capPreview(videowindow, True);
}
Exemplo n.º 16
0
CWinVideoGrabber::~CWinVideoGrabber()
{
	if (!inited) return;
	StopRecording();
	StopPreviewing();
	capDriverDisconnect(videowindow); 
	DestroyWindow(videowindow);
}
Exemplo n.º 17
0
void
SpeechRecognition::StopRecordingAndRecognize(SpeechEvent* aEvent)
{
  SetState(STATE_WAITING_FOR_RESULT);

  MOZ_ASSERT(mRecognitionService, "Service deleted before recording done");
  mRecognitionService->SoundEnd();

  StopRecording();
}
Exemplo n.º 18
0
void StatAggregator::Snapshot() {
  // Ignore this call if not recording
  if (state_ != RECORDING)
    return;

  StopRecording();
  Generate();
  Reset();
  StartRecording();
}
Exemplo n.º 19
0
/*
** ToggleRecording
*/
void
ACMIRecorder::ToggleRecording( void )
{
	F4EnterCriticalSection( _csect );
	if ( IsRecording() )
		StopRecording();
	else
		StartRecording();
	F4LeaveCriticalSection( _csect );
}
Exemplo n.º 20
0
void OBS::ToggleRecording()
{
    if (!bRecording)
    {
        if (!bRunning && !bStreaming) Start(true);
        StartRecording();
    }
    else
        StopRecording();
}
	int32_t fake_audiodevice::RegisterAudioCallback(AudioTransport* audioCallback) {
		bool is_playing = is_playing_;
		bool is_recording = is_recording_;
		StopPlayout();
		StopRecording(); // Stop the threads that uses audioCallback
		audioCallback_ = audioCallback;
		if(is_playing)
			StartPlayout();
		if(is_recording)
			StartRecording();
		return 0;
	}
Exemplo n.º 22
0
void
SpeechRecognition::AbortSilently(SpeechEvent* aEvent)
{
  if (mRecognitionService) {
    mRecognitionService->Abort();
  }

  if (mDOMStream) {
    StopRecording();
  }

  ResetAndEnd();
}
void mpeg_video_recorder::process_frame(const void* data, uints size, uint64 timestamp_ns, uint nbatchframes, bool video_end){

	if (!m_IsRecording){
		// this should't be there but last frame isn't uniqe so i must skip frames sent after "last" frame
		return;
	}

	if (m_iLastFramesize > 0 && m_uiFrameIndex > 0){
		coid::uint64 timeMs = (timestamp_ns - m_uiLastTimestampNs) / 1000000.0;
		MP4Duration frameDuration = timeMs * 90; // 90 000 ticks per seconds in mp4 container
		MP4WriteSample(m_hMp4FileHandle, m_iVideoTrackID, m_pLastNals[0].p_payload, m_iLastFramesize, frameDuration);
		m_uiLastTimestampNs = timestamp_ns;
	}
	else if(m_uiFrameIndex == 0){
		m_uiLastTimestampNs = timestamp_ns;
	}
	else{
		log(WARNINGMESSAGE("Frameskip detected!"));
	}

	uchar * ucharData = (uchar*)data;

	uint width4 = GetDivisibleBy4(m_iWidth);
	uint halfWidth4 = GetDivisibleBy4(m_iWidth >> 1);

	x264_picture_t pic_in,pic_out;
	x264_picture_init(&pic_in);
	pic_in.img.i_csp = X264_CSP_I420;
	pic_in.img.i_plane = 3;
	pic_in.img.plane[0] = ucharData;
	pic_in.img.plane[1] = ucharData + width4;
	pic_in.img.plane[2] = ucharData + 2 * width4 + halfWidth4;
	pic_in.img.i_stride[0] = width4 + halfWidth4;
	pic_in.img.i_stride[2] = pic_in.img.i_stride[1] = (width4 + halfWidth4) * 2;
	
	int i_nals;
	
	m_iLastFramesize = x264_encoder_encode(m_pEncoder, &m_pLastNals, &i_nals, &pic_in, &pic_out);

	m_uiFrameIndex++;

	if (video_end){
		if (m_iLastFramesize > 0){
			MP4Duration frameDuration = 33 * 90;  // 90 000 ticks per seconds in mp4 container
			MP4WriteSample(m_hMp4FileHandle, m_iVideoTrackID, m_pLastNals[0].p_payload, m_iLastFramesize, frameDuration);
		}
		StopRecording();
	}	
}
Exemplo n.º 24
0
void CHLTVDemoRecorder::StartRecording( const char *filename, bool bContinuously ) 
{
	StopRecording();	// stop if we're already recording
	
	if ( !m_DemoFile.Open( filename, false ) )
	{
		ConMsg ("StartRecording: couldn't open demo file %s.\n", filename );
		return;
	}

	ConMsg ("Recording SourceTV demo to %s...\n", filename);

	demoheader_t *dh = &m_DemoFile.m_DemoHeader;

	// open demo header file containing sigondata
	Q_memset( dh, 0, sizeof(demoheader_t));

	Q_strncpy( dh->demofilestamp, DEMO_HEADER_ID, sizeof(dh->demofilestamp) );
	dh->demoprotocol = DEMO_PROTOCOL;
	dh->networkprotocol = PROTOCOL_VERSION;

	Q_strncpy( dh->mapname, hltv->GetMapName(), sizeof( dh->mapname ) );

	char szGameDir[MAX_OSPATH];
	Q_strncpy(szGameDir, com_gamedir, sizeof( szGameDir ) );
	Q_FileBase ( szGameDir, dh->gamedirectory, sizeof( dh->gamedirectory ) );

	Q_strncpy( dh->servername, host_name.GetString(), sizeof( dh->servername ) );

	Q_strncpy( dh->clientname, "SourceTV Demo", sizeof( dh->servername ) );

	// write demo file header info
	m_DemoFile.WriteDemoHeader();
	
	dh->signonlength = WriteSignonData(); // demoheader will be written when demo is closed

	m_nFrameCount = 0;

	m_nStartTick = host_tickcount;

	// Demo playback should read this as an incoming message.
	// Write the client's realtime value out so we can synchronize the reads.
	m_DemoFile.WriteCmdHeader( dem_synctick, 0 );

	m_bIsRecording = true;

	m_SequenceInfo = 1;
	m_nDeltaTick = -1;
}
Exemplo n.º 25
0
static void RecordEvent(void * v, int samples, float * samps, int channel_ct)
{
	struct RecorderPlugin * rp = (struct RecorderPlugin*)v;

	if( !rp->fRec || !rp->is_recording ) return;

	if( rp->DunBoop || !rp->fPlay )
	{
		int r = fwrite( samps, channel_ct * sizeof( float ), samples, rp->fRec );
		if( r != samples )
		{
			StopRecording( rp );
		}
	}
}
Exemplo n.º 26
0
void
SpeechRecognition::AbortSilently(SpeechEvent* aEvent)
{
  bool stopRecording = StateBetween(STATE_ESTIMATING, STATE_RECOGNIZING);

  if (mRecognitionService) {
    mRecognitionService->Abort();
  }

  if (stopRecording) {
    StopRecording();
  }

  ResetAndEnd();
}
Exemplo n.º 27
0
void CWinVideoGrabber::StartRecording(char *filename)
{
	if (!inited) return;
	StopRecording();
	//StopPreviewing();
	CAPTUREPARMS CaptureParms;
	capCaptureGetSetup(videowindow, &CaptureParms, sizeof(CAPTUREPARMS));
	CaptureParms.fYield = True;
	CaptureParms.fAbortLeftMouse = False;
	CaptureParms.fAbortRightMouse = False;
	capCaptureSetSetup(videowindow, &CaptureParms, sizeof (CAPTUREPARMS)); 
	capFileSetCaptureFile(videowindow, filename);
	capCaptureSequence(videowindow);
	videomode = VIDEOGRABBERMODE_RECORDING;
}
Exemplo n.º 28
0
  bool CPVRGUIActions::ToggleTimer(const CFileItemPtr &item) const
  {
    if (!item->HasEPGInfoTag())
      return false;

    const CPVRTimerInfoTagPtr timer(CPVRItem(item).GetTimerInfoTag());
    if (timer)
    {
      if (timer->IsRecording())
        return StopRecording(item);
      else
        return DeleteTimer(item);
    }
    else
      return AddTimer(item, false);
  }
Exemplo n.º 29
0
void MDFNI_SaveMovie(char *fname, const MDFN_Surface *surface, const MDFN_Rect *DisplayRect, const int32 *LineWidths)
{
 gzFile fp;

 if(!MDFNGameInfo->StateAction)
  return;

 if(MDFNnetplay && (MDFNGameInfo->SaveStateAltersState == true))
 {
  char sb[256];
  trio_snprintf(sb, sizeof(sb), _("Module %s is not compatible with manual movie save starting/stopping during netplay."), MDFNGameInfo->shortname);
  MDFND_NetplayText((const uint8*)sb, false);
  return;
 }

 if(current < 0)	/* Can't interrupt playback.*/
  return;

 if(current > 0)	/* Stop saving. */
 {
  StopRecording();
  return;  
 }

 memset(&RewindBuffer, 0, sizeof(StateMem));
 RewindBuffer.initial_malloc = 16;

 current = CurrentMovie;

 if(fname)
  fp = gzopen(fname, "wb3");
 else
 {
  fp=gzopen(MDFN_MakeFName(MDFNMKF_MOVIE,CurrentMovie,0).c_str(),"wb3");
 }

 if(!fp) return;

 MDFNSS_SaveFP(fp, surface, DisplayRect, LineWidths);
 gzseek(fp, 0, SEEK_END);
 gzflush(fp, Z_SYNC_FLUSH); // Flush output so that previews will still work right while
			    // the movie is being recorded.  Purely cosmetic. :)
 slots[current] = fp;
 current++;
 MDFN_DispMessage(_("Movie recording started."));
}
Exemplo n.º 30
0
void GOrgueMidiRecorder::ButtonChanged(int id)
{
	switch(id)
	{
	case ID_MIDI_RECORDER_STOP:
		StopRecording();
		break;

	case ID_MIDI_RECORDER_RECORD:
		StartRecording(false);
		break;

	case ID_MIDI_RECORDER_RECORD_RENAME:
		StartRecording(true);
		break;
	}
}