mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
ext/dv/gstdvdec.*: Fix timestamp, duration and offset of the buffers.
Original commit message from CVS: * ext/dv/gstdvdec.c: (gst_dvdec_push), (gst_dvdec_loop), (gst_dvdec_change_state): * ext/dv/gstdvdec.h: Fix timestamp, duration and offset of the buffers.
This commit is contained in:
parent
462376ab69
commit
916be7a8b3
3 changed files with 29 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-06-27 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/dv/gstdvdec.c: (gst_dvdec_push), (gst_dvdec_loop),
|
||||
(gst_dvdec_change_state):
|
||||
* ext/dv/gstdvdec.h:
|
||||
Fix timestamp, duration and offset of the buffers.
|
||||
|
||||
2004-06-27 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
|
||||
|
|
|
@ -798,8 +798,6 @@ static void
|
|||
gst_dvdec_push (GstDVDec * dvdec, GstBuffer * outbuf, GstPad * pad,
|
||||
GstClockTime ts)
|
||||
{
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
||||
|
||||
if ((dvdec->need_discont) || (dvdec->new_media)) {
|
||||
GstEvent *discont;
|
||||
|
||||
|
@ -827,7 +825,7 @@ gst_dvdec_loop (GstElement * element)
|
|||
guint8 *inframe;
|
||||
gint height;
|
||||
guint32 length, got_bytes;
|
||||
guint64 ts;
|
||||
GstClockTime ts, duration;
|
||||
gdouble fps;
|
||||
|
||||
dvdec = GST_DVDEC (element);
|
||||
|
@ -874,13 +872,13 @@ gst_dvdec_loop (GstElement * element)
|
|||
|
||||
ts = dvdec->next_ts;
|
||||
dvdec->next_ts += GST_SECOND / dvdec->framerate;
|
||||
duration = dvdec->next_ts - ts;
|
||||
|
||||
dv_parse_packs (dvdec->decoder, GST_BUFFER_DATA (buf));
|
||||
if (dv_is_new_recording (dvdec->decoder, GST_BUFFER_DATA (buf)))
|
||||
dvdec->new_media = TRUE;
|
||||
if (GST_PAD_IS_LINKED (dvdec->audiosrcpad)) {
|
||||
gint16 *a_ptr;
|
||||
gint i, j;
|
||||
gint num_samples;
|
||||
|
||||
dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf),
|
||||
dvdec->audio_buffers);
|
||||
|
@ -905,7 +903,12 @@ gst_dvdec_loop (GstElement * element)
|
|||
dvdec->channels = dv_get_num_channels (dvdec->decoder);
|
||||
}
|
||||
|
||||
if (dv_get_num_samples (dvdec->decoder) > 0) {
|
||||
num_samples = dv_get_num_samples (dvdec->decoder);
|
||||
|
||||
if (num_samples) {
|
||||
gint16 *a_ptr;
|
||||
gint i, j;
|
||||
|
||||
outbuf = gst_buffer_new ();
|
||||
GST_BUFFER_SIZE (outbuf) = dv_get_num_samples (dvdec->decoder) *
|
||||
sizeof (gint16) * dv_get_num_channels (dvdec->decoder);
|
||||
|
@ -913,11 +916,18 @@ gst_dvdec_loop (GstElement * element)
|
|||
|
||||
a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf);
|
||||
|
||||
for (i = 0; i < dv_get_num_samples (dvdec->decoder); i++) {
|
||||
for (i = 0; i < num_samples; i++) {
|
||||
for (j = 0; j < dv_get_num_channels (dvdec->decoder); j++) {
|
||||
*(a_ptr++) = dvdec->audio_buffers[j][i];
|
||||
}
|
||||
}
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
||||
GST_BUFFER_DURATION (outbuf) = duration;
|
||||
GST_BUFFER_OFFSET (outbuf) = dvdec->audio_offset;
|
||||
dvdec->audio_offset += num_samples;
|
||||
GST_BUFFER_OFFSET_END (outbuf) = dvdec->audio_offset;
|
||||
|
||||
gst_dvdec_push (dvdec, outbuf, dvdec->audiosrcpad, ts);
|
||||
}
|
||||
} else {
|
||||
|
@ -959,6 +969,9 @@ gst_dvdec_loop (GstElement * element)
|
|||
dv_decode_full_frame (dvdec->decoder, GST_BUFFER_DATA (buf),
|
||||
dvdec->space, outframe_ptrs, outframe_pitches);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
||||
GST_BUFFER_DURATION (outbuf) = duration;
|
||||
|
||||
gst_dvdec_push (dvdec, outbuf, dvdec->videosrcpad, ts);
|
||||
} else {
|
||||
dvdec->height = height;
|
||||
|
@ -989,6 +1002,7 @@ gst_dvdec_change_state (GstElement * element)
|
|||
dvdec->decoder =
|
||||
dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
|
||||
dvdec->decoder->quality = qualities[dvdec->quality];
|
||||
dvdec->audio_offset = 0;
|
||||
/*
|
||||
* Enable this function call when libdv2 0.100 or higher is more
|
||||
* common
|
||||
|
|
|
@ -64,6 +64,7 @@ struct _GstDVDec {
|
|||
|
||||
gint length;
|
||||
guint64 next_ts;
|
||||
guint64 audio_offset;
|
||||
guint64 end_position;
|
||||
gboolean need_discont;
|
||||
gboolean new_media;
|
||||
|
|
Loading…
Reference in a new issue