Fix parsing when no channel_layout present in audio config.

This commit is contained in:
Bill Thiede 2019-12-04 20:47:24 -08:00
parent ab716f0398
commit 4d0ce2cd13

View File

@ -161,7 +161,7 @@ enum Stream {
codec_name: String,
codec_long_name: String,
channels: usize,
channel_layout: String,
channel_layout: Option<String>,
tags: Option<Tags>,
},
#[serde(rename = "subtitle")]
@ -213,7 +213,8 @@ pub struct AudioFormat {
short_name: String,
long_name: String,
channels: usize,
channel_layout: String,
#[serde(skip_serializing_if = "Option::is_none")]
channel_layout: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
@ -492,7 +493,7 @@ impl MovieLibrary {
short_name: codec_name.to_string(),
long_name: codec_long_name.to_string(),
channels: *channels,
channel_layout: channel_layout.to_string(),
channel_layout: channel_layout.clone(),
title: tags.as_ref().and_then(|t| t.title()),
language: tags.as_ref().and_then(|t| t.language()),
})