mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
gst/avi/gstavidemux.*: For timestamping audio packets we need to take into account the amount of blocks in one entry ...
Original commit message from CVS: * gst/avi/gstavidemux.c: (gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream), (gst_avi_demux_parse_index): * gst/avi/gstavidemux.h: For timestamping audio packets we need to take into account the amount of blocks in one entry using the blockalign. Fixes some sync issues with zero-padded audio blocks in the beginning of avi files.
This commit is contained in:
parent
0e9db391c7
commit
b9a1894e5c
3 changed files with 42 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
|||
2008-10-08 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_subindex),
|
||||
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index):
|
||||
* gst/avi/gstavidemux.h:
|
||||
For timestamping audio packets we need to take into account the
|
||||
amount of blocks in one entry using the blockalign. Fixes some sync
|
||||
issues with zero-padded audio blocks in the beginning of avi files.
|
||||
|
||||
2008-10-08 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/multifile/gstmultifilesrc.c: (gst_multi_file_src_class_init),
|
||||
|
|
|
@ -1035,9 +1035,14 @@ gst_avi_demux_parse_subindex (GstAviDemux * avi,
|
|||
/* timestamps */
|
||||
entry->ts = stream->idx_duration;
|
||||
if (stream->is_vbr) {
|
||||
/* VBR get next timestamp */
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_frames + 1, &format, &next_ts);
|
||||
/* VBR stream next timestamp */
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_blocks + 1, &format, &next_ts);
|
||||
} else {
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_frames + 1, &format, &next_ts);
|
||||
}
|
||||
} else {
|
||||
/* CBR get next timestamp */
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_BYTES,
|
||||
|
@ -1052,6 +1057,14 @@ gst_avi_demux_parse_subindex (GstAviDemux * avi,
|
|||
|
||||
stream->total_bytes += entry->size;
|
||||
stream->total_frames++;
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
if (stream->strf.auds->blockalign > 0)
|
||||
stream->total_blocks +=
|
||||
(entry->size + stream->strf.auds->blockalign -
|
||||
1) / stream->strf.auds->blockalign;
|
||||
else
|
||||
stream->total_blocks++;
|
||||
}
|
||||
stream->idx_duration = next_ts;
|
||||
|
||||
entries_list = g_list_prepend (entries_list, entry);
|
||||
|
@ -1615,6 +1628,7 @@ gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf)
|
|||
stream->num = avi->num_streams;
|
||||
stream->total_bytes = 0;
|
||||
stream->total_frames = 0;
|
||||
stream->total_blocks = 0;
|
||||
stream->current_frame = 0;
|
||||
stream->current_byte = 0;
|
||||
gst_pad_set_element_private (pad, stream);
|
||||
|
@ -1847,8 +1861,13 @@ gst_avi_demux_parse_index (GstAviDemux * avi,
|
|||
target->ts = stream->idx_duration;
|
||||
if (stream->is_vbr) {
|
||||
/* VBR stream next timestamp */
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_frames + 1, &format, &next_ts);
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_blocks + 1, &format, &next_ts);
|
||||
} else {
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_frames + 1, &format, &next_ts);
|
||||
}
|
||||
} else {
|
||||
/* constant rate stream */
|
||||
gst_avi_demux_src_convert (stream->pad, GST_FORMAT_BYTES,
|
||||
|
@ -1863,6 +1882,14 @@ gst_avi_demux_parse_index (GstAviDemux * avi,
|
|||
|
||||
stream->total_bytes += target->size;
|
||||
stream->total_frames++;
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
if (stream->strf.auds->blockalign > 0)
|
||||
stream->total_blocks +=
|
||||
(target->size + stream->strf.auds->blockalign -
|
||||
1) / stream->strf.auds->blockalign;
|
||||
else
|
||||
stream->total_blocks++;
|
||||
}
|
||||
stream->idx_duration = next_ts;
|
||||
|
||||
GST_LOG_OBJECT (avi,
|
||||
|
|
|
@ -89,6 +89,7 @@ typedef struct {
|
|||
/* stream length */
|
||||
guint64 total_bytes;
|
||||
guint32 total_frames;
|
||||
guint32 total_blocks;
|
||||
/* stream length according to index */
|
||||
GstClockTime idx_duration;
|
||||
/* stream length according to header */
|
||||
|
|
Loading…
Reference in a new issue