apply_properties( c, p, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, 1 );
mlt_properties_close( p );
}
+ int colorspace = mlt_properties_get_int( properties, "colorspace" );
+ mlt_properties_set( properties, "colorspace", NULL );
apply_properties( c, properties, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, 0 );
+ mlt_properties_set_int( properties, "colorspace", colorspace );
// Set options controlled by MLT
c->width = mlt_properties_get_int( properties, "width" );
#else
c->pix_fmt = pix_fmt ? avcodec_get_pix_fmt( pix_fmt ) : PIX_FMT_YUV420P;
#endif
+
+ switch ( colorspace )
+ {
+ case 170:
+ c->colorspace = AVCOL_SPC_SMPTE170M;
+ break;
+ case 240:
+ c->colorspace = AVCOL_SPC_SMPTE240M;
+ break;
+ case 470:
+ c->colorspace = AVCOL_SPC_BT470BG;
+ break;
+ case 601:
+ c->colorspace = ( 576 % c->height ) ? AVCOL_SPC_SMPTE170M : AVCOL_SPC_BT470BG;
+ break;
+ case 709:
+ c->colorspace = AVCOL_SPC_BT709;
+ break;
+ }
if ( mlt_properties_get( properties, "aspect" ) )
{
mlt_log_debug( MLT_CONSUMER_SERVICE( this ), " frame_size %d\n", codec->frame_size );
if ( i == 0 )
{
- if ( audio_codec_id == CODEC_ID_VORBIS )
- audio_pts = (double)codec->coded_frame->pts * av_q2d( stream->time_base );
- else
- audio_pts = (double)stream->pts.val * av_q2d( stream->time_base );
+ audio_pts = (double)stream->pts.val * av_q2d( stream->time_base );
}
}
}
uint8_t *p;
uint8_t *q;
- mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
-
mlt_frame_get_image( frame, &image, &img_fmt, &img_width, &img_height, 0 );
q = image;
// Do the colour space conversion
#ifdef SWSCALE
+ int flags = SWS_BILINEAR;
+#ifdef USE_MMX
+ flags |= SWS_CPU_CAPS_MMX;
+#endif
+#ifdef USE_SSE
+ flags |= SWS_CPU_CAPS_MMX2;
+#endif
struct SwsContext *context = sws_getContext( width, height, PIX_FMT_YUYV422,
- width, height, video_st->codec->pix_fmt, SWS_FAST_BILINEAR, NULL, NULL, NULL);
+ width, height, video_st->codec->pix_fmt, flags, NULL, NULL, NULL);
sws_scale( context, input->data, input->linesize, 0, height,
output->data, output->linesize);
sws_freeContext( context );
img_convert( ( AVPicture * )output, video_st->codec->pix_fmt, ( AVPicture * )input, PIX_FMT_YUYV422, width, height );
#endif
+ mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
+
// Apply the alpha if applicable
if ( video_st->codec->pix_fmt == PIX_FMT_RGB32 )
{