diff --git a/src/mlt++/MltChain.cpp b/src/mlt++/MltChain.cpp index 4db59591e..6a1dee97c 100644 --- a/src/mlt++/MltChain.cpp +++ b/src/mlt++/MltChain.cpp @@ -19,6 +19,8 @@ #include "MltChain.h" +#include + using namespace Mlt; Chain::Chain() @@ -34,6 +36,12 @@ Chain::Chain(Profile &profile, const char *id, const char *service) } mlt_producer source = mlt_factory_producer(profile.get_profile(), id, service); + if (source + && !strcmp("xml", mlt_properties_get(MLT_PRODUCER_PROPERTIES(source), "mlt_service"))) { + mlt_producer_close(source); + // Always use a producer-consumer for xml so that the profile can be changed + source = mlt_factory_producer(profile.get_profile(), "consumer", service); + } if (source) { instance = mlt_chain_init(profile.get_profile()); mlt_chain_set_source(instance, source); diff --git a/src/modules/avformat/link_avdeinterlace.c b/src/modules/avformat/link_avdeinterlace.c index 9d6309c12..e279af14d 100644 --- a/src/modules/avformat/link_avdeinterlace.c +++ b/src/modules/avformat/link_avdeinterlace.c @@ -376,7 +376,11 @@ static int link_get_image(mlt_frame frame, // Operate on the native image format/size; srcimg.width = mlt_properties_get_int(unique_properties, "width"); srcimg.height = mlt_properties_get_int(unique_properties, "height"); - srcimg.format = mlt_properties_get_int(unique_properties, "format"); + if (mlt_properties_exists(unique_properties, "format")) { + srcimg.format = mlt_properties_get_int(unique_properties, "format"); + } else { + srcimg.format = *format; + } // Sanitize the input if (srcimg.width <= 1 || srcimg.height <= 1) { @@ -522,10 +526,34 @@ static int link_get_frame(mlt_link self, mlt_frame_ptr frame, int index) return error; } + // Pass original producer dimensions with the frame mlt_properties unique_properties = mlt_frame_unique_properties(*frame, MLT_LINK_SERVICE(self)); - mlt_properties_pass_list(unique_properties, - MLT_PRODUCER_PROPERTIES(original_producer), - "width height format"); + mlt_properties original_producer_properties = MLT_PRODUCER_PROPERTIES(original_producer); + if (mlt_properties_exists(original_producer_properties, "width")) { + mlt_properties_set_int(unique_properties, + "width", + mlt_properties_get_int(original_producer_properties, "width")); + } else if (mlt_properties_exists(original_producer_properties, "meta.media.width")) { + mlt_properties_set_int(unique_properties, + "width", + mlt_properties_get_int(original_producer_properties, + "meta.media.width")); + } + if (mlt_properties_exists(original_producer_properties, "height")) { + mlt_properties_set_int(unique_properties, + "height", + mlt_properties_get_int(original_producer_properties, "height")); + } else if (mlt_properties_exists(original_producer_properties, "meta.media.height")) { + mlt_properties_set_int(unique_properties, + "height", + mlt_properties_get_int(original_producer_properties, + "meta.media.height")); + } + if (mlt_properties_exists(original_producer_properties, "format")) { + mlt_properties_set_int(unique_properties, + "format", + mlt_properties_get_int(original_producer_properties, "format")); + } // Pass future frames int i = 0; diff --git a/src/modules/core/producer_consumer.c b/src/modules/core/producer_consumer.c index 3a8aa3b8e..d6992d778 100644 --- a/src/modules/core/producer_consumer.c +++ b/src/modules/core/producer_consumer.c @@ -288,6 +288,22 @@ mlt_producer producer_consumer_init(mlt_profile profile, mlt_properties properties = MLT_PRODUCER_PROPERTIES(self); mlt_properties_set(properties, "resource", arg); mlt_properties_pass_list(properties, MLT_PRODUCER_PROPERTIES(real_producer), "out, length"); + mlt_properties_set_int(properties, "meta.media.width", temp_profile->width); + mlt_properties_set_int(properties, "meta.media.height", temp_profile->height); + mlt_properties_set_int(properties, "meta.media.progressive", temp_profile->progressive); + mlt_properties_set_int(properties, + "meta.media.frame_rate_num", + temp_profile->frame_rate_num); + mlt_properties_set_int(properties, + "meta.media.frame_rate_den", + temp_profile->frame_rate_den); + mlt_properties_set_int(properties, + "meta.media.sample_aspect_num", + temp_profile->sample_aspect_num); + mlt_properties_set_int(properties, + "meta.media.sample_aspect_den", + temp_profile->sample_aspect_den); + mlt_properties_set_int(properties, "meta.media.colorspace", temp_profile->colorspace); // Done with the producer - will re-open later when we have the profile property mlt_producer_close(real_producer); diff --git a/src/modules/core/producer_melt.c b/src/modules/core/producer_melt.c index b3008a01f..627155c12 100644 --- a/src/modules/core/producer_melt.c +++ b/src/modules/core/producer_melt.c @@ -433,7 +433,24 @@ mlt_producer producer_melt_init(mlt_profile profile, if (title == NULL && strstr(argv[i], "is_explicit = 0; + producer = create_producer(native_profile, field, argv[i]); + if (producer) { + mlt_properties_set_data(MLT_PRODUCER_PROPERTIES(producer), + "_native_profile", + native_profile, + 0, + (mlt_destructor) mlt_profile_close, + NULL); + } else { + mlt_profile_close(native_profile); + } + } else { + producer = create_producer(profile, field, argv[i]); + } if (!first_producer) { first_producer = producer; }