/** @internal @This handles and outputs a frame. * * @param upipe description structure of the pipe * @param upump_p reference to pump that generated the buffer */ static void upipe_s337d_output_frame(struct upipe *upipe, struct upump **upump_p) { struct upipe_s337d *upipe_s337d = upipe_s337d_from_upipe(upipe); /* assume repetition rate and shift dts backwards */ size_t samples = upipe_s337d->next_uref_size / 4; uint64_t dts_shift = (uint64_t)samples * UCLOCK_FREQ / upipe_s337d->sample_rate; struct uref au_uref_s = *upipe_s337d->next_uref; /* consume burst preamble */ upipe_s337d_consume_uref_stream(upipe, S337_PREAMBLE_SIZE); /* extract burst payload */ struct uref *uref = upipe_s337d_extract_uref_stream(upipe, upipe_s337d->next_frame_size); if (unlikely(uref == NULL)) { upipe_throw_fatal(upipe, UBASE_ERR_ALLOC); return; } uint64_t date; #define SET_DATE(dv) \ if (ubase_check(uref_clock_get_dts_##dv(&au_uref_s, &date))) \ uref_clock_set_dts_##dv(uref, date - dts_shift); SET_DATE(sys) SET_DATE(prog) SET_DATE(orig) #undef SET_DATE upipe_s337d_output(upipe, uref, upump_p); }
/** @internal @This is called back by @ref upipe_a52f_append_uref_stream * whenever a new uref is promoted in next_uref. * * @param upipe description structure of the pipe */ static void upipe_a52f_promote_uref(struct upipe *upipe) { struct upipe_a52f *upipe_a52f = upipe_a52f_from_upipe(upipe); uint64_t date; #define SET_DATE(dv) \ if (ubase_check(uref_clock_get_dts_##dv(upipe_a52f->next_uref, &date))) \ uref_clock_set_dts_##dv(&upipe_a52f->au_uref_s, date); SET_DATE(sys) SET_DATE(prog) SET_DATE(orig) #undef SET_DATE uref_clock_get_rate(upipe_a52f->next_uref, &upipe_a52f->drift_rate); upipe_a52f->duration_residue = 0; }
/** @internal @This handles and outputs a frame. * * @param upipe description structure of the pipe * @param upump_p reference to pump that generated the buffer */ static void upipe_a52f_output_frame(struct upipe *upipe, struct upump **upump_p) { struct upipe_a52f *upipe_a52f = upipe_a52f_from_upipe(upipe); struct uref au_uref_s = upipe_a52f->au_uref_s; struct urational drift_rate = upipe_a52f->drift_rate; /* From now on, PTS declaration only impacts the next frame. */ upipe_a52f_flush_dates(upipe); struct uref *uref = upipe_a52f_extract_uref_stream(upipe, upipe_a52f->next_frame_size); if (unlikely(uref == NULL)) { upipe_throw_fatal(upipe, UBASE_ERR_ALLOC); return; } lldiv_t div = lldiv(A52_FRAME_SAMPLES * UCLOCK_FREQ + upipe_a52f->duration_residue, upipe_a52f->samplerate); uint64_t duration = div.quot; upipe_a52f->duration_residue = div.rem; /* We work on encoded data so in the DTS domain. Rebase on DTS. */ uint64_t date; #define SET_DATE(dv) \ if (ubase_check(uref_clock_get_dts_##dv(&au_uref_s, &date))) { \ uref_clock_set_dts_##dv(uref, date); \ uref_clock_set_dts_##dv(&upipe_a52f->au_uref_s, date + duration); \ } else if (ubase_check(uref_clock_get_dts_##dv(uref, &date))) \ uref_clock_set_date_##dv(uref, UINT64_MAX, UREF_DATE_NONE); SET_DATE(sys) SET_DATE(prog) SET_DATE(orig) #undef SET_DATE uref_clock_set_dts_pts_delay(uref, 0); if (drift_rate.den) uref_clock_set_rate(uref, drift_rate); else uref_clock_delete_rate(uref); UBASE_FATAL(upipe, uref_clock_set_duration(uref, duration)) if (upipe_a52f->got_discontinuity) uref_flow_set_discontinuity(uref); upipe_a52f->got_discontinuity = false; upipe_a52f_output(upipe, uref, upump_p); }
void QAdakDate::REFRESH_DATE() { m_date_str = QDATE().toString(m_date_format); if ( m_date_str.isEmpty() EQ true ) { if ( m_old_date.isValid() EQ true ) { SET_DATE( m_old_date ); } else { if (m_mali_yil_disable EQ false) { SET_DATE( MALI_YIL_FIRST_DATE()); } else { SET_DATE( QDate::currentDate() ); } } return; } if (m_date_str EQ line_edit->text()) { return; } if ( m_mali_yil_disable EQ true) { line_edit->setText( m_date_str ); } else { // false ise if ( m_current_date >= MALI_YIL_FIRST_DATE() AND m_current_date <= MALI_ARRAY_LAST_DATE() ) { line_edit->setText( m_date_str ); } else { if( m_date_changed EQ true ) { QMessageBox::information( this, tr( "Uyarı" ), tr("Girmiş olduğunuz tarih mali yıl içinde değil, lütfen yeni bir tarih girin.!")); m_date_changed = false; } if ( m_current_date < MALI_YIL_FIRST_DATE() ) { line_edit->setText( MALI_YIL_FIRST_DATE().toString( m_date_format ) ); } else { line_edit->setText( MALI_ARRAY_LAST_DATE().toString( m_date_format ) ); } } } if ( signalsBlocked() EQ false ) { emit SIGNAL_DATE_CHANGED(); } }
void QAdakDate::TRY_TO_SET_DATE(const QString &date_str) { Q_UNUSED(date_str); int current_year; if (m_mali_yil_disable EQ true) { current_year = QDate::currentDate().year(); } else { current_year = MALI_YIL(); } int current_month = QDate::currentDate().month(); int current_day = QDate::currentDate().day(); QDate current_date = QDate::currentDate(); if ( line_edit->text() EQ m_date_str ) { return; } // tarih degismedi ise bir sey yapma if ( line_edit->isModified() EQ false ) { return; } QString user_text = line_edit->text(); if (user_text EQ "00") { SET_DATE(current_date); } if ( user_text.size() >= 2 ) { current_day = user_text.mid(0,2).toInt(); } if ( user_text.size() >= 4 ) { current_month = user_text.mid(2,2).toInt(); } if ( user_text.size() > 4 ) { current_year = user_text.mid(4,4).toInt(); } current_date.setYMD(current_year,current_month,current_day); SET_DATE( current_date ); }
QAdakDate::QAdakDate(QWidget * parent) : QWidget(parent) { line_edit = new QLineEdit(this); line_edit->setObjectName("adak_date_line_edit"); line_edit->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); line_edit->installEventFilter(this); line_edit->setMaxLength(100); connect(line_edit,SIGNAL(editingFinished()),this,SLOT(SLOT_SET_DATE())); tool_button = new QToolButton(this); tool_button->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); tool_button->setToolButtonStyle(Qt::ToolButtonIconOnly); tool_button->setIcon(QIcon(":/kernel_icons/kernel_calendar_ikonu.png")); tool_button->setObjectName("adak_date_tool_button"); tool_button->setMaximumSize(32,line_edit->height() - 9); tool_button->setIconSize(QSize(tool_button->width(),line_edit->height() - 9)); tool_button->setFocusPolicy(Qt::ClickFocus); connect(tool_button,SIGNAL(clicked()),this,SLOT(SLOT_POPUP_BUTTON_CLICKED())); calendar_widget = new QCalendarWidget(this); calendar_widget->setFirstDayOfWeek ( Qt::Monday ); calendar_widget->setDateRange(MALI_YIL_FIRST_DATE(), MALI_ARRAY_LAST_DATE()); calendar_widget->setWindowFlags(Qt::Popup); calendar_widget->close(); connect(calendar_widget,SIGNAL(clicked(QDate)),this,SLOT(SLOT_POPUP_DATE_SELECTED(QDate))); h_box_layout = new QHBoxLayout(this); h_box_layout->setContentsMargins(0,0,0,0); h_box_layout->setSpacing(0); h_box_layout->addWidget(line_edit); h_box_layout->addWidget(tool_button); setLayout (h_box_layout); setFocusPolicy (Qt::StrongFocus); setFocusProxy (line_edit); setMaximumHeight(line_edit->height()); setTabOrder (line_edit,tool_button); m_mali_yil_disable = false; m_date_changed = false; m_current_date = QDate::currentDate(); m_old_date = QDate::currentDate(); SET_DATE_FORMAT ("dd MMMM yyyy dddd"); SET_DATE (QDate::currentDate()); }
/** @internal @This works on a telx frame and outputs it. * * @param upipe description structure of the pipe * @param upump_p reference to pump that generated the buffer */ static void upipe_telxf_work(struct upipe *upipe, struct upump **upump_p) { struct upipe_telxf *upipe_telxf = upipe_telxf_from_upipe(upipe); uint64_t octetrate = (upipe_telxf->next_uref_size * upipe_telxf->fps.num + upipe_telxf->fps.den - 1) / upipe_telxf->fps.den; if (octetrate != upipe_telxf->octetrate) { upipe_telxf->octetrate = octetrate; struct uref *flow_def = upipe_telxf_alloc_flow_def_attr(upipe); if (unlikely(flow_def == NULL)) { upipe_throw_fatal(upipe, UBASE_ERR_ALLOC); uref_free(upipe_telxf->next_uref); goto upipe_telxf_work_err; } UBASE_FATAL(upipe, uref_pic_flow_set_fps(flow_def, upipe_telxf->fps)) UBASE_FATAL(upipe, uref_block_flow_set_octetrate(flow_def, upipe_telxf->octetrate)) flow_def = upipe_telxf_store_flow_def_attr(upipe, flow_def); if (unlikely(flow_def == NULL)) { upipe_throw_fatal(upipe, UBASE_ERR_ALLOC); uref_free(upipe_telxf->next_uref); goto upipe_telxf_work_err; } upipe_telxf_store_flow_def(upipe, flow_def); } upipe_telxf_sync_acquired(upipe); uint64_t duration = UCLOCK_FREQ * upipe_telxf->fps.den / upipe_telxf->fps.num; /* We work on encoded data so in the DTS domain. Rebase on DTS. */ uint64_t date; struct urational drift_rate; drift_rate.den = 0; uref_clock_get_rate(upipe_telxf->next_uref, &drift_rate); #define SET_DATE(dv) \ if (ubase_check(uref_clock_get_dts_##dv(upipe_telxf->next_uref, &date)))\ uref_clock_set_dts_##dv(&upipe_telxf->au_uref_s, date); \ if (ubase_check(uref_clock_get_dts_##dv(&upipe_telxf->au_uref_s, \ &date))) { \ uref_clock_set_dts_##dv(upipe_telxf->next_uref, date); \ uref_clock_set_dts_##dv(&upipe_telxf->au_uref_s, date + duration); \ } else if (ubase_check(uref_clock_get_cr_##dv(upipe_telxf->next_uref, \ &date))) { \ /* EN 300 472 Annex A */ \ uref_clock_set_dts_##dv(upipe_telxf->next_uref, \ date + MAX_DELAY_TELX); \ uref_clock_set_dts_##dv(&upipe_telxf->au_uref_s, date + \ MAX_DELAY_TELX + duration); \ } SET_DATE(sys) SET_DATE(prog) SET_DATE(orig) #undef SET_DATE uref_clock_set_dts_pts_delay(upipe_telxf->next_uref, 0); if (drift_rate.den) uref_clock_set_rate(upipe_telxf->next_uref, drift_rate); upipe_telxf_output(upipe, upipe_telxf->next_uref, upump_p); upipe_telxf_work_err: upipe_telxf->next_uref = NULL; upipe_telxf->next_uref_size = 0; }
void QAdakDate::SET_DATE(const QString& date) { SET_DATE ( QDate::fromString( date, "yyyy.MM.dd" )); }
void QAdakDate::SLOT_POPUP_DATE_SELECTED(const QDate& date) { calendar_widget->close(); SET_DATE( date ); }