ext/dv/gstdvdec.c (gst_dvdec_decode_video): Don't clobber alloc_buffer's return value.

Original commit message from CVS:
2005-07-19  Andy Wingo  <wingo@pobox.com>

* ext/dv/gstdvdec.c (gst_dvdec_decode_video): Don't clobber
alloc_buffer's return value.
(gst_dvdec_decode_frame): Handle unlinked pads with grace and
agility.
This commit is contained in:
Andy Wingo 2005-07-19 15:29:08 +00:00
parent c2eac81daa
commit ee992ce60d
2 changed files with 24 additions and 11 deletions

View file

@ -1,5 +1,10 @@
2005-07-19 Andy Wingo <wingo@pobox.com> 2005-07-19 Andy Wingo <wingo@pobox.com>
* ext/dv/gstdvdec.c (gst_dvdec_decode_video): Don't clobber
alloc_buffer's return value.
(gst_dvdec_decode_frame): Handle unlinked pads with grace and
agility.
* ext/dv/gstdvdec.h: Fix signedness error. * ext/dv/gstdvdec.h: Fix signedness error.
2005-07-19 Wim Taymans <wim@fluendo.com> 2005-07-19 Wim Taymans <wim@fluendo.com>

View file

@ -767,11 +767,11 @@ error:
static gboolean static gboolean
gst_dvdec_send_event (GstDVDec * dvdec, GstEvent * event) gst_dvdec_send_event (GstDVDec * dvdec, GstEvent * event)
{ {
gboolean res = TRUE; gboolean res = FALSE;
gst_event_ref (event); gst_event_ref (event);
res &= gst_pad_push_event (dvdec->videosrcpad, event); res |= gst_pad_push_event (dvdec->videosrcpad, event);
res &= gst_pad_push_event (dvdec->audiosrcpad, event); res |= gst_pad_push_event (dvdec->audiosrcpad, event);
return res; return res;
} }
@ -1151,8 +1151,10 @@ gst_dvdec_decode_video (GstDVDec * dvdec, const guint8 * data)
goto skip; goto skip;
dvdec->framecount = 0; dvdec->framecount = 0;
if ((gst_pad_alloc_buffer (dvdec->videosrcpad, 0, (720 * height) * dvdec->bpp, ret =
GST_PAD_CAPS (dvdec->videosrcpad), &outbuf)) != GST_FLOW_OK) gst_pad_alloc_buffer (dvdec->videosrcpad, 0, (720 * height) * dvdec->bpp,
GST_PAD_CAPS (dvdec->videosrcpad), &outbuf);
if (ret != GST_FLOW_OK)
goto no_buffer; goto no_buffer;
outframe = GST_BUFFER_DATA (outbuf); outframe = GST_BUFFER_DATA (outbuf);
@ -1190,7 +1192,7 @@ skip:
/* ERRORS */ /* ERRORS */
no_buffer: no_buffer:
{ {
return GST_FLOW_WRONG_STATE; return ret;
} }
} }
@ -1199,7 +1201,7 @@ gst_dvdec_decode_frame (GstDVDec * dvdec, const guint8 * data)
{ {
GstClockTime next_ts; GstClockTime next_ts;
gdouble framerate; gdouble framerate;
GstFlowReturn ret; GstFlowReturn aret, vret, ret;
if (dvdec->need_discont) { if (dvdec->need_discont) {
GstEvent *event; GstEvent *event;
@ -1239,14 +1241,20 @@ gst_dvdec_decode_frame (GstDVDec * dvdec, const guint8 * data)
if (dv_is_new_recording (dvdec->decoder, data)) if (dv_is_new_recording (dvdec->decoder, data))
dvdec->new_media = TRUE; dvdec->new_media = TRUE;
ret = gst_dvdec_decode_audio (dvdec, data); aret = ret = gst_dvdec_decode_audio (dvdec, data);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED)
goto done; goto done;
ret = gst_dvdec_decode_video (dvdec, data); vret = ret = gst_dvdec_decode_video (dvdec, data);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED)
goto done; goto done;
if (aret == GST_FLOW_NOT_LINKED && vret == GST_FLOW_NOT_LINKED) {
ret = GST_FLOW_NOT_LINKED;
goto done;
}
ret = GST_FLOW_OK;
dvdec->timestamp = next_ts; dvdec->timestamp = next_ts;
done: done: