{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), false));
+ decoder.reset (new DCPDecoder (film, shared_from_this(), false));
} catch (dcp::DCPReadError) {
/* We couldn't read the DCP, so it's probably missing */
return false;
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), false));
+ decoder.reset (new DCPDecoder (film, shared_from_this(), false));
} catch (dcp::DCPReadError) {
+
/* We couldn't read the DCP, so it's probably missing */
return false;
} catch (dcp::KDMDecryptionError) {
using boost::dynamic_pointer_cast;
using boost::optional;
-DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, bool fast)
+DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> c, bool fast)
: DCP (c)
+ , Decoder (film)
, _decode_referenced (false)
{
if (c->video) {
bool
-DCPDecoder::pass (shared_ptr<const Film> film)
+DCPDecoder::pass ()
{
if (_reel == _reels.end () || !_dcp_content->can_be_played ()) {
return true;
}
- double const vfr = _dcp_content->active_video_frame_rate (film);
+ double const vfr = _dcp_content->active_video_frame_rate (film());
/* Frame within the (played part of the) reel that is coming up next */
int64_t const frame = _next.frames_round (vfr);
/* We must emit texts first as when we emit the video for this frame
it will expect already to have the texts.
*/
- pass_texts (film, _next, picture_asset->size());
+ pass_texts (_next, picture_asset->size());
if ((_mono_reader || _stereo_reader) && (_decode_referenced || !_dcp_content->reference_video())) {
int64_t const entry_point = (*_reel)->main_picture()->entry_point ();
if (_mono_reader) {
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (
new J2KImageProxy (
_mono_reader->get_frame (entry_point + frame),
);
} else {
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (
new J2KImageProxy (
_stereo_reader->get_frame (entry_point + frame),
);
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (
new J2KImageProxy (
_stereo_reader->get_frame (entry_point + frame),
}
}
- audio->emit (film, _dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next);
+ audio->emit (film(), _dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next);
}
_next += ContentTime::from_frames (1, vfr);
}
void
-DCPDecoder::pass_texts (shared_ptr<const Film> film, ContentTime next, dcp::Size size)
+DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
{
list<shared_ptr<TextDecoder> >::const_iterator decoder = text.begin ();
if ((*_reel)->main_subtitle()) {
DCPOMATIC_ASSERT (decoder != text.end ());
pass_texts (
- film,
next,
(*_reel)->main_subtitle()->asset(),
_dcp_content->reference_text(TEXT_OPEN_SUBTITLE),
BOOST_FOREACH (shared_ptr<dcp::ReelClosedCaptionAsset> i, (*_reel)->closed_captions()) {
DCPOMATIC_ASSERT (decoder != text.end ());
pass_texts (
- film, next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point(), *decoder, size
+ next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point(), *decoder, size
);
++decoder;
}
void
DCPDecoder::pass_texts (
- shared_ptr<const Film> film, ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size
+ ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size
)
{
- double const vfr = _dcp_content->active_video_frame_rate (film);
+ double const vfr = _dcp_content->active_video_frame_rate (film());
/* Frame within the (played part of the) reel that is coming up next */
int64_t const frame = next.frames_round (vfr);
}
void
-DCPDecoder::seek (shared_ptr<const Film> film, ContentTime t, bool accurate)
+DCPDecoder::seek (ContentTime t, bool accurate)
{
if (!_dcp_content->can_be_played ()) {
return;
}
- Decoder::seek (film, t, accurate);
+ Decoder::seek (t, accurate);
_reel = _reels.begin ();
_offset = 0;
/* Seek to pre-roll position */
- while (_reel != _reels.end() && pre >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film))) {
- ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film));
+ while (_reel != _reels.end() && pre >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film()))) {
+ ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film()));
pre -= rd;
t -= rd;
next_reel ();
/* Pass texts in the pre-roll */
- double const vfr = _dcp_content->active_video_frame_rate (film);
+ double const vfr = _dcp_content->active_video_frame_rate (film());
for (int i = 0; i < pre_roll_seconds * vfr; ++i) {
- pass_texts (film, pre, (*_reel)->main_picture()->asset()->size());
+ pass_texts (pre, (*_reel)->main_picture()->asset()->size());
pre += ContentTime::from_frames (1, vfr);
}
/* Seek to correct position */
- while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film))) {
- t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film));
+ while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film()))) {
+ t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film()));
next_reel ();
}
class DCPDecoder : public DCP, public Decoder
{
public:
- DCPDecoder (boost::shared_ptr<const DCPContent>, bool fast);
+ DCPDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const DCPContent>, bool fast);
std::list<boost::shared_ptr<dcp::Reel> > reels () const {
return _reels;
void set_decode_referenced (bool r);
void set_forced_reduction (boost::optional<int> reduction);
- bool pass (boost::shared_ptr<const Film> film);
- void seek (boost::shared_ptr<const Film> film, ContentTime t, bool accurate);
+ bool pass ();
+ void seek (ContentTime t, bool accurate);
private:
friend struct dcp_subtitle_within_dcp_test;
void next_reel ();
void get_readers ();
- void pass_texts (boost::shared_ptr<const Film> film, ContentTime next, dcp::Size size);
+ void pass_texts (ContentTime next, dcp::Size size);
void pass_texts (
- boost::shared_ptr<const Film> film,
ContentTime next,
boost::shared_ptr<dcp::SubtitleAsset> asset,
bool reference,
using boost::dynamic_pointer_cast;
using boost::bind;
-DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content)
+DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const Film> film, shared_ptr<const DCPSubtitleContent> content)
+ : Decoder (film)
{
shared_ptr<dcp::SubtitleAsset> c (load (content->path (0)));
_subtitles = c->subtitles ();
}
void
-DCPSubtitleDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
+DCPSubtitleDecoder::seek (ContentTime time, bool accurate)
{
- Decoder::seek (film, time, accurate);
+ Decoder::seek (time, accurate);
_next = _subtitles.begin ();
list<shared_ptr<dcp::Subtitle> >::const_iterator i = _subtitles.begin ();
}
bool
-DCPSubtitleDecoder::pass (shared_ptr<const Film>)
+DCPSubtitleDecoder::pass ()
{
if (_next == _subtitles.end ()) {
return true;
class DCPSubtitleDecoder : public DCPSubtitle, public Decoder
{
public:
- DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>);
+ DCPSubtitleDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const DCPSubtitleContent>);
- bool pass (boost::shared_ptr<const Film> film);
- void seek (boost::shared_ptr<const Film> film, ContentTime time, bool accurate);
+ bool pass ();
+ void seek (ContentTime time, bool accurate);
private:
ContentTimePeriod content_time_period (boost::shared_ptr<dcp::Subtitle> s) const;
using std::cout;
using boost::optional;
using boost::shared_ptr;
+using boost::weak_ptr;
+
+Decoder::Decoder (weak_ptr<const Film> film)
+ : _film (film)
+{
+
+}
/** @return Earliest time of content that the next pass() will emit */
ContentTime
-Decoder::position (shared_ptr<const Film> film) const
+Decoder::position () const
{
optional<ContentTime> pos;
+ shared_ptr<const Film> f = film();
- if (video && !video->ignore() && (!pos || video->position(film) < *pos)) {
- pos = video->position(film);
+ if (video && !video->ignore() && (!pos || video->position(f) < *pos)) {
+ pos = video->position(f);
}
- if (audio && !audio->ignore() && (!pos || audio->position(film) < *pos)) {
- pos = audio->position(film);
+ if (audio && !audio->ignore() && (!pos || audio->position(f) < *pos)) {
+ pos = audio->position(f);
}
BOOST_FOREACH (shared_ptr<TextDecoder> i, text) {
- if (!i->ignore() && (!pos || i->position(film) < *pos)) {
- pos = i->position(film);
+ if (!i->ignore() && (!pos || i->position(f) < *pos)) {
+ pos = i->position(f);
}
}
}
void
-Decoder::seek (shared_ptr<const Film>, ContentTime, bool)
+Decoder::seek (ContentTime, bool)
{
if (video) {
video->seek ();
}
return text.front ();
}
+
+shared_ptr<const Film>
+Decoder::film () const
+{
+ shared_ptr<const Film> f = _film.lock ();
+ DCPOMATIC_ASSERT (f);
+ return f;
+}
#define DCPOMATIC_DECODER_H
#include "types.h"
+#include "film.h"
#include "dcpomatic_time.h"
#include <boost/utility.hpp>
class AudioDecoder;
class TextDecoder;
class DecoderPart;
-class Film;
/** @class Decoder.
* @brief Parent class for decoders of content.
class Decoder : public boost::noncopyable
{
public:
+ Decoder (boost::weak_ptr<const Film> film);
virtual ~Decoder () {}
boost::shared_ptr<VideoDecoder> video;
/** Do some decoding and perhaps emit video, audio or subtitle data.
* @return true if this decoder will emit no more data unless a seek() happens.
*/
- virtual bool pass (boost::shared_ptr<const Film> film) = 0;
- virtual void seek (boost::shared_ptr<const Film> film, ContentTime time, bool accurate);
+ virtual bool pass () = 0;
+ virtual void seek (ContentTime time, bool accurate);
- ContentTime position (boost::shared_ptr<const Film> film) const;
+ ContentTime position () const;
+
+protected:
+ boost::shared_ptr<const Film> film () const;
+
+private:
+ boost::weak_ptr<const Film> _film;
};
#endif
shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
if (dc) {
try {
- return shared_ptr<Decoder> (new DCPDecoder(dc, fast));
+ return shared_ptr<Decoder> (new DCPDecoder(film, dc, fast));
} catch (KDMError& e) {
/* This will be found and reported to the user when the content is examined */
return shared_ptr<Decoder>();
shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
if (ic) {
- return shared_ptr<Decoder> (new ImageDecoder(ic));
+ return shared_ptr<Decoder> (new ImageDecoder(film, ic));
}
shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
if (rc) {
- return shared_ptr<Decoder> (new StringTextFileDecoder(rc));
+ return shared_ptr<Decoder> (new StringTextFileDecoder(film, rc));
}
shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
if (dsc) {
- return shared_ptr<Decoder> (new DCPSubtitleDecoder(dsc));
+ return shared_ptr<Decoder> (new DCPSubtitleDecoder(film, dsc));
}
shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
if (vmc) {
- return shared_ptr<Decoder> (new VideoMXFDecoder(vmc));
+ return shared_ptr<Decoder> (new VideoMXFDecoder(film, vmc));
}
return shared_ptr<Decoder> ();
FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmpegContent> c, bool fast)
: FFmpeg (c)
+ , Decoder (film)
, _have_current_subtitle (false)
{
if (c->video) {
}
void
-FFmpegDecoder::flush (shared_ptr<const Film> film)
+FFmpegDecoder::flush ()
{
/* Get any remaining frames */
/* XXX: should we reset _packet.data and size after each *_decode_* call? */
- while (video && decode_video_packet(film)) {}
+ while (video && decode_video_packet()) {}
if (audio) {
- decode_audio_packet (film);
+ decode_audio_packet ();
}
/* Make sure all streams are the same length and round up to the next video frame */
- FrameRateChange const frc = film->active_frame_rate_change(_ffmpeg_content->position());
- ContentTime full_length (_ffmpeg_content->full_length(film), frc);
+ FrameRateChange const frc = film()->active_frame_rate_change(_ffmpeg_content->position());
+ ContentTime full_length (_ffmpeg_content->full_length(film()), frc);
full_length = full_length.ceil (frc.source);
if (video) {
double const vfr = _ffmpeg_content->video_frame_rate().get();
Frame const f = full_length.frames_round (vfr);
- Frame v = video->position(film).frames_round (vfr) + 1;
+ Frame v = video->position(film()).frames_round(vfr) + 1;
while (v < f) {
- video->emit (film, shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
+ video->emit (film(), shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
++v;
}
}
BOOST_FOREACH (shared_ptr<FFmpegAudioStream> i, _ffmpeg_content->ffmpeg_audio_streams ()) {
- ContentTime a = audio->stream_position(film, i);
+ ContentTime a = audio->stream_position(film(), i);
/* Unfortunately if a is 0 that really means that we don't know the stream position since
there has been no data on it since the last seek. In this case we'll just do nothing
here. I'm not sure if that's the right idea.
ContentTime to_do = min (full_length - a, ContentTime::from_seconds (0.1));
shared_ptr<AudioBuffers> silence (new AudioBuffers (i->channels(), to_do.frames_ceil (i->frame_rate())));
silence->make_silent ();
- audio->emit (film, i, silence, a);
+ audio->emit (film(), i, silence, a);
a += to_do;
}
}
}
bool
-FFmpegDecoder::pass (shared_ptr<const Film> film)
+FFmpegDecoder::pass ()
{
int r = av_read_frame (_format_context, &_packet);
LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), &buf[0], r);
}
- flush (film);
+ flush ();
return true;
}
shared_ptr<const FFmpegContent> fc = _ffmpeg_content;
if (_video_stream && si == _video_stream.get() && !video->ignore()) {
- decode_video_packet (film);
+ decode_video_packet ();
} else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) {
decode_subtitle_packet ();
} else {
- decode_audio_packet (film);
+ decode_audio_packet ();
}
av_packet_unref (&_packet);
}
void
-FFmpegDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
+FFmpegDecoder::seek (ContentTime time, bool accurate)
{
- Decoder::seek (film, time, accurate);
+ Decoder::seek (time, accurate);
/* If we are doing an `accurate' seek, we need to use pre-roll, as
we don't really know what the seek will give us.
}
void
-FFmpegDecoder::decode_audio_packet (shared_ptr<const Film> film)
+FFmpegDecoder::decode_audio_packet ()
{
/* Audio packets can contain multiple frames, so we may have to call avcodec_decode_audio4
several times.
/* Give this data provided there is some, and its time is sane */
if (ct >= ContentTime() && data->frames() > 0) {
- audio->emit (film, *stream, data, ct);
+ audio->emit (film(), *stream, data, ct);
}
}
}
bool
-FFmpegDecoder::decode_video_packet (shared_ptr<const Film> film)
+FFmpegDecoder::decode_video_packet ()
{
DCPOMATIC_ASSERT (_video_stream);
double const pts = i->second * av_q2d (_format_context->streams[_video_stream.get()]->time_base) + _pts_offset.seconds ();
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (new RawImageProxy (image)),
- llrint(pts * _ffmpeg_content->active_video_frame_rate(film))
+ llrint(pts * _ffmpeg_content->active_video_frame_rate(film()))
);
} else {
LOG_WARNING_NC ("Dropping frame without PTS");
public:
FFmpegDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const FFmpegContent>, bool fast);
- bool pass (boost::shared_ptr<const Film> film);
- void seek (boost::shared_ptr<const Film> film, ContentTime time, bool);
+ bool pass ();
+ void seek (ContentTime time, bool);
private:
friend struct ::ffmpeg_pts_offset_test;
- void flush (boost::shared_ptr<const Film> film);
+ void flush ();
AVSampleFormat audio_sample_format (boost::shared_ptr<FFmpegAudioStream> stream) const;
int bytes_per_audio_sample (boost::shared_ptr<FFmpegAudioStream> stream) const;
- bool decode_video_packet (boost::shared_ptr<const Film> film);
- void decode_audio_packet (boost::shared_ptr<const Film> film);
+ bool decode_video_packet ();
+ void decode_audio_packet ();
void decode_subtitle_packet ();
void decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime from);
using boost::shared_ptr;
using dcp::Size;
-ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
- : _image_content (c)
+ImageDecoder::ImageDecoder (shared_ptr<const Film> film, shared_ptr<const ImageContent> c)
+ : Decoder (film)
+ , _image_content (c)
, _frame_video_position (0)
{
video.reset (new VideoDecoder (this, c));
}
bool
-ImageDecoder::pass (boost::shared_ptr<const Film> film)
+ImageDecoder::pass ()
{
if (_frame_video_position >= _image_content->video->length()) {
return true;
}
}
- video->emit (film, _image, _frame_video_position);
+ video->emit (film(), _image, _frame_video_position);
++_frame_video_position;
return false;
}
void
-ImageDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
+ImageDecoder::seek (ContentTime time, bool accurate)
{
- Decoder::seek (film, time, accurate);
- _frame_video_position = time.frames_round (_image_content->active_video_frame_rate(film));
+ Decoder::seek (
+ time, accurate);
+ _frame_video_position = time.frames_round (_image_content->active_video_frame_rate(film()));
}
class ImageDecoder : public Decoder
{
public:
- ImageDecoder (boost::shared_ptr<const ImageContent> c);
+ ImageDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const ImageContent> c);
boost::shared_ptr<const ImageContent> content () {
return _image_content;
}
- bool pass (boost::shared_ptr<const Film> film);
- void seek (boost::shared_ptr<const Film> film, ContentTime, bool);
+ bool pass ();
+ void seek (ContentTime, bool);
private:
scoped_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (j, false));
+ decoder.reset (new DCPDecoder (_film, j, false));
} catch (...) {
return a;
}
continue;
}
- DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(_film), i->content->trim_start()));
+ DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start()));
if (t > i->content->end(_film)) {
i->done = true;
} else {
switch (which) {
case CONTENT:
- earliest_content->done = earliest_content->decoder->pass (_film);
+ earliest_content->done = earliest_content->decoder->pass ();
break;
case BLACK:
emit_video (black_player_video_frame(EYES_BOTH), _black.position());
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
if (time < i->content->position()) {
/* Before; seek to the start of the content */
- i->decoder->seek (_film, dcp_to_content_time (i, i->content->position()), accurate);
+ i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate);
i->done = false;
} else if (i->content->position() <= time && time < i->content->end(_film)) {
/* During; seek to position */
- i->decoder->seek (_film, dcp_to_content_time (i, time), accurate);
+ i->decoder->seek (dcp_to_content_time (i, time), accurate);
i->done = false;
} else {
/* After; this piece is done */
using boost::optional;
using boost::dynamic_pointer_cast;
-StringTextFileDecoder::StringTextFileDecoder (shared_ptr<const StringTextFileContent> content)
- : StringTextFile (content)
+StringTextFileDecoder::StringTextFileDecoder (shared_ptr<const Film> film, shared_ptr<const StringTextFileContent> content)
+ : Decoder (film)
+ , StringTextFile (content)
, _next (0)
{
ContentTime first;
}
void
-StringTextFileDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
+StringTextFileDecoder::seek (ContentTime time, bool accurate)
{
/* It's worth back-tracking a little here as decoding is cheap and it's nice if we don't miss
too many subtitles when seeking.
time = ContentTime();
}
- Decoder::seek (film, time, accurate);
+ Decoder::seek (time, accurate);
_next = 0;
while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
}
bool
-StringTextFileDecoder::pass (shared_ptr<const Film>)
+StringTextFileDecoder::pass ()
{
if (_next >= _subtitles.size ()) {
return true;
class StringTextFileDecoder : public Decoder, public StringTextFile
{
public:
- StringTextFileDecoder (boost::shared_ptr<const StringTextFileContent>);
+ StringTextFileDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const StringTextFileContent>);
- void seek (boost::shared_ptr<const Film> film, ContentTime time, bool accurate);
- bool pass (boost::shared_ptr<const Film> film);
+ void seek (ContentTime time, bool accurate);
+ bool pass ();
private:
ContentTimePeriod content_time_period (sub::Subtitle s) const;
using boost::shared_ptr;
using boost::optional;
-VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const VideoMXFContent> content)
- : _content (content)
+VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const Film> film, shared_ptr<const VideoMXFContent> content)
+ : Decoder (film)
+ , _content (content)
{
video.reset (new VideoDecoder (this, content));
}
bool
-VideoMXFDecoder::pass (shared_ptr<const Film> film)
+VideoMXFDecoder::pass ()
{
- double const vfr = _content->active_video_frame_rate (film);
+ double const vfr = _content->active_video_frame_rate (film());
int64_t const frame = _next.frames_round (vfr);
+
if (frame >= _content->video->length()) {
return true;
}
if (_mono_reader) {
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (
new J2KImageProxy (_mono_reader->get_frame(frame), _size, AV_PIX_FMT_XYZ12LE, optional<int>())
),
);
} else {
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (
new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_LEFT, AV_PIX_FMT_XYZ12LE, optional<int>())
),
frame
);
video->emit (
- film,
+ film(),
shared_ptr<ImageProxy> (
new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_RIGHT, AV_PIX_FMT_XYZ12LE, optional<int>())
),
}
void
-VideoMXFDecoder::seek (shared_ptr<const Film> film, ContentTime t, bool accurate)
+VideoMXFDecoder::seek (ContentTime t, bool accurate)
{
- Decoder::seek (film, t, accurate);
+ Decoder::seek (t, accurate);
_next = t;
}
class VideoMXFDecoder : public Decoder
{
public:
- VideoMXFDecoder (boost::shared_ptr<const VideoMXFContent>);
+ VideoMXFDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const VideoMXFContent>);
- bool pass (boost::shared_ptr<const Film> film);
- void seek (boost::shared_ptr<const Film> film, ContentTime t, bool accurate);
+ bool pass ();
+ void seek (ContentTime t, bool accurate);
private:
i->Stop.connect (bind (&TextView::data_stop, this, _1));
}
}
- while (!decoder->pass (film)) {}
+ while (!decoder->pass ()) {}
SetSizerAndFit (sizer);
}
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, false));
+ shared_ptr<DCPDecoder> decoder (new DCPDecoder (film, content, false));
decoder->only_text()->PlainStart.connect (bind (store, _1));
stored = optional<ContentStringText> ();
- while (!decoder->pass(film) && !stored) {}
+ while (!decoder->pass() && !stored) {}
BOOST_REQUIRE (stored);
BOOST_REQUIRE_EQUAL (stored->subs.size(), 2);
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder(content));
+ shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder(film, content));
decoder->only_text()->PlainStart.connect (bind (store, _1));
stored = optional<ContentStringText> ();
- while (!decoder->pass(film)) {
+ while (!decoder->pass()) {
if (stored && stored->from() == ContentTime(0)) {
BOOST_CHECK_EQUAL (stored->subs.front().text(), "<b>Hello world!</b>");
}
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content));
+ shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (film, content));
stored = optional<ContentStringText> ();
- while (!decoder->pass (film)) {
+ while (!decoder->pass ()) {
decoder->only_text()->PlainStart.connect (bind (store, _1));
if (stored && stored->from() == ContentTime::from_seconds(0.08)) {
list<dcp::SubtitleString> s = stored->subs;
}
static void
-check (shared_ptr<const Film> film, shared_ptr<FFmpegDecoder> decoder, int frame)
+check (shared_ptr<FFmpegDecoder> decoder, int frame)
{
BOOST_REQUIRE (decoder->ffmpeg_content()->video_frame_rate ());
- decoder->seek (film, ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true);
+ decoder->seek (ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true);
stored = optional<ContentVideo> ();
- while (!decoder->pass(film) && !stored) {}
+ while (!decoder->pass() && !stored) {}
BOOST_CHECK (stored->frame <= frame);
}
decoder->video->Data.connect (bind (&store, _1));
for (vector<int>::const_iterator i = frames.begin(); i != frames.end(); ++i) {
- check (film, decoder, *i);
+ check (decoder, *i);
}
}