]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 27 Oct 2011 11:30:38 +0000 (11:30 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 27 Oct 2011 11:30:38 +0000 (11:30 +0000)
modules/ffmpeg/producer/video/video_decoder.cpp

index 8970f204bddb8eb37063bd75556248d6c042676b..748084a30c5f07e4fc97090f1475c1831efbf0c2 100644 (file)
@@ -90,27 +90,6 @@ public:
        {\r
                agent::wait(this);\r
        }\r
-       \r
-       std::shared_ptr<AVFrame> decode(AVPacket& packet)\r
-       {\r
-               std::shared_ptr<AVFrame> decoded_frame(avcodec_alloc_frame(), av_free);\r
-\r
-               int frame_finished = 0;\r
-               THROW_ON_ERROR2(avcodec_decode_video2(codec_context_.get(), decoded_frame.get(), &frame_finished, &packet), "[video_decocer]");\r
-\r
-               // 1 packet <=> 1 frame.\r
-               // If a decoder consumes less then the whole packet then something is wrong\r
-               // that might be just harmless padding at the end, or a problem with the\r
-               // AVParser or demuxer which puted more then one frame in a AVPacket.\r
-\r
-               if(frame_finished == 0) \r
-                       return nullptr;\r
-                               \r
-               if(decoded_frame->repeat_pict > 0)\r
-                       CASPAR_LOG(warning) << "[video_decoder]: Field repeat_pict not implemented.";\r
-\r
-               return decoded_frame;\r
-       }\r
 \r
        virtual void run()\r
        {\r
@@ -167,6 +146,28 @@ public:
 \r
                done();\r
        }\r
+       \r
+       std::shared_ptr<AVFrame> decode(AVPacket& packet)\r
+       {\r
+               std::shared_ptr<AVFrame> decoded_frame(avcodec_alloc_frame(), av_free);\r
+\r
+               int frame_finished = 0;\r
+               THROW_ON_ERROR2(avcodec_decode_video2(codec_context_.get(), decoded_frame.get(), &frame_finished, &packet), "[video_decocer]");\r
+\r
+               // 1 packet <=> 1 frame.\r
+               // If a decoder consumes less then the whole packet then something is wrong\r
+               // that might be just harmless padding at the end, or a problem with the\r
+               // AVParser or demuxer which puted more then one frame in a AVPacket.\r
+\r
+               if(frame_finished == 0) \r
+                       return nullptr;\r
+                               \r
+               if(decoded_frame->repeat_pict > 0)\r
+                       CASPAR_LOG(warning) << "[video_decoder]: Field repeat_pict not implemented.";\r
+\r
+               return decoded_frame;\r
+       }\r
+\r
                        \r
        double fps() const\r
        {\r