ext/mad/gstmad.c: Add convert function for proper timestamp calculations.

Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_src_query), (gst_mad_sink_event),
(gst_mad_chain):
Add convert function for proper timestamp calculations.

* gst/avi/gstavidemux.c: (gst_avi_demux_send_event),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop):
Send out initial discont.
This commit is contained in:
Wim Taymans 2005-07-16 16:43:53 +00:00
parent 192edcbeb2
commit f6f3418b19
2 changed files with 37 additions and 27 deletions

View file

@ -1,3 +1,14 @@
2005-07-16 Wim Taymans <wim@fluendo.com>
* ext/mad/gstmad.c: (gst_mad_src_query), (gst_mad_sink_event),
(gst_mad_chain):
Add convert function for proper timestamp calculations.
* gst/avi/gstavidemux.c: (gst_avi_demux_send_event),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop):
Send out initial discont.
2005-07-15 Wim Taymans <wim@fluendo.com> 2005-07-15 Wim Taymans <wim@fluendo.com>
* gst/level/gstlevel.c: (gst_level_transform): * gst/level/gstlevel.c: (gst_level_transform):

View file

@ -1727,6 +1727,21 @@ gst_avi_demux_massage_index (GstAviDemux * avi,
GST_LOG ("Index massaging done"); GST_LOG ("Index massaging done");
} }
static gboolean
gst_avi_demux_send_event (GstAviDemux * avi, GstEvent * event)
{
gint i;
for (i = 0; i < avi->num_streams; i++) {
avi_stream_context *stream = &avi->stream[i];
gst_event_ref (event);
gst_pad_push_event (stream->pad, event);
}
gst_event_unref (event);
return TRUE;
}
/* /*
* Read full AVI headers. * Read full AVI headers.
*/ */
@ -1896,6 +1911,13 @@ done:
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
/* send initial discont */
avi->seek_event = gst_event_new_discontinuous (1.0,
GST_FORMAT_TIME, (gint64) 0,
(gint64) (((gfloat) avi->stream[0].strh->scale) *
avi->stream[0].strh->length /
avi->stream[0].strh->rate) * GST_SECOND, NULL);
/* at this point we know all the streams and we can signal the no more /* at this point we know all the streams and we can signal the no more
* pads signal */ * pads signal */
GST_DEBUG_OBJECT (avi, "signaling no more pads"); GST_DEBUG_OBJECT (avi, "signaling no more pads");
@ -1911,18 +1933,12 @@ done:
static gboolean static gboolean
gst_avi_demux_handle_seek (GstAviDemux * avi) gst_avi_demux_handle_seek (GstAviDemux * avi)
{ {
guint i;
/* FIXME: if we seek in an openDML file, we will have multiple /* FIXME: if we seek in an openDML file, we will have multiple
* primary levels. Seeking in between those will cause havoc. */ * primary levels. Seeking in between those will cause havoc. */
GST_LOG ("Seeking to entry %d", avi->seek_entry); GST_LOG ("Seeking to entry %d", avi->seek_entry);
for (i = 0; i < avi->num_streams; i++) { gst_avi_demux_send_event (avi, gst_event_new_flush (FALSE));
avi_stream_context *stream = &avi->stream[i];
gst_pad_push_event (stream->pad, gst_event_new_flush (FALSE));
}
GST_STREAM_LOCK (avi->sinkpad); GST_STREAM_LOCK (avi->sinkpad);
@ -1933,11 +1949,8 @@ gst_avi_demux_handle_seek (GstAviDemux * avi)
avi->stream[0].strh->length / avi->stream[0].strh->length /
avi->stream[0].strh->rate) * GST_SECOND, NULL); avi->stream[0].strh->rate) * GST_SECOND, NULL);
for (i = 0; i < avi->num_streams; i++) { gst_avi_demux_send_event (avi, gst_event_new_flush (TRUE));
avi_stream_context *stream = &avi->stream[i];
gst_pad_push_event (stream->pad, gst_event_new_flush (TRUE));
}
gst_pad_start_task (avi->sinkpad, (GstTaskFunction) gst_avi_demux_loop, gst_pad_start_task (avi->sinkpad, (GstTaskFunction) gst_avi_demux_loop,
avi->sinkpad); avi->sinkpad);
@ -1954,15 +1967,9 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
do { do {
if (avi->current_entry >= avi->index_size) { if (avi->current_entry >= avi->index_size) {
gint n;
GST_LOG_OBJECT (avi, "Handled last index entry, setting EOS (%d > %d)", GST_LOG_OBJECT (avi, "Handled last index entry, setting EOS (%d > %d)",
avi->current_entry, avi->index_size); avi->current_entry, avi->index_size);
for (n = 0; n < avi->num_streams; n++) { gst_avi_demux_send_event (avi, gst_event_new (GST_EVENT_EOS));
if (avi->stream[n].pad)
gst_pad_push_event (avi->stream[n].pad,
gst_event_new (GST_EVENT_EOS));
}
return GST_FLOW_WRONG_STATE; return GST_FLOW_WRONG_STATE;
} else { } else {
GstBuffer *buf; GstBuffer *buf;
@ -2115,17 +2122,9 @@ gst_avi_demux_loop (GstPad * pad)
break; break;
case GST_AVI_DEMUX_MOVI: case GST_AVI_DEMUX_MOVI:
if (avi->seek_event) { if (avi->seek_event) {
gint i; gst_avi_demux_send_event (avi, avi->seek_event);
for (i = 0; i < avi->num_streams; i++) {
avi_stream_context *stream = &avi->stream[i];
gst_pad_push_event (stream->pad, gst_event_ref (avi->seek_event));
}
gst_event_unref (avi->seek_event);
avi->seek_event = NULL; avi->seek_event = NULL;
} }
if ((res = gst_avi_demux_stream_data (avi)) != GST_FLOW_OK) if ((res = gst_avi_demux_stream_data (avi)) != GST_FLOW_OK)
goto pause; goto pause;
break; break;