void ServerSession::OnNewSource( RTPSourceData *dat ) { if (dat->IsOwnSSRC()) return; uint32_t ip; uint16_t port; if (dat->GetRTPDataAddress() != 0) { const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); ip = addr->GetIP(); port = addr->GetPort(); } else if (dat->GetRTCPDataAddress() != 0) { const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); ip = addr->GetIP(); port = addr->GetPort()-1; } else return; RTPIPv4Address dest(ip,port); AddDestination(dest); struct in_addr inaddr; inaddr.s_addr = htonl(ip); // 将客户端IP信息添加到列表框 char ipInfo[32] = {0}; sprintf_s(ipInfo, sizeof(ipInfo), "%s:%d", inet_ntoa(inaddr), port); HWND hListWnd = GetDlgItem(g_hMainWnd, IDC_LIST_CLIENTS); SendMessage(hListWnd, LB_ADDSTRING, NULL, (LPARAM)ipInfo); }
wxTreeItemId BFBackupTree::AddTask (BFoid oid, BFTaskType type, const wxString& strName, const wxString& strDestination) { wxString str(strName); wxString strFull; // create strFull strFull << strDestination; if (strFull.Last() != wxFILE_SEP_PATH) strFull << wxFILE_SEP_PATH; strFull << strName; if (bFillBlackfiskPlaceholders_) BFBackup::FillBlackfiskPlaceholders(str); // add the destination items and the task item itself wxTreeItemId id = AppendItem ( AddDestination(strDestination), str, GetTypeIconId(type), -1, new BFBackupTreeItemData ( oid, strFull ) ); return id; }
//uLocalPort:本地通讯端口, dTimeStamp:视频传输时间戳 int CRTPRecv::Initialize(int Port, FRAME_CALLBACK pCallBack, void* pContext, RTP_RECV_STATUS_CALLBACK pRecvStatusCallBack, void* pRecvStatusUserData) { if (m_InitializeFlag) { LOG_INFO("CRTPRecv has been initialize"); return 0; } //判断RTP是否已经初始化 if(RTPSession::IsActive()) { LOG_INFO("RTP alrealy start"); return 0; } int Result=0; //初始化RTP库 if(0!=InitRTP(Port)) { LOG_ERROR("Create rtp error"); return -1; } //回调函数赋值 if (NULL == pCallBack) { LOG_WARN("FRAMECALLBACK is NULL"); } m_pCallBack = pCallBack; m_pContext = pContext; //回调函数赋值 if (NULL==pRecvStatusCallBack) { LOG_WARN("RecvStatusCallBack is NULL"); } m_pRTPRecvStatusUserData=pRecvStatusUserData; m_pRTPRecvStatusCallBack=pRecvStatusCallBack; /*//创建监测线程 m_RecvFlag=FALSE; m_CheckThreadStatus=TRUE; m_CheckThreadHandle = CreateThread(0,0,CheckRecvThread,this,0,0); if (NULL==m_CheckThreadHandle) { LOG_ERROR("CreateThread ERROR"); exit(-1); }*/ //测试使用 RTPIPv4Address addr(ntohl(inet_addr("10.28.5.188")),RTP_RECV_PORT); AddDestination(addr); m_InitializeFlag=true; LOG_DEBUG("Create RTP success, port is "<< Port); return 0; }
void BFBackupTree::OnAddDestination (wxCommandEvent& rEvent) { // create dir dialog wxDirDialog dlg(this, _("Choose a destination directory")); // let the user choose a dir if (dlg.ShowModal() != wxID_OK) return; // add the destination dir to the tree SelectItem(AddDestination (dlg.GetPath())); }
RipCD::RipCD(QWidget* parent) : QDialog(parent), transcoder_(new Transcoder(this)), queued_(0), finished_success_(0), finished_failed_(0), ui_(new Ui_RipCD) { // Init ui_->setupUi(this); // Set column widths in the QTableWidget. ui_->tableWidget->horizontalHeader()->setResizeMode( kCheckboxColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setResizeMode( kTrackNumberColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setResizeMode(kTrackTitleColumn, QHeaderView::Stretch); // Add a rip button rip_button_ = ui_->button_box->addButton(tr("Start ripping"), QDialogButtonBox::ActionRole); cancel_button_ = ui_->button_box->button(QDialogButtonBox::Cancel); close_button_ = ui_->button_box->button(QDialogButtonBox::Close); // Hide elements cancel_button_->hide(); ui_->progress_group->hide(); connect(ui_->select_all_button, SIGNAL(clicked()), SLOT(SelectAll())); connect(ui_->select_none_button, SIGNAL(clicked()), SLOT(SelectNone())); connect(ui_->invert_selection_button, SIGNAL(clicked()), SLOT(InvertSelection())); connect(rip_button_, SIGNAL(clicked()), SLOT(ClickedRipButton())); connect(cancel_button_, SIGNAL(clicked()), SLOT(Cancel())); connect(close_button_, SIGNAL(clicked()), SLOT(hide())); connect(transcoder_, SIGNAL(JobComplete(QString, bool)), SLOT(JobComplete(QString, bool))); connect(transcoder_, SIGNAL(AllJobsComplete()), SLOT(AllJobsComplete())); connect(transcoder_, SIGNAL(JobOutputName(QString)), SLOT(AppendOutput(QString))); connect(this, SIGNAL(RippingComplete()), SLOT(ThreadedTranscoding())); connect(this, SIGNAL(SignalUpdateProgress()), SLOT(UpdateProgress())); connect(ui_->options, SIGNAL(clicked()), SLOT(Options())); connect(ui_->select, SIGNAL(clicked()), SLOT(AddDestination())); setWindowTitle(tr("Rip CD")); AddDestinationDirectory(QDir::homePath()); cdio_ = cdio_open(nullptr, DRIVER_UNKNOWN); if (!cdio_) { qLog(Error) << "Failed to read CD drive"; return; } else { i_tracks_ = cdio_get_num_tracks(cdio_); ui_->tableWidget->setRowCount(i_tracks_); for (int i = 1; i <= i_tracks_; i++) { QCheckBox* checkbox_i = new QCheckBox(ui_->tableWidget); checkbox_i->setCheckState(Qt::Checked); checkboxes_.append(checkbox_i); ui_->tableWidget->setCellWidget(i - 1, kCheckboxColumn, checkbox_i); ui_->tableWidget->setCellWidget(i - 1, kTrackNumberColumn, new QLabel(QString::number(i))); QString track_title = QString("Track %1").arg(i); QLineEdit* line_edit_track_title_i = new QLineEdit(track_title, ui_->tableWidget); track_names_.append(line_edit_track_title_i); ui_->tableWidget->setCellWidget(i - 1, kTrackTitleColumn, line_edit_track_title_i); } } // Get presets QList<TranscoderPreset> presets = Transcoder::GetAllPresets(); qSort(presets.begin(), presets.end(), ComparePresetsByName); for (const TranscoderPreset& preset : presets) { ui_->format->addItem( QString("%1 (.%2)").arg(preset.name_, preset.extension_), QVariant::fromValue(preset)); } // Load settings QSettings s; s.beginGroup(kSettingsGroup); last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString(); QString last_output_format = s.value("last_output_format", "ogg").toString(); for (int i = 0; i < ui_->format->count(); ++i) { if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().extension_) { ui_->format->setCurrentIndex(i); break; } } ui_->progress_bar->setValue(0); ui_->progress_bar->setMaximum(100); }
RipCDDialog::RipCDDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_RipCDDialog), ripper_(new Ripper(this)), working_(false) { // Init ui_->setupUi(this); // Set column widths in the QTableWidget. ui_->tableWidget->horizontalHeader()->setResizeMode( kCheckboxColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setResizeMode( kTrackNumberColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setResizeMode(kTrackTitleColumn, QHeaderView::Stretch); // Add a rip button rip_button_ = ui_->button_box->addButton(tr("Start ripping"), QDialogButtonBox::ActionRole); cancel_button_ = ui_->button_box->button(QDialogButtonBox::Cancel); close_button_ = ui_->button_box->button(QDialogButtonBox::Close); // Hide elements cancel_button_->hide(); ui_->progress_group->hide(); connect(ui_->select_all_button, SIGNAL(clicked()), SLOT(SelectAll())); connect(ui_->select_none_button, SIGNAL(clicked()), SLOT(SelectNone())); connect(ui_->invert_selection_button, SIGNAL(clicked()), SLOT(InvertSelection())); connect(rip_button_, SIGNAL(clicked()), SLOT(ClickedRipButton())); connect(cancel_button_, SIGNAL(clicked()), ripper_, SLOT(Cancel())); connect(close_button_, SIGNAL(clicked()), SLOT(hide())); connect(ui_->options, SIGNAL(clicked()), SLOT(Options())); connect(ui_->select, SIGNAL(clicked()), SLOT(AddDestination())); connect(ripper_, SIGNAL(Finished()), SLOT(Finished())); connect(ripper_, SIGNAL(Cancelled()), SLOT(Cancelled())); connect(ripper_, SIGNAL(ProgressInterval(int, int)), SLOT(SetupProgressBarLimits(int, int))); connect(ripper_, SIGNAL(Progress(int)), SLOT(UpdateProgressBar(int))); setWindowTitle(tr("Rip CD")); AddDestinationDirectory(QDir::homePath()); // Get presets QList<TranscoderPreset> presets = Transcoder::GetAllPresets(); qSort(presets.begin(), presets.end(), ComparePresetsByName); for (const TranscoderPreset& preset : presets) { ui_->format->addItem( QString("%1 (.%2)").arg(preset.name_).arg(preset.extension_), QVariant::fromValue(preset)); } // Load settings QSettings s; s.beginGroup(kSettingsGroup); last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString(); QString last_output_format = s.value("last_output_format", "ogg").toString(); for (int i = 0; i < ui_->format->count(); ++i) { if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().extension_) { ui_->format->setCurrentIndex(i); break; } } }
TranscodeDialog::TranscodeDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_TranscodeDialog), log_ui_(new Ui_TranscodeLogDialog), log_dialog_(new QDialog(this)), transcoder_(new Transcoder(this)), queued_(0), finished_success_(0), finished_failed_(0) { ui_->setupUi(this); ui_->files->header()->setResizeMode(QHeaderView::ResizeToContents); log_ui_->setupUi(log_dialog_); QPushButton* clear_button = log_ui_->buttonBox->addButton(tr("Clear"), QDialogButtonBox::ResetRole); connect(clear_button, SIGNAL(clicked()), log_ui_->log, SLOT(clear())); // Get presets QList<TranscoderPreset> presets = Transcoder::GetAllPresets(); qSort(presets.begin(), presets.end(), ComparePresetsByName); for (const TranscoderPreset& preset : presets) { ui_->format->addItem( QString("%1 (.%2)").arg(preset.name_, preset.extension_), QVariant::fromValue(preset)); } // Load settings QSettings s; s.beginGroup(kSettingsGroup); last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString(); last_import_dir_ = s.value("last_import_dir", QDir::homePath()).toString(); QString last_output_format = s.value("last_output_format", "ogg").toString(); for (int i = 0; i < ui_->format->count(); ++i) { if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().extension_) { ui_->format->setCurrentIndex(i); break; } } // Add a start button start_button_ = ui_->button_box->addButton(tr("Start transcoding"), QDialogButtonBox::ActionRole); cancel_button_ = ui_->button_box->button(QDialogButtonBox::Cancel); close_button_ = ui_->button_box->button(QDialogButtonBox::Close); close_button_->setShortcut(QKeySequence::Close); // Hide elements cancel_button_->hide(); ui_->progress_group->hide(); // Connect stuff connect(ui_->add, SIGNAL(clicked()), SLOT(Add())); connect(ui_->import, SIGNAL(clicked()), SLOT(Import())); connect(ui_->remove, SIGNAL(clicked()), SLOT(Remove())); connect(start_button_, SIGNAL(clicked()), SLOT(Start())); connect(cancel_button_, SIGNAL(clicked()), SLOT(Cancel())); connect(close_button_, SIGNAL(clicked()), SLOT(hide())); connect(ui_->details, SIGNAL(clicked()), log_dialog_, SLOT(show())); connect(ui_->options, SIGNAL(clicked()), SLOT(Options())); connect(ui_->select, SIGNAL(clicked()), SLOT(AddDestination())); connect(transcoder_, SIGNAL(JobComplete(QString, bool)), SLOT(JobComplete(QString, bool))); connect(transcoder_, SIGNAL(LogLine(QString)), SLOT(LogLine(QString))); connect(transcoder_, SIGNAL(AllJobsComplete()), SLOT(AllJobsComplete())); }