/* Subtitle PTS in seconds (within the source, not taking into account any of the
source that we may have chopped off for the DCP)
*/
-- double const packet_time = (static_cast<double> (sub.pts ) / AV_TIME_BASE) + _video_pts_offset;
++ double const packet_time = (static_cast<double> (sub.pts ) / AV_TIME_BASE) + _pts_offset;
/* hence start time for this sub */
- Time const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ;
- Time const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ;
+ ContentTime const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ;
+ ContentTime const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ;
AVSubtitleRect const * rect = sub.rects[0];
boost::shared_ptr<Player> make_player () const;
boost::shared_ptr<Playlist> playlist () const;
- OutputAudioFrame audio_frame_rate () const;
+ AudioFrame audio_frame_rate () const;
- OutputAudioFrame time_to_audio_frames (Time) const;
- OutputVideoFrame time_to_video_frames (Time) const;
- Time video_frames_to_time (OutputVideoFrame) const;
- Time audio_frames_to_time (OutputAudioFrame) const;
+ AudioFrame time_to_audio_frames (DCPTime) const;
+ VideoFrame time_to_video_frames (DCPTime) const;
+ DCPTime video_frames_to_time (VideoFrame) const;
+ DCPTime audio_frames_to_time (AudioFrame) const;
+ uint64_t required_disk_space () const;
+ bool should_be_enough_disk_space (double &, double &) const;
+
/* Proxies for some Playlist methods */
ContentList content () const;
std::string identifier () const;
- void set_video_length (VideoContent::Frame);
+ void set_video_length (VideoFrame);
bool still () const;
+ void set_video_frame_rate (float);
};
#endif
/* Gain */
if (content->audio_gain() != 0) {
- shared_ptr<AudioBuffers> gain (new AudioBuffers (audio));
+ shared_ptr<AudioBuffers> gain (new AudioBuffers (audio->data));
gain->apply_gain (content->audio_gain ());
- audio = gain;
- }
-
- /* Resample */
- if (content->content_audio_frame_rate() != content->output_audio_frame_rate()) {
- shared_ptr<Resampler> r = resampler (content, true);
- pair<shared_ptr<const AudioBuffers>, AudioContent::Frame> ro = r->run (audio, frame);
- audio = ro.first;
- frame = ro.second;
- }
-
- Time const relative_time = _film->audio_frames_to_time (frame);
-
- if (content->trimmed (relative_time)) {
- return;
+ audio->data = gain;
}
- Time time = content->position() + (content->audio_delay() * TIME_HZ / 1000) + relative_time - content->trim_start ();
-
/* Remap channels */
- shared_ptr<AudioBuffers> dcp_mapped (new AudioBuffers (_film->audio_channels(), audio->frames()));
+ shared_ptr<AudioBuffers> dcp_mapped (new AudioBuffers (_film->audio_channels(), audio->data->frames()));
dcp_mapped->make_silent ();
- list<pair<int, libdcp::Channel> > map = content->audio_mapping().content_to_dcp ();
- for (list<pair<int, libdcp::Channel> >::iterator i = map.begin(); i != map.end(); ++i) {
- if (i->first < audio->data->channels() && i->second < dcp_mapped->channels()) {
- dcp_mapped->accumulate_channel (audio->data.get(), i->first, i->second);
-
+ AudioMapping map = content->audio_mapping ();
+ for (int i = 0; i < map.content_channels(); ++i) {
+ for (int j = 0; j < _film->audio_channels(); ++j) {
+ if (map.get (i, static_cast<libdcp::Channel> (j)) > 0) {
+ dcp_mapped->accumulate_channel (
- audio.get(),
++ audio->data.get(),
+ i,
+ static_cast<libdcp::Channel> (j),
+ map.get (i, static_cast<libdcp::Channel> (j))
+ );
+ }
}
}
}
- SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int)
+ SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version)
: Content (f, node)
, AudioContent (f, node)
- , _audio_mapping (node->node_child ("AudioMapping"))
+ , _audio_mapping (node->node_child ("AudioMapping"), version)
{
_audio_channels = node->number_child<int> ("AudioChannels");
- _audio_length = node->number_child<AudioContent::Frame> ("AudioLength");
+ _audio_length = node->number_child<AudioFrame> ("AudioLength");
_audio_frame_rate = node->number_child<int> ("AudioFrameRate");
}
protected:
void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
- VideoContent::Frame _video_length;
+ VideoFrame _video_length;
+ float _video_frame_rate;
private:
friend class ffmpeg_pts_offset_test;
}
void
- DCPTimecode::set (DCPTime t, int fps)
-Timecode::set (Time t, int fps)
++Timecode::set (DCPTime t, int fps)
{
int const h = t / (3600 * TIME_HZ);
t -= h * 3600 * TIME_HZ;
_fixed->SetLabel (wxString::Format ("%02d:%02d:%02d.%02d", h, m, s, f));
}
-Time
+DCPTime
- DCPTimecode::get (int fps) const
+ Timecode::get (int fps) const
{
- Time t = 0;
+ DCPTime t = 0;
string const h = wx_to_std (_hours->GetValue ());
t += lexical_cast<int> (h.empty() ? "0" : h) * 3600 * TIME_HZ;
string const m = wx_to_std (_minutes->GetValue());
#include <wx/wx.h>
#include "lib/types.h"
- class DCPTimecode : public wxPanel
+ class Timecode : public wxPanel
{
public:
- DCPTimecode (wxWindow *);
+ Timecode (wxWindow *);
- void set (Time, int);
- Time get (int) const;
+ void set (DCPTime, int);
+ DCPTime get (int) const;
void set_editable (bool);