⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qsdlwidget.cpp

📁 强大的QT,GTK的学习Demo.包含DSP驱动以及所使用库文件资源。
💻 CPP
📖 第 1 页 / 共 5 页
字号:
{
    dsdemoclass[SelectPort]->SetFrameBQuantVal(number);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::BQuantAllSet(int number)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        BQuantSet(number);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::PQuantSet(int number)
{
    dsdemoclass[SelectPort]->SetFramePQuantVal(number);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::PQuantAllSet(int number)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        PQuantSet(number);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::KeyFrameISet(int number)
{
    dsdemoclass[SelectPort]->SetFrameKeyFrameI(number);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::KeyFrameIAllSet(int number)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        KeyFrameISet(number);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::BFramesSet(int number)
{
    dsdemoclass[SelectPort]->SetFrameBFrames(number);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::BFramesAllSet(int number)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        BFramesSet(number);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::FrameRateSet(int number)
{
    dsdemoclass[SelectPort]->SetFrameFrameRate(number);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::FrameRateAllSet(int number)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        FrameRateSet(number);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::StreamTypeSet(int StreamType)
{
    fprintf(stderr, "Set StreamType for Port %d\n", SelectPort);
    SetStreamType(DSCLASSDEMO(SelectPort)->ChannelHandle, StreamType);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::StreamTypeAllSet(int StreamType)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        StreamTypeSet(StreamType);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::StreamTypeSubSet(int StreamType)
{
    fprintf(stderr, "Set SubStreamType for Port %d\n", SelectPort);
    SetSubStreamType(DSCLASSDEMO(SelectPort)->ChannelHandle, StreamType);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::StreamTypeSubAllSet(int StreamType)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        StreamTypeSubSet(StreamType);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::EncoderSet(PictureFormat_t pictureFormat)
{
    DSCLASSDEMO(SelectPort)->pictureFormat = pictureFormat;
    SetEncoderPictureFormat(DSCLASSDEMO(SelectPort)->ChannelHandle, pictureFormat);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::EncoderSubSet(PictureFormat_t pictureFormat)
{
    DSCLASSDEMO(SelectPort)->subpictureFormat = pictureFormat;
    SetSubEncoderPictureFormat(DSCLASSDEMO(SelectPort)->ChannelHandle, pictureFormat);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::EncoderAllSet(PictureFormat_t pictureFormat)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        EncoderSet(pictureFormat);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::EncoderSubAllSet(PictureFormat_t pictureFormat)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        EncoderSubSet(pictureFormat);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::BitRateSet(int MaxBps, BitrateControlType_t brc)
{
    DSCLASSDEMO(SelectPort)->MaxBps = MaxBps;
    DSCLASSDEMO(SelectPort)->brc = brc;

    OutputDebugString("brc = %d\n", brc);

    dsdemoclass[SelectPort]->SetMaxBpsMode();
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::BitRateAllSet(int MaxBps, BitrateControlType_t brc)
{
    int temp = SelectPort;
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        SelectPort = port;
        BitRateSet(MaxBps, brc);
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
int QSDLWidget::AllRecordStatus()
{
    int port;

    for(port = 0; port < GetTotalChannels(); port++)
    {
        if(!(DSCLASSDEMO(port)->record_flag))
        {
            return 0;
        }
    }

    return 1;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::RecordAllSet(bool on)
{
    OutputDebugString("Beginning Record.........\n");

    int temp = SelectPort;
    int port;

    if(on)
    {
        for(port = 0; port < GetTotalChannels(); port++)
        {
            SelectPort = port;
            if(!(DSCLASSDEMO(SelectPort)->record_flag))
                RecordSet(TRUE);
        }
    }
    else
    {
        for(port = 0; port < GetTotalChannels(); port++)
        {
            SelectPort = port;
            if(DSCLASSDEMO(SelectPort)->record_flag)
                RecordSet(FALSE);
        }
    }

    SelectPort = temp;
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::RecordSet(bool on)
{
    struct timespec tv;

    if(on)
    {
        Qtloop[SelectPort]->start(1000 * TIMECONST);

        if(!(DSCLASSDEMO(SelectPort)->net_flag))
        {
            timer[SelectPort]->start(200);
            time[SelectPort]->restart();
            DSCLASSDEMO(SelectPort)->countdays = 0;
        }

        dsdemoclass[SelectPort]->CreateFiles();
        if(!DSCLASSDEMO(SelectPort)->net_flag)
            dsdemoclass[SelectPort]->StartCapture();
        DSCLASSDEMO(SelectPort)->record_flag = 1;
    }
    else
    {
        OutputDebugString("in RecordSet false \n");
        Qtloop[SelectPort]->stop();
        if(!(DSCLASSDEMO(SelectPort)->net_flag))
        {
            timer[SelectPort]->stop();

            emit    audioChange(SelectPort, (float)0.0);
            emit    videoChange(SelectPort, (float)0.0);
            emit    totalChange(SelectPort, 0);
            emit    bitRateChange(SelectPort, 0);
            emit    countChange(0);

            dsdemoclass[SelectPort]->StopCapture();

            /* sleep 40 ms, for protecting that data in stream buffer is written into the file and then come to empty */
            tv.tv_sec  = 0;
            tv.tv_nsec = 40 * 1000 * 1000;
            nanosleep(&tv, NULL);
            /*
             * if(StopVideoCapture(DSCLASSDEMO(SelectPort)->ChannelHandle) < 0) ;
             * printf("record_callback: StopvideoCapture(port %d) failed\n", SelectPort);
             */
        }

        dsdemoclass[SelectPort]->end_record();
        DSCLASSDEMO(SelectPort)->bit_rate_size = 0;
        DSCLASSDEMO(SelectPort)->count = 0;
        DSCLASSDEMO(SelectPort)->record_flag = 0;
        DSCLASSDEMO(SelectPort)->Maxcount = 0;
        DSCLASSDEMO(SelectPort)->filehead_flag = 0;
    }
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void QSDLWidget::RecordSubAllSet(bool on)
{
    int temp = SelectPort;
    int port;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -