Skip to content

Commit

Permalink
fix #913 autorotate avformat property with chain
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed May 5, 2023
1 parent 4982693 commit 7e55b7a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ static int setup_filters(producer_avformat self)
int error = 0;
mlt_properties properties = MLT_PRODUCER_PROPERTIES(self->parent);
const char *filtergraph = mlt_properties_get(properties, "filtergraph");
double theta = 0;
double theta = 0.0;

if (self->video_index != -1 && self->autorotate) {
theta = get_rotation(properties, self->video_format->streams[self->video_index]);
Expand Down Expand Up @@ -1470,11 +1470,10 @@ static void property_changed(mlt_service owner, producer_avformat self, char *na
{
if (self && name) {
if (!strcmp("color_range", name)) {
mlt_properties properties = MLT_PRODUCER_PROPERTIES(self->parent);
if (self->video_codec
&& !av_opt_set(self->video_codec,
name,
mlt_properties_get(properties, name),
mlt_properties_get(MLT_PRODUCER_PROPERTIES(self->parent), name),
AV_OPT_SEARCH_CHILDREN)) {
if (self->full_range != (self->video_codec->color_range == AVCOL_RANGE_JPEG)) {
self->full_range = self->video_codec->color_range == AVCOL_RANGE_JPEG;
Expand All @@ -1487,6 +1486,17 @@ static void property_changed(mlt_service owner, producer_avformat self, char *na
self->full_range = mlt_properties_get_int(properties, name);
self->reset_image_cache = 1;
}
} else if (!strcmp("autorotate", name)) {
self->autorotate = mlt_properties_get_int(MLT_PRODUCER_PROPERTIES(self->parent), name);
if (self->video_index != -1) {
mlt_service_lock(MLT_PRODUCER_SERVICE(self->parent));
avfilter_graph_free(&self->vfilter_graph);
self->vfilter_out = NULL;
self->rotation = 0.0;
setup_filters(self);
self->reset_image_cache = 1;
mlt_service_unlock(MLT_PRODUCER_SERVICE(self->parent));
}
}
}
}
Expand Down

0 comments on commit 7e55b7a

Please sign in to comment.