//--------------------------------------------------------------
void testApp::setup(){    
    //setup initial ip addresses
    iPadIP = "";
    iPhoneIP = "";
    osxIP = "";
    
    ofSetFrameRate(24);
    
    count = 0;
    
    debug = false;
    sendOSC = false;
    
    setupUI();
    setupVideo();
    
    CGDisplayHideCursor(NULL);
    
    gotJSON = false;

    ss << "No video information received yet" << endl;
    
    //load json
    loadJSON();
    
}
int main( int argc, char **argv )
{
    /* Flags to pass to SDL_SetVideoMode */
    int videoFlags = 0;
	/* This is our SDL surface */
	SDL_Surface *surface = NULL;
    {
        int retval = 0;
        if((retval = setupVideo(&videoFlags, surface)) != 0)
        {
            Quit(retval);
        }
    }
	Quit(eventLoop(videoFlags, surface));
}
//--------------------------------------------------------------
void ofApp::setup(){
    //setup initial ip addresses
    iPadIP = "";
    iPhoneIP = "";
    osxIP = "";
    
    //set framerate
    ofSetFrameRate(24);
    
    //set count
    count = 0;
    
    //set debug and sendosc
    debug = false;
    sendOSC = false;
    
    //setup ui and our first video
    setupUI();
    setupVideo();
    
    //setup osc
    setupOSC();
    
    //hide cursor
    CGDisplayHideCursor(NULL);
    
    //set gotjson
    gotJSON = false;
    
    //set ss
    ss << "No video information received yet" << endl;
    
    //load json
    loadJSON();
    
    ofRegisterURLNotification(this);
    videosDownloaded = 0;

}
bool setup()
{

    // Initialize video
    if ( !setupVideo(pongInstance.videoDeviceName, VFRAME_WIDTH, VFRAME_HEIGHT))
    {
        loge( "Failed to setup video" );
        return false;
    }

    // Initialize MQs
    if ( !setupQueues() )
    {
        loge( "Failed to setup queues" );
        return false;
    }

    // No thread should be working right now
    keepWorking = false;

    log("setup completed.");
    return true;

}
//___________________________________________________________
//      Generic Save Avi loop
//
//___________________________________________________________
//
uint8_t  GenericAviSave::saveAvi (const char *name)
{
    uint32_t size;
    uint8_t ret=0;
    strcpy(_name,name);
    //frametogo = frameEnd - frameStart + 1;
    frametogo=0;

    writter = new aviWrite ();
    // 1- setup audio
    guiStart();
    if (!setupAudio ())
    {
        guiStop();
        GUI_Error_HIG (QT_TR_NOOP("Error initalizing audio filters"), NULL);
        delete writter;
        writter = NULL;
        return 0;
    }

    if (!setupVideo (_name))
    {
        guiStop();
        GUI_Error_HIG (QT_TR_NOOP("Error initalizing video filters"), NULL);
        delete   	writter;
        writter = NULL;
        // guiStop();
        return 0;
    }

    // 3- setup video
    frametogo=_incoming->getInfo()->nb_frames;
    fps1000=_incoming->getInfo()->fps1000;
    printf ("\n writing %lu frames\n", frametogo);

    //__________________________________
    //   now go to main loop.....
    //__________________________________
    int frameDelay = 0;
    int videoSize;

    for (uint32_t cf = 0; cf < frametogo; cf++)
    {
        if (guiUpdate(cf, frametogo))
            goto abortme;

        for (;;)
        {
            videoSize = writeVideoChunk(cf + frameDelay);

            if (videoSize == 0 && _encode && (_encode->getRequirements() & ADM_ENC_REQ_NULL_FLUSH))
            {
                printf("skipping frame: %u size: %i\n", cf + frameDelay, videoSize);
                frameDelay++;
            }
            else
                break;
        }

        writeAudioChunk(cf);
    }

    ret=1;
abortme:
    guiStop ();
    //__________________________________
    // and end save
    //__________________________________
    writter->setEnd ();
    delete       writter;
    writter = NULL;
    // resync GUI
    printf ("\n Saving AVI (v_engine)... done\n");
    return ret;
}
Example #6
0
//___________________________________________________________
//      Generic Save Avi loop
//
//___________________________________________________________
//
uint8_t  GenericAviSave::saveAvi (const char *name)
{
uint32_t size;
uint8_t ret=0;
  strcpy(_name,name);
  //frametogo = frameEnd - frameStart + 1;
  frametogo=0;
  
  writter = new aviWrite ();
    // 1- setup audio
  guiStart();
  if (!setupAudio ())
    {
      guiStop();
      GUI_Error_HIG (QT_TR_NOOP("Error initalizing audio filters"), NULL);
      delete writter;
      writter = NULL;
      return 0;
    }
   
   if (!setupVideo (_name))
    {
      guiStop();
      GUI_Error_HIG (QT_TR_NOOP("Error initalizing video filters"), NULL);
      delete   	writter;
      writter = NULL;
     // guiStop();
      return 0;
    }
  
  // 3- setup video
  frametogo=_incoming->getInfo()->nb_frames;
  fps1000=_incoming->getInfo()->fps1000;
  printf ("\n writing %lu frames\n", frametogo);

  //__________________________________
  //   now go to main loop.....
  //__________________________________
  for (uint32_t cf = 0; cf < frametogo; cf++) 
    {
			
			
			
      			if (guiUpdate (cf, frametogo))
					goto abortme;
      			//   printf("\n %lu / %lu",cf,frametogo);
      			writeVideoChunk (cf);
      			writeAudioChunk (cf);
			//writter->sync();
     
     
    };				// end for
    ret=1;
abortme:
  guiStop ();
  //__________________________________
  // and end save
  //__________________________________
  writter->setEnd ();
  delete       writter;
  writter = NULL;
  // resync GUI
  printf ("\n Saving AVI (v_engine)... done\n");
  return ret;
}
bool admSaver::save(void)
{


    int ret=false;
    
    
    ADM_info("Audio starting time %s\n",ADM_us2plain(startAudioTime));
    ADM_info("[A_Save] Saving..\n");
    
    const char *defaultExtension=ADM_MuxerGetDefaultExtension(muxerIndex);
    EditableAudioTrack *ed=NULL;
    ADM_info("Muxer default extension %s\n",defaultExtension);
    if(!videoEncoderIndex) 
    {
        if(false==video_body-> checkCutsAreOnIntra())
        {
            if(!GUI_Question("The video is in copy mode but the cut points are not on keyframes.\n"
                            "The video will be saved but there will corruption at cut point(s).\n"
                             "Do you want to continue anyway ?"))
            {
                return false;
            }
        }
    }

    if(!(muxer=ADM_MuxerSpawnFromIndex(muxerIndex)))
    {
        GUI_Error_HIG("Muxer","Cannot instantiante muxer");
        return 0;
    }
     
    ADM_videoStream *video=setupVideo();
    if(!video)
    {
        return false;
    }
    // adjust audio starting time
     for(int i=0;i<nbAudioTracks;i++)
        {
            ADM_audioStream  *stream=video_body->getAudioStreamAt(i);
            stream->goToTime(startAudioTime);
        }
    if(false==setupAudio())
    {
        if(video) delete video;
        if(muxer) delete muxer;
        muxer=NULL;
        return false;
    }
   
    // Check if we need to add an extension....
    if(defaultExtension)
    {
        if(!strstr(fileName.c_str(),"."))
        {
            
            fileName=fileName+std::string(".")+std::string(defaultExtension);
            ADM_info("Adding extension, filename is now %s\n",fileName.c_str());
        }

    }
    if(!muxer->open(fileName.c_str(),video,nbAudioTracks,audioAccess))
    {
        GUI_Error_HIG("Muxer","Cannot open ");
    }else
    {
        ret=muxer->save();
        muxer->close();
    }
abort123:
    if(video)
        delete video;
    video=NULL;
    for(int i=0;i<nbAudioTracks;i++)
    {
        delete audioAccess[i];
        audioAccess[i]=NULL;
    }
    return ret;
}