Skip to content

Commit

Permalink
change function param to absolute_index
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Aug 23, 2023
1 parent 7a324f4 commit 08d57a9
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2830,7 +2830,7 @@ static int video_codec_init(producer_avformat self, int index, mlt_properties pr
return self->video_index > -1;
}

static int pick_video_stream(producer_avformat self, int index)
static int pick_video_stream(producer_avformat self, int absolute_index)
{
mlt_properties properties = MLT_PRODUCER_PROPERTIES(self->parent);

Expand All @@ -2841,14 +2841,14 @@ static int pick_video_stream(producer_avformat self, int index)
mlt_properties_get_int(properties, "vstream"));
} else {
// Failover to the absolute index
index = mlt_properties_get_int(properties, "video_index");
absolute_index = mlt_properties_get_int(properties, "video_index");
}
if (mlt_properties_get_int(properties, "video_index") != index) {
if (mlt_properties_get_int(properties, "video_index") != absolute_index) {
// Update the absolute index
mlt_properties_set_int(properties, "video_index", index);
self->video_index = index;
mlt_properties_set_int(properties, "video_index", absolute_index);
self->video_index = absolute_index;
}
return index;
return absolute_index;
}

/** Set up video handling.
Expand Down Expand Up @@ -3563,7 +3563,7 @@ static int audio_codec_init(producer_avformat self, int index, mlt_properties pr
return self->audio_codec[index] && self->audio_index > -1;
}

static int pick_audio_stream(producer_avformat self, int index)
static int pick_audio_stream(producer_avformat self, int absolute_index)
{
AVFormatContext *context = self->audio_format;
mlt_properties properties = MLT_PRODUCER_PROPERTIES(self->parent);
Expand All @@ -3575,24 +3575,24 @@ static int pick_audio_stream(producer_avformat self, int index)
mlt_properties_get_int(properties, "astream"));
} else {
// Failover to the absolute index
index = mlt_properties_get_int(properties, "audio_index");
absolute_index = mlt_properties_get_int(properties, "audio_index");
}
if (mlt_properties_get_int(properties, "audio_index") != index) {
if (mlt_properties_get_int(properties, "audio_index") != absolute_index) {
// Update the absolute index
mlt_properties_set_int(properties, "audio_index", index);
self->audio_index = index;
mlt_properties_set_int(properties, "audio_index", absolute_index);
self->audio_index = absolute_index;
}

// Handle all audio tracks
if (self->audio_index > -1) {
if (mlt_properties_get(properties, "audio_index")
&& !strcmp(mlt_properties_get(properties, "audio_index"), "all")) {
index = INT_MAX;
absolute_index = INT_MAX;
mlt_properties_set(properties, "astream", "all");
}
if (mlt_properties_get(properties, "astream")
&& !strcmp(mlt_properties_get(properties, "astream"), "all")) {
index = INT_MAX;
absolute_index = INT_MAX;
mlt_properties_set(properties, "audio_index", "all");
}
}
Expand All @@ -3603,25 +3603,25 @@ static int pick_audio_stream(producer_avformat self, int index)
index >= 0 && context->streams[index]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO;
index--)
;
mlt_properties_set_int(properties, "audio_index", index);
mlt_properties_set_int(properties, "audio_index", absolute_index);
mlt_properties_set_int(properties,
"astream",
relative_stream_index(context, AVMEDIA_TYPE_AUDIO, index));
}
if (context && index > -1 && index < INT_MAX
&& context->streams[index]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
index = self->audio_index;
mlt_properties_set_int(properties, "audio_index", index);
absolute_index = self->audio_index;
mlt_properties_set_int(properties, "audio_index", absolute_index);
mlt_properties_set_int(properties,
"astream",
relative_stream_index(context, AVMEDIA_TYPE_AUDIO, index));
}
if (context && index > -1 && index < INT_MAX
&& pick_audio_format(context->streams[index]->codecpar->format) == mlt_audio_none) {
index = -1;
absolute_index = -1;
}

return index;
return absolute_index;
}

/** Set up audio handling.
Expand Down

0 comments on commit 08d57a9

Please sign in to comment.