- Timestamp:
- 03/04/09 12:05:55 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp
r9837 r9854 6 6 #include <string.h> 7 7 8 #if 0 8 9 extern "C" 9 10 { … … 12 13 13 14 }; 15 #endif 14 16 15 17 namespace osgFFmpeg { … … 28 30 m_user_data(0), 29 31 m_publish_func(0), 30 m_exit(false) 32 m_exit(false), 33 m_swscale_ctx(0) 31 34 { 32 35 … … 41 44 m_exit = true; 42 45 join(); 46 } 47 48 if (m_swscale_ctx) 49 { 50 sws_freeContext(m_swscale_ctx); 51 m_swscale_ctx = 0; 43 52 } 44 53 } … … 211 220 } 212 221 222 int FFmpegDecoderVideo::convert(AVPicture *dst, int dst_pix_fmt, const AVPicture *src, 223 int src_pix_fmt, int src_width, int src_height) 224 { 225 #ifdef USE_SWSCALE 226 if (m_swscale_ctx==0) 227 { 228 m_swscale_ctx = sws_getContext(src_width, src_height, src_pix_fmt, 229 src_width, src_height, dst_pix_fmt, 230 SWS_BILINEAR, NULL, NULL, NULL); 231 } 232 233 return sws_scale(m_swscale_ctx, 234 src->data, src->linesize, 0, src_height, 235 dst->data, dst->linesize); 236 #else 237 return convert(dst, dst_pix_fmt, src, 238 src_pix_fmt, src_width, src_height) 239 #endif 240 } 213 241 214 242 … … 231 259 yuva420pToRgba(dst, src, width(), height()); 232 260 else 233 img_convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width(), height());261 convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width(), height()); 234 262 235 263 // Flip and swap buffer … … 267 295 void FFmpegDecoderVideo::yuva420pToRgba(AVPicture * const dst, const AVPicture * const src, int width, int height) 268 296 { 269 img_convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width, height);297 convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width, height); 270 298 271 299 const size_t bpp = 4;
