Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try-fix: https://github.com/mltframework/mlt/issues/1058 #1059

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/framework/mlt_field.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,17 @@ void mlt_field_close(mlt_field self)

void mlt_field_disconnect_service(mlt_field self, mlt_service service)
{
mlt_service p = mlt_service_producer(service);
mlt_service p = NULL;
if(mlt_service_filter_type == mlt_service_identify(service))
{
mlt_filter filter = MLT_FILTER(service);
int track = mlt_filter_get_track(filter);
p = mlt_service_peek_producer(service, track);
}
else
{
p = mlt_service_producer(service);
}
mlt_service c = mlt_service_consumer(service);
int i;
switch (mlt_service_identify(c)) {
Expand Down
21 changes: 21 additions & 0 deletions src/framework/mlt_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,27 @@ mlt_service mlt_service_producer(mlt_service self)
return self;
}

/** Get the N-th connected producer.
*
* \public \memberof mlt_service_s
* \param self a service
* \param index which of potentially multiple producers to this service (0 based)
* \return the N-th producer
*/

mlt_service mlt_service_peek_producer(mlt_service self, int index)
{
mlt_service producer = NULL;

// Get the service base
mlt_service_base *base = self->local;

if (base->in != NULL && index < base->count)
producer = base->in[index];

return producer;
}

/** Associate a service to a consumer.
*
* Overwrites connection to any existing consumer.
Expand Down
1 change: 1 addition & 0 deletions src/framework/mlt_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ extern int mlt_service_get_frame(mlt_service self, mlt_frame_ptr frame, int inde
extern mlt_properties mlt_service_properties(mlt_service self);
extern mlt_service mlt_service_consumer(mlt_service self);
extern mlt_service mlt_service_producer(mlt_service self);
extern mlt_service mlt_service_peek_producer(mlt_service self, int index);
extern int mlt_service_attach(mlt_service self, mlt_filter filter);
extern int mlt_service_detach(mlt_service self, mlt_filter filter);
extern void mlt_service_apply_filters(mlt_service self, mlt_frame frame, int index);
Expand Down