Removed boost reference and cleaned up debug output

This commit is contained in:
Robert Osfield 2009-03-04 16:03:28 +00:00
parent ab82553f97
commit 6fd4cd4933
4 changed files with 12 additions and 21 deletions

View File

@ -41,7 +41,6 @@ public:
private:
//typedef boost::shared_ptr<AVFrame> FramePtr;
typedef osg::ref_ptr<osg::AudioSink> SinkPtr;
typedef std::vector<uint8_t> Buffer;

View File

@ -32,6 +32,8 @@ FFmpegDecoderVideo::FFmpegDecoderVideo(PacketQueue & packets, FFmpegClocks & clo
FFmpegDecoderVideo::~FFmpegDecoderVideo()
{
osg::notify(osg::NOTICE)<<"Destructing FFmpegDecoderVideo..."<<std::endl;
if (isRunning())
{
m_exit = true;
@ -45,6 +47,8 @@ FFmpegDecoderVideo::~FFmpegDecoderVideo()
m_swscale_ctx = 0;
}
#endif
osg::notify(osg::NOTICE)<<"Destructed FFmpegDecoderVideo"<<std::endl;
}
@ -260,8 +264,6 @@ void FFmpegDecoderVideo::publishFrame(const double delay)
const AVPicture * const src = (const AVPicture *) m_frame.get();
AVPicture * const dst = (AVPicture *) m_frame_rgba.get();
osg::Timer_t startTick = osg::Timer::instance()->tick();
// Assign appropriate parts of the buffer to image planes in m_frame_rgba
avpicture_fill((AVPicture *) (m_frame_rgba).get(), &(m_buffer_rgba[m_writeBuffer])[0], PIX_FMT_RGB32, width(), height());
@ -272,14 +274,6 @@ void FFmpegDecoderVideo::publishFrame(const double delay)
else
convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width(), height());
// Flip and swap buffer
// swapBuffers();
osg::Timer_t endTick = osg::Timer::instance()->tick();
osg::notify(osg::NOTICE)<<" time of swapBuffers = "<<osg::Timer::instance()->delta_m(startTick,endTick)<<"ms"<<std::endl;
// Wait 'delay' seconds before publishing the picture.
int i_delay = static_cast<int>(delay * 1000000 + 0.5);
@ -303,14 +297,6 @@ void FFmpegDecoderVideo::publishFrame(const double delay)
void FFmpegDecoderVideo::swapBuffers()
{
for (int h = 0; h < height(); ++h)
memcpy(&(m_buffer_rgba[1-m_writeBuffer])[(height() - h - 1) * width() * 4], &(m_buffer_rgba[m_writeBuffer])[h * width() * 4], width() * 4);
}
void FFmpegDecoderVideo::yuva420pToRgba(AVPicture * const dst, const AVPicture * const src, int width, int height)
{
convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width, height);

View File

@ -8,7 +8,6 @@
#include "FFmpegClocks.hpp"
#include "FFmpegPacket.hpp"
#include <boost/shared_ptr.hpp>
#include <OpenThreads/Thread>
#include <vector>
@ -85,7 +84,6 @@ private:
void decodeLoop();
void findAspectRatio();
void publishFrame(double delay);
void swapBuffers();
double synchronizeVideo(double pts);
void yuva420pToRgba(AVPicture *dst, const AVPicture *src, int width, int height);

View File

@ -39,9 +39,17 @@ FFmpegImageStream::FFmpegImageStream(const FFmpegImageStream & image, const osg:
FFmpegImageStream::~FFmpegImageStream()
{
osg::notify(osg::NOTICE)<<"Destructing FFMpegImageStream..."<<std::endl;
quit(true);
// destroy the decoder and associated threads
m_decoder = 0;
delete m_commands;
osg::notify(osg::NOTICE)<<"Destructed FFMpegImageStream."<<std::endl;
}