]> git.sesse.net Git - casparcg/commitdiff
2.0. ffmpeg_producer: Calculate nb_frames correctly when running auto-mode with frame...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 11 Aug 2011 09:00:51 +0000 (09:00 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 11 Aug 2011 09:00:51 +0000 (09:00 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1138 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/frame_muxer.cpp
modules/ffmpeg/producer/frame_muxer.h

index 0a999aa362cb387ab8570fa41b6a7aefe9930680..13d27dfe54dd6054c8eced1dd110a3958ffe0685 100644 (file)
@@ -203,6 +203,8 @@ public:
                        nb_frames = std::max(nb_frames, std::max(video_nb_frames, audio_nb_frames));\r
                }\r
 \r
+               nb_frames = muxer_.calc_nb_frames(nb_frames);\r
+\r
                // TODO: Might need to scale nb_frames av frame_muxer transformations.\r
 \r
                return nb_frames + late_frames_ - start_;\r
index e29e1b3e2e7441b9d9e1808b3c85e0366daf8e8e..d4369f73470b9d158445ab018471b9642df080b5 100644 (file)
@@ -363,6 +363,21 @@ struct frame_muxer::implementation : boost::noncopyable
 \r
                dest.push_back(core::basic_frame::interlace(frame1, frame2, format_desc_.mode));                \r
        }\r
+       \r
+       int64_t calc_nb_frames(int64_t nb_frames) const\r
+       {\r
+               switch(display_mode_)\r
+               {\r
+               case display_mode::interlace:\r
+               case display_mode::half:\r
+                       return nb_frames/2;\r
+               case display_mode::duplicate:\r
+               case display_mode::deinterlace_bob:\r
+                       return nb_frames*2;\r
+               default:\r
+                       return nb_frames;\r
+               }\r
+       }\r
 };\r
 \r
 frame_muxer::frame_muxer(double in_fps, const safe_ptr<core::frame_factory>& frame_factory)\r
@@ -375,5 +390,6 @@ size_t frame_muxer::size() const {return impl_->size();}
 bool frame_muxer::empty() const {return impl_->size() == 0;}\r
 bool frame_muxer::video_ready() const{return impl_->video_ready();}\r
 bool frame_muxer::audio_ready() const{return impl_->audio_ready();}\r
+int64_t frame_muxer::calc_nb_frames(int64_t nb_frames) const {return impl_->calc_nb_frames(nb_frames);}\r
 \r
 }
\ No newline at end of file
index deee975614ce78dc2b0cf8c64ecc1e0e9ed30aa1..f6730c2a879d23a1eab470b71054e17316b05a3a 100644 (file)
@@ -34,6 +34,8 @@ public:
        size_t size() const;\r
        bool empty() const;\r
 \r
+       int64_t calc_nb_frames(int64_t nb_frames) const;\r
+\r
        safe_ptr<core::basic_frame> pop();\r
 private:\r
        struct implementation;\r