From 7cc995f71b16cd2c3841ede0309e7997e7583ae0 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 24 Aug 2005 15:51:48 +0000 Subject: [PATCH] ext/dv/gstdvdemux.c (gst_dvdemux_demux_frame): Send out valid segment end timestamps. Original commit message from CVS: 2005-08-24 Andy Wingo * ext/dv/gstdvdemux.c (gst_dvdemux_demux_frame): Send out valid segment end timestamps. (Also commit an old changelog entry) --- ChangeLog | 10 ++++++++++ ext/dv/gstdvdemux.c | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19cec899da..2f4fda6f8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-24 Andy Wingo + + * ext/dv/gstdvdemux.c (gst_dvdemux_demux_frame): Send out valid + segment end timestamps. + 2005-08-24 Thomas Vander Stichele * configure.ac: @@ -328,6 +333,11 @@ 2005-08-16 Andy Wingo + * ext/dv/gstdvdemux.c (gst_dvdemux_flush): Use gst_adapter_take so + we have our own copy of the data. + (gst_dvdemux_demux_video): Set the take() data as malloc_data so + it will get freed later. + * ext/raw1394/gstdv1394src.c (gst_dv1394src_iso_receive): Note license info in the source code -- was only in the commit log before. diff --git a/ext/dv/gstdvdemux.c b/ext/dv/gstdvdemux.c index 7ebe9aefc4..77ab23ed32 100644 --- a/ext/dv/gstdvdemux.c +++ b/ext/dv/gstdvdemux.c @@ -779,9 +779,8 @@ gst_dvdemux_demux_video (GstDVDemux * dvdemux, const guint8 * data) outbuf = gst_buffer_new (); - /* won't get freed, but still callers should not hold a ref on the buffer -- - need to figure out how to do that in gst core */ gst_buffer_set_data (outbuf, (guint8 *) data, dvdemux->frame_len); + outbuf->malloc_data = GST_BUFFER_DATA (outbuf); GST_BUFFER_TIMESTAMP (outbuf) = dvdemux->timestamp; GST_BUFFER_OFFSET (outbuf) = dvdemux->video_offset; @@ -821,11 +820,15 @@ gst_dvdemux_demux_frame (GstDVDemux * dvdemux, const guint8 * data) dvdemux->timestamp = dvdemux->start_timestamp; - format = GST_FORMAT_TIME; - if (!(res = gst_pad_query_convert (dvdemux->sinkpad, - GST_FORMAT_BYTES, - dvdemux->stop_byte, &format, &dvdemux->stop_timestamp))) { - goto discont_error; + if (dvdemux->stop_byte == -1) { + dvdemux->stop_timestamp = -1; + } else { + format = GST_FORMAT_TIME; + if (!(res = gst_pad_query_convert (dvdemux->sinkpad, + GST_FORMAT_BYTES, + dvdemux->stop_byte, &format, &dvdemux->stop_timestamp))) { + goto discont_error; + } } event = gst_event_new_newsegment (1.0, GST_FORMAT_TIME, @@ -897,13 +900,11 @@ gst_dvdemux_flush (GstDVDemux * dvdemux) /* if we still have enough for a frame, start decoding */ if (gst_adapter_available (dvdemux->adapter) >= length) { - data = gst_adapter_peek (dvdemux->adapter, length); + data = gst_adapter_take (dvdemux->adapter, length); /* and decode the data */ ret = gst_dvdemux_demux_frame (dvdemux, data); - gst_adapter_flush (dvdemux->adapter, length); - if (ret != GST_FLOW_OK) goto done; }