flac: convert to new channel layout API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vittorio Giovara 2017-03-31 13:57:59 +02:00 committed by James Almer
parent d68f938c2d
commit e5818ab328
2 changed files with 5 additions and 6 deletions

View File

@ -191,8 +191,7 @@ static int flac_read_header(AVFormatContext *s)
av_log(s, AV_LOG_WARNING, av_log(s, AV_LOG_WARNING,
"Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n"); "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
} else { } else {
st->codecpar->channel_layout = mask; av_channel_layout_from_mask(&st->codecpar->ch_layout, mask);
st->codecpar->channels = av_get_channel_layout_nb_channels(mask);
av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0); av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0);
} }
} }

View File

@ -238,9 +238,9 @@ static int flac_init(struct AVFormatContext *s)
} }
/* add the channel layout tag */ /* add the channel layout tag */
if (par->channel_layout && if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE &&
!(par->channel_layout & ~0x3ffffULL) && !(par->ch_layout.u.mask & ~0x3ffffULL) &&
!ff_flac_is_native_layout(par->channel_layout)) { !ff_flac_is_native_layout(par->ch_layout.u.mask)) {
AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0); NULL, 0);
@ -249,7 +249,7 @@ static int flac_init(struct AVFormatContext *s)
"already present, this muxer will not overwrite it.\n"); "already present, this muxer will not overwrite it.\n");
} else { } else {
uint8_t buf[32]; uint8_t buf[32];
snprintf(buf, sizeof(buf), "0x%"PRIx64, par->channel_layout); snprintf(buf, sizeof(buf), "0x%"PRIx64, par->ch_layout.u.mask);
av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0); av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
} }
} }