[FFmpeg-devel] [PATCH]Try not to choose hearing- (or visual-) impaired audio streams
Michael Niedermayer
michaelni at gmx.at
Thu Mar 28 16:25:30 CET 2013
On Thu, Mar 28, 2013 at 11:46:30AM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Several samples on trac contain hearing-impaired and other audio tracks,
> ffmpeg currently incorrectly chooses the hearing-impaired track if both are
> stereo.
>
> Please comment, Carl Eugen
> ffmpeg_opt.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
> 8cdce4b6246da8f9a276838423c98408511b5d2c patchimpaired.diff
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index a134274..d300ef4 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1601,12 +1601,18 @@ static int open_output_file(OptionsContext *o, const char *filename)
>
> /* audio: most channels */
> if (!o->audio_disable && oc->oformat->audio_codec != AV_CODEC_ID_NONE) {
> - int channels = 0, idx = -1;
> + int channels = 0, idx = -1, impaired = 0;
> for (i = 0; i < nb_input_streams; i++) {
> ist = input_streams[i];
> if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
> + (impaired & AV_DISPOSITION_HEARING_IMPAIRED &&
> + !(ist->st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) ||
> + impaired & AV_DISPOSITION_VISUAL_IMPAIRED &&
> + !(ist->st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) ||
> - ist->st->codec->channels > channels) {
> + ist->st->codec->channels > channels)) {
> channels = ist->st->codec->channels;
> + impaired = ist->st->disposition &
> + (AV_DISPOSITION_HEARING_IMPAIRED | AV_DISPOSITION_VISUAL_IMPAIRED);
> idx = i;
please calcluate a score for each stream (based on channels & disposition)
and then choose the one with the highest score
this is cleaner and more extendible
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 1
"Used only once" - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130328/7ea0806a/attachment.asc>
More information about the ffmpeg-devel
mailing list