Commit 2e1a9a04 authored by Josef Zlomek's avatar Josef Zlomek Committed by Tim-Philipp Müller
Browse files

gst/matroska/matroska-mux.c: Fix timestamping of B-frames, use signed...

gst/matroska/matroska-mux.c: Fix timestamping of B-frames, use signed integers, do some rounding (#339678).

Original commit message from CVS:
Patch by: Josef Zlomek  <josef dot zlomek at itonis dot tv>
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_create_buffer_header),
(gst_matroska_mux_write_data):
Fix timestamping of B-frames, use signed integers, do
some rounding (#339678).
parent a299de4f
2006-04-25 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Josef Zlomek <josef dot zlomek at itonis dot tv>
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_create_buffer_header),
(gst_matroska_mux_write_data):
Fix timestamping of B-frames, use signed integers, do
some rounding (#339678).
2006-04-24 Edgard Lima <edgard.lima@indt.org.br> 2006-04-24 Edgard Lima <edgard.lima@indt.org.br>
* ext/annodex/gstcmmlparser.c: (gst_cmml_parser_generic_error): * ext/annodex/gstcmmlparser.c: (gst_cmml_parser_generic_error):
......
...@@ -1298,7 +1298,7 @@ gst_matroska_mux_best_pad (GstMatroskaMux * mux, gboolean * popped) ...@@ -1298,7 +1298,7 @@ gst_matroska_mux_best_pad (GstMatroskaMux * mux, gboolean * popped)
*/ */
GstBuffer * GstBuffer *
gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track, gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track,
guint16 relative_timestamp, int flags) gint16 relative_timestamp, int flags)
{ {
GstBuffer *hdr; GstBuffer *hdr;
...@@ -1330,7 +1330,8 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad) ...@@ -1330,7 +1330,8 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
GstBuffer *buf, *hdr; GstBuffer *buf, *hdr;
guint64 cluster, blockgroup; guint64 cluster, blockgroup;
gboolean write_duration; gboolean write_duration;
guint16 relative_timestamp; gint16 relative_timestamp;
gint64 relative_timestamp64;
guint64 block_duration; guint64 block_duration;
/* write data */ /* write data */
...@@ -1430,8 +1431,15 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad) ...@@ -1430,8 +1431,15 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
/* write the block, for matroska v2 use SimpleBlock if possible /* write the block, for matroska v2 use SimpleBlock if possible
* one slice (*breath*). * one slice (*breath*).
* FIXME: lacing, etc. */ * FIXME: lacing, etc. */
relative_timestamp = relative_timestamp64 = GST_BUFFER_TIMESTAMP (buf) - mux->cluster_time;
(GST_BUFFER_TIMESTAMP (buf) - mux->cluster_time) / mux->time_scale; if (relative_timestamp64 >= 0) {
/* round the timestamp */
relative_timestamp64 += mux->time_scale / 2;
} else {
/* round the timestamp */
relative_timestamp64 -= mux->time_scale / 2;
}
relative_timestamp = relative_timestamp64 / (gint64) mux->time_scale;
if (mux->matroska_version > 1 && !write_duration) { if (mux->matroska_version > 1 && !write_duration) {
int flags = int flags =
GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT) ? 0 : 0x80; GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT) ? 0 : 0x80;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment