summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-08-27 17:23:46 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-08-27 17:23:46 +0200
commitb899bca94d6fdd7cae2e0bdbdeffd3c6ca3e4f99 (patch)
treeec5c3fd91a0ebd7b0d76ae14dfc08e04340b2706
parent93aa13639d74449dc68296427e5dbcfe8aca5f51 (diff)
oggdemux: Don't use GST_FLOW_IS_FATAL()
And while we're at it, handle WRONG_STATE as error too in oggdemux and WRONG_STATE and NOT_LINKED in oggaviparse.
-rw-r--r--ext/ogg/gstoggaviparse.c2
-rw-r--r--ext/ogg/gstoggdemux.c68
2 files changed, 37 insertions, 33 deletions
diff --git a/ext/ogg/gstoggaviparse.c b/ext/ogg/gstoggaviparse.c
index bb210f3e7..2851e5272 100644
--- a/ext/ogg/gstoggaviparse.c
+++ b/ext/ogg/gstoggaviparse.c
@@ -406,7 +406,7 @@ gst_ogg_avi_parse_chain (GstPad * pad, GstBuffer * buffer)
406 break; 406 break;
407 case 1: 407 case 1:
408 result = gst_ogg_avi_parse_push_packet (ogg, &packet); 408 result = gst_ogg_avi_parse_push_packet (ogg, &packet);
409 if (GST_FLOW_IS_FATAL (result)) 409 if (result != GST_FLOW_OK)
410 goto done; 410 goto done;
411 break; 411 break;
412 default: 412 default:
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index bb5362f27..6716c1599 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -992,7 +992,7 @@ gst_ogg_pad_stream_out (GstOggPad * pad, gint npackets)
992 case 1: 992 case 1:
993 GST_LOG_OBJECT (ogg, "packetout gave packet of size %ld", packet.bytes); 993 GST_LOG_OBJECT (ogg, "packetout gave packet of size %ld", packet.bytes);
994 result = gst_ogg_pad_submit_packet (pad, &packet); 994 result = gst_ogg_pad_submit_packet (pad, &packet);
995 if (GST_FLOW_IS_FATAL (result)) 995 if (result != GST_FLOW_OK)
996 goto could_not_submit; 996 goto could_not_submit;
997 break; 997 break;
998 default: 998 default:
@@ -3420,40 +3420,44 @@ pause:
3420 ogg->segment_running = FALSE; 3420 ogg->segment_running = FALSE;
3421 gst_pad_pause_task (ogg->sinkpad); 3421 gst_pad_pause_task (ogg->sinkpad);
3422 3422
3423 if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) { 3423 if (ret == GST_FLOW_UNEXPECTED) {
3424 if (ret == GST_FLOW_UNEXPECTED) { 3424 /* perform EOS logic */
3425 /* perform EOS logic */ 3425 if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) {
3426 if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) { 3426 gint64 stop;
3427 gint64 stop; 3427 GstMessage *message;
3428 GstMessage *message; 3428
3429 3429 /* for segment playback we need to post when (in stream time)
3430 /* for segment playback we need to post when (in stream time) 3430 * we stopped, this is either stop (when set) or the duration. */
3431 * we stopped, this is either stop (when set) or the duration. */ 3431 if ((stop = ogg->segment.stop) == -1)
3432 if ((stop = ogg->segment.stop) == -1) 3432 stop = ogg->segment.duration;
3433 stop = ogg->segment.duration; 3433
3434 3434 GST_LOG_OBJECT (ogg, "Sending segment done, at end of segment");
3435 GST_LOG_OBJECT (ogg, "Sending segment done, at end of segment"); 3435 message =
3436 message = 3436 gst_message_new_segment_done (GST_OBJECT (ogg), GST_FORMAT_TIME,
3437 gst_message_new_segment_done (GST_OBJECT (ogg), GST_FORMAT_TIME, 3437 stop);
3438 stop); 3438 gst_message_set_seqnum (message, ogg->seqnum);
3439 gst_message_set_seqnum (message, ogg->seqnum); 3439
3440 3440 gst_element_post_message (GST_ELEMENT (ogg), message);
3441 gst_element_post_message (GST_ELEMENT (ogg), message);
3442 } else {
3443 /* normal playback, send EOS to all linked pads */
3444 GST_LOG_OBJECT (ogg, "Sending EOS, at end of stream");
3445 event = gst_event_new_eos ();
3446 }
3447 } else { 3441 } else {
3448 GST_ELEMENT_ERROR (ogg, STREAM, FAILED, 3442 /* normal playback, send EOS to all linked pads */
3449 (_("Internal data stream error.")), 3443 GST_LOG_OBJECT (ogg, "Sending EOS, at end of stream");
3450 ("stream stopped, reason %s", reason));
3451 event = gst_event_new_eos (); 3444 event = gst_event_new_eos ();
3452 } 3445 }
3453 if (event) { 3446 } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED) {
3454 gst_event_set_seqnum (event, ogg->seqnum); 3447 GST_ELEMENT_ERROR (ogg, STREAM, FAILED,
3455 gst_ogg_demux_send_event (ogg, event); 3448 (_("Internal data stream error.")),
3456 } 3449 ("stream stopped, reason %s", reason));
3450 event = gst_event_new_eos ();
3451 }
3452
3453 /* For wrong-state we still want to pause the task and stop
3454 * but no error message or other things are necessary.
3455 * wrong-state is no real error and will be caused by flushing,
3456 * e.g. because of a flushing seek.
3457 */
3458 if (event) {
3459 gst_event_set_seqnum (event, ogg->seqnum);
3460 gst_ogg_demux_send_event (ogg, event);
3457 } 3461 }
3458 return; 3462 return;
3459 } 3463 }