Beispiel #1
0
RecordingDevice::ReturnCode RecordingDevice::StopRecording(const Timecode & tc)
{
    bool ok_so_far = true;
    ReturnCode return_code = OK;

    if(CORBA::is_nil(mRecorder))
    {
        ok_so_far = false;
        return_code = NO_DEVICE;
    }

    if (ok_so_far)
    {
        // Sort out parameters to be passed
        ProdAuto::MxfTimecode stop_tc_mxf;
        stop_tc_mxf.undefined = false;
        stop_tc_mxf.samples = tc.FramesSinceMidnight();

        //::Duration post_roll_dur;
        //post_roll_dur.TotalFrames(post_roll_frames);
        ProdAuto::MxfDuration post_roll_mxf;
        post_roll_mxf.undefined = false;
        post_roll_mxf.samples = post_roll_frames;


        ::ProdAuto::Recorder::ReturnCode result;
        CORBA::StringSeq_var files;
        ::ProdAuto::LocatorSeq locators;
        try
        {
            result = mRecorder->Stop(stop_tc_mxf, post_roll_mxf, "", "", locators, files.out());
        }
        catch (const CORBA::Exception &)
        {
            result = ProdAuto::Recorder::FAILURE;
        }

        if(ProdAuto::Recorder::SUCCESS == result)
        {
            //stop_tc += post_roll_dur;
            //mOutTime = stop_tc.Text(); // store the stop timecode

            //::Duration dur_tc;
            //dur_tc = Timecode(mOutTime.c_str()) - Timecode(mInTime.c_str());
            //mDuration = dur_tc.Text(); // store the duration

            // need to store paths
            //for(int i = 0; i < SDI_RECORDER_CHANNELS; ++i)
            //{
                //mFilename[i] = path.in()[i].in();
            //}

            mIsRecording = false;
            mHasRecorded = true;
        }
        else
        {
            ok_so_far = false;
            return_code = FAILED;
        }
    }

    return return_code;
}
Beispiel #2
0
/**
Get remote device to start recording.
For the moment, we enable all tracks.
*/
RecordingDevice::ReturnCode RecordingDevice::StartRecording(const Timecode & tc,
                                                            const std::string & description)
{
    bool ok_so_far = true;
    ReturnCode return_code = OK;
    mHasRecorded = false;

    ProdAuto::MxfTimecode start_tc_mxf;
#if 1
    // Normal operation
    start_tc_mxf.undefined = false;
#else
    // Crash record for testing
    start_tc_mxf.undefined = true;
#endif
    start_tc_mxf.samples = tc.FramesSinceMidnight();

    ProdAuto::MxfDuration pre_roll_mxf;
    pre_roll_mxf.undefined = false;
    pre_roll_mxf.samples = pre_roll_frames;

    if(CORBA::is_nil(mRecorder))
    {
        ok_so_far = false;
        return_code = NO_DEVICE;
    }

    if(ok_so_far)
    {
        // Sort out parameters to be passed
        CORBA::BooleanSeq rec_enable;
        rec_enable.length(mTrackCount);
        //::ProdAuto::StringArray tape_number;
        //::ProdAuto::StringList_var files;
        for(int i = 0; i < mTrackCount; ++i)
        {
            //tape_number[i] = CORBA::string_dup(tape[i]);
            rec_enable[i] = 1;
        }
        ProdAuto::Recorder::ReturnCode result;
        CORBA::StringSeq tapes;

        // Attempt operation on remote recorder
        try
        {
            result = mRecorder->Start(
                start_tc_mxf,
                pre_roll_mxf,
                rec_enable,
                false
                );
            if(ProdAuto::Recorder::SUCCESS == result)
            {
                return_code = RecordingDevice::OK;
            }
            else
            {
                return_code = RecordingDevice::FAILED;
            }
        }
        catch (const CORBA::Exception &)
        {
            result = ProdAuto::Recorder::FAILURE;
            return_code = RecordingDevice::NO_DEVICE;
        }


        if(ProdAuto::Recorder::SUCCESS == result)
        {
            //start_tc -= pre_roll_dur;
            //mInTime = start_tc.Text(); // store the start timecode
            //mDuration = "";
            //for(CORBA::ULong i = 0; i < files->length(); ++i)
            //{
            //  mFilename[i] = (const char *) files[i];
            //}
            mIsRecording = true;
        }
        else
        {
            ok_so_far = false;
        }
    }

    return return_code;
}