return;
}
- if (_film->video_range ()) {
- pair<SourceFrame, SourceFrame> const r = _film->video_range().get();
- if (_video_frame < r.first || _video_frame >= r.second) {
- ++_video_frame;
- return;
- }
- }
-
boost::mutex::scoped_lock lock (_worker_mutex);
/* Wait until the queue has gone down a bit */
void
Encoder::process_audio (shared_ptr<AudioBuffers> data)
{
- if (_film->audio_range ()) {
- shared_ptr<AudioBuffers> trimmed (new AudioBuffers (*data.get ()));
-
- /* Range that we are encoding */
- pair<int64_t, int64_t> required_range = _film->audio_range().get();
- /* Range of this block of data */
- pair<int64_t, int64_t> this_range (_audio_frame, _audio_frame + trimmed->frames());
-
- if (this_range.second < required_range.first || required_range.second < this_range.first) {
- /* No part of this audio is within the required range */
- return;
- } else if (required_range.first >= this_range.first && required_range.first < this_range.second) {
- /* Trim start */
- int64_t const shift = required_range.first - this_range.first;
- trimmed->move (shift, 0, trimmed->frames() - shift);
- trimmed->set_frames (trimmed->frames() - shift);
- } else if (required_range.second >= this_range.first && required_range.second < this_range.second) {
- /* Trim end */
- trimmed->set_frames (required_range.second - this_range.first);
- }
-
- data = trimmed;
- }
-
#if HAVE_SWRESAMPLE
/* Maybe sample-rate convert */
if (_swr_context) {
return s.str ();
}
-boost::optional<pair<SourceFrame, SourceFrame> >
-Film::video_range () const
-{
- if (!dcp_length()) {
- return boost::optional<pair<SourceFrame, SourceFrame> > ();
- }
-
- return make_pair (trim_start(), trim_start() + dcp_length().get());
-}
-
-boost::optional<pair<int64_t, int64_t> >
-Film::audio_range () const
-{
- boost::optional<pair<SourceFrame, SourceFrame> > vr = video_range ();
- if (!vr || !audio_stream()) {
- return boost::optional<pair<int64_t, int64_t> > ();
- }
-
- DCPFrameRate dfr (frames_per_second ());
- return make_pair (
-
- video_frames_to_audio_frames (
- vr.get().first,
- dcp_audio_sample_rate (audio_stream()->sample_rate()),
- dfr.frames_per_second
- ),
-
- video_frames_to_audio_frames (
- vr.get().second,
- dcp_audio_sample_rate (audio_stream()->sample_rate()),
- dfr.frames_per_second
- )
- );
-}
}
int audio_channels () const;
- boost::optional<std::pair<SourceFrame, SourceFrame> > video_range () const;
- boost::optional<std::pair<int64_t, int64_t> > audio_range () const;
void set_dci_date_today ();
_film->format()->dcp_size().height
)
);
+
+ pa->set_entry_point (_film->trim_start ());
+ pa->set_duration (_film->duration ());
ascend ();
dcp_audio_channels (_film->audio_channels())
)
);
+
+ sa->set_entry_point (_film->trim_start ());
+ sa->set_duration (_film->duration ());
+
ascend ();
}