Also remove references to libpostproc.
Requested-by: Jean-Jacques Mantello
+2014-03-18 Carl Hetherington <cth@carlh.net>
+
+ * Tentative support for 3D from alternate frames of the source.
+
2014-03-17 Carl Hetherington <cth@carlh.net>
* Improve behaviour of the position slider at the end of films.
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
-#include <libpostproc/postprocess.h>
}
#include "ffmpeg.h"
#include "ffmpeg_content.h"
stringstream s;
- s << String::compose (_("%1 frames; %2 frames per second"), video_length(), video_frame_rate()) << "\n";
+ s << String::compose (_("%1 frames; %2 frames per second"), video_length_after_3d_combine(), video_frame_rate()) << "\n";
s << VideoContent::information ();
return s.str ();
{
int const cafr = content_audio_frame_rate ();
int const vfr = video_frame_rate ();
- VideoContent::Frame const vl = video_length ();
+ VideoContent::Frame const vl = video_length_after_3d_combine ();
boost::mutex::scoped_lock lm (_mutex);
if (!_audio_stream) {
assert (film);
FrameRateConversion frc (video_frame_rate (), film->video_frame_rate ());
- return video_length() * frc.factor() * TIME_HZ / film->video_frame_rate ();
+ return video_length_after_3d_combine() * frc.factor() * TIME_HZ / film->video_frame_rate ();
}
AudioMapping
}
/* Stop us being asked for any more data */
- _video_position = _ffmpeg_content->video_length ();
+ _video_position = _ffmpeg_content->video_length_after_3d_combine ();
_audio_position = _ffmpeg_content->audio_length ();
}
#include <boost/thread/mutex.hpp>
extern "C" {
#include <libavcodec/avcodec.h>
-#include <libpostproc/postprocess.h>
}
#include "util.h"
#include "decoder.h"
#include <libswscale/swscale.h>
#include <libavutil/pixfmt.h>
#include <libavutil/pixdesc.h>
-#include <libpostproc/postprocess.h>
}
#include "image.h"
#include "exceptions.h"
assert (film);
FrameRateConversion frc (video_frame_rate(), film->video_frame_rate ());
- return video_length() * frc.factor() * TIME_HZ / video_frame_rate();
+ return video_length_after_3d_combine() * frc.factor() * TIME_HZ / video_frame_rate();
}
string
public:
Scaler (int f, std::string i, std::string n);
- /** @return id used for calls to FFmpeg's pp_postprocess */
+ /** @return id used for calls to FFmpeg's sws_getContext */
int ffmpeg_id () const {
return _ffmpeg_id;
}
{
VIDEO_FRAME_TYPE_2D,
VIDEO_FRAME_TYPE_3D_LEFT_RIGHT,
- VIDEO_FRAME_TYPE_3D_TOP_BOTTOM
+ VIDEO_FRAME_TYPE_3D_TOP_BOTTOM,
+ VIDEO_FRAME_TYPE_3D_ALTERNATE
};
enum Eyes
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavfilter/avfiltergraph.h>
-#include <libpostproc/postprocess.h>
#include <libavutil/pixfmt.h>
}
#include "util.h"
<< N_("libavfilter ") << ffmpeg_version_to_string (avfilter_version()) << N_(", ")
<< N_("libavformat ") << ffmpeg_version_to_string (avformat_version()) << N_(", ")
<< N_("libavutil ") << ffmpeg_version_to_string (avutil_version()) << N_(", ")
- << N_("libpostproc ") << ffmpeg_version_to_string (postproc_version()) << N_(", ")
<< N_("libswscale ") << ffmpeg_version_to_string (swscale_version()) << N_(", ")
<< MagickVersion << N_(", ")
<< N_("libssh ") << ssh_version (0) << N_(", ")
string
VideoContent::technical_summary () const
{
- return String::compose ("video: length %1, size %2x%3, rate %4", video_length(), video_size().width, video_size().height, video_frame_rate());
+ return String::compose (
+ "video: length %1, size %2x%3, rate %4",
+ video_length_after_3d_combine(), video_size().width, video_size().height, video_frame_rate()
+ );
}
libdcp::Size
libdcp::Size const s = video_size ();
switch (video_frame_type ()) {
case VIDEO_FRAME_TYPE_2D:
+ case VIDEO_FRAME_TYPE_3D_ALTERNATE:
return s;
case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
return libdcp::Size (s.width / 2, s.height);
return _video_length;
}
+ VideoContent::Frame video_length_after_3d_combine () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_video_frame_type == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
+ return _video_length / 2;
+ }
+
+ return _video_length;
+ }
+
libdcp::Size video_size () const {
boost::mutex::scoped_lock lm (_mutex);
return _video_size;
case VIDEO_FRAME_TYPE_2D:
Video (image, EYES_BOTH, same, frame);
break;
+ case VIDEO_FRAME_TYPE_3D_ALTERNATE:
+ Video (image, (frame % 2) ? EYES_RIGHT : EYES_LEFT, same, frame / 2);
+ break;
case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
{
int const half = image->size().width / 2;
void video (boost::shared_ptr<const Image>, bool, VideoContent::Frame);
boost::shared_ptr<const VideoContent> _video_content;
+ /** This is in frames without taking 3D into account (e.g. if we are doing 3D alternate,
+ * this would equal 2 on the left-eye second frame (not 1)).
+ */
VideoContent::Frame _video_position;
};
} else {
_position->set (0, 24);
}
- } else if (property == ContentProperty::LENGTH || property == VideoContentProperty::VIDEO_FRAME_RATE) {
+ } else if (
+ property == ContentProperty::LENGTH ||
+ property == VideoContentProperty::VIDEO_FRAME_RATE ||
+ property == VideoContentProperty::VIDEO_FRAME_TYPE
+ ) {
if (content) {
_full_length->set (content->full_length (), _editor->film()->video_frame_rate ());
_play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
_frame_type->wrapped()->Append (_("2D"));
_frame_type->wrapped()->Append (_("3D left/right"));
_frame_type->wrapped()->Append (_("3D top/bottom"));
+ _frame_type->wrapped()->Append (_("3D alternate"));
_filters_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_filters_clicked, this));
_colour_conversion_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
film->examine_and_add_content (A);
wait_for_jobs ();
- BOOST_CHECK_EQUAL (A->video_length(), 16);
+ BOOST_CHECK_EQUAL (A->video_length_after_3d_combine(), 16);
shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/red_30.mp4"));
film->examine_and_add_content (B);
wait_for_jobs ();
- BOOST_CHECK_EQUAL (B->video_length(), 16);
+ BOOST_CHECK_EQUAL (B->video_length_after_3d_combine(), 16);
/* Film should have been set to 25fps */
BOOST_CHECK_EQUAL (film->video_frame_rate(), 25);