Skip to content

Commit

Permalink
set astream and vstream if not set
Browse files Browse the repository at this point in the history
When opening an existing project that has only audio_index and
video_index using the avformat-novalidate producer these properties are
not set in producer init. This makes Shotcut unable to locate the
relative stream indices in its Properties.
  • Loading branch information
ddennedy committed Aug 25, 2023
1 parent 8f2b043 commit c4ec2fd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2843,6 +2843,14 @@ static int pick_video_stream(producer_avformat self)
} else {
// Failover to the absolute index
absolute_index = mlt_properties_get_int(properties, "video_index");
if (self->video_format) {
// Compute the relative stream index
mlt_properties_set_int(properties,
"vstream",
relative_stream_index(self->video_format,
AVMEDIA_TYPE_VIDEO,
absolute_index));
}
}
if (mlt_properties_get_int(properties, "video_index") != absolute_index) {
// Update the absolute index
Expand Down Expand Up @@ -3580,6 +3588,14 @@ static int pick_audio_stream(producer_avformat self)
} else {
// Failover to the absolute index
absolute_index = mlt_properties_get_int(properties, "audio_index");
if (context) {
// Compute the relative stream index
mlt_properties_set_int(properties,
"astream",
relative_stream_index(context,
AVMEDIA_TYPE_AUDIO,
absolute_index));
}
}
if (mlt_properties_get_int(properties, "audio_index") != absolute_index) {
// Update the absolute index
Expand Down

0 comments on commit c4ec2fd

Please sign in to comment.