[FFmpeg-cvslog] avformat/dtshddec: also read trailing padding in samples
Paul B Mahol
git at videolan.org
Mon Jan 16 11:00:56 EET 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Jan 12 09:56:57 2023 +0100| [2524d0b33b3e23b23d45c45820601644ba51c7bf] | committer: Paul B Mahol
avformat/dtshddec: also read trailing padding in samples
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2524d0b33b3e23b23d45c45820601644ba51c7bf
---
libavformat/dtshddec.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c
index edd02b4561..a3dea0668f 100644
--- a/libavformat/dtshddec.c
+++ b/libavformat/dtshddec.c
@@ -55,7 +55,7 @@ static int dtshd_read_header(AVFormatContext *s)
DTSHDDemuxContext *dtshd = s->priv_data;
AVIOContext *pb = s->pb;
uint64_t chunk_type, chunk_size;
- int64_t duration, data_start;
+ int64_t duration, orig_nb_samples, data_start;
AVStream *st;
int ret;
char *value;
@@ -103,9 +103,12 @@ static int dtshd_read_header(AVFormatContext *s)
duration = avio_rb32(pb); // num_frames
duration *= avio_rb16(pb); // samples_per_frames
st->duration = duration;
- avio_skip(pb, 5);
+ orig_nb_samples = avio_rb32(pb);
+ orig_nb_samples <<= 8;
+ orig_nb_samples |= avio_r8(pb);
st->codecpar->ch_layout.nb_channels = ff_dca_count_chs_for_mask(avio_rb16(pb));
st->codecpar->initial_padding = avio_rb16(pb);
+ st->codecpar->trailing_padding = FFMAX(st->duration - orig_nb_samples - st->codecpar->initial_padding, 0);
avio_skip(pb, chunk_size - 21);
break;
case FILEINFO:
More information about the ffmpeg-cvslog
mailing list