1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Wed Nov 15 18:07:23 2006 +0000
1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Wed Nov 15 18:11:45 2006 +0000
1.3 @@ -405,7 +405,6 @@
1.4 {
1.5 static const GstQueryType src_types[] = {
1.6 GST_QUERY_POSITION,
1.7 - GST_QUERY_DURATION,
1.8 0
1.9 };
1.10
1.11 @@ -427,18 +426,6 @@
1.12 GST_DEBUG_OBJECT (nuv, "POS %d", nuv->last_frame_time);
1.13 }
1.14 break;
1.15 - case GST_QUERY_DURATION:
1.16 - if (nuv->duration != 0) {
1.17 - gint64 total;
1.18 - gint64 fps;
1.19 -
1.20 - fps = nuv->h->i_fpsn / nuv->h->i_fpsd;
1.21 - total = gst_util_uint64_scale_int (GST_SECOND, nuv->h->i_video_blocks, fps);
1.22 - gst_query_set_duration (query, GST_FORMAT_TIME, total);
1.23 - GST_DEBUG_OBJECT (nuv, "DURATION %d", total);
1.24 - res = TRUE;
1.25 - }
1.26 - break;
1.27 default:
1.28 res = FALSE;
1.29 break;
1.30 @@ -520,6 +507,25 @@
1.31 return ret;
1.32 }
1.33
1.34 +static gboolean
1.35 +gst_nuv_combine_flow (GstNuvDemux *nuv)
1.36 +{
1.37 + GstFlowReturn ret_video = nuv->last_video_return;
1.38 + GstFlowReturn ret_audio = nuv->last_audio_return;
1.39 +
1.40 + if ((ret_video != GST_FLOW_OK) &&
1.41 + (ret_audio != GST_FLOW_OK))
1.42 + return FALSE;
1.43 +
1.44 + if (GST_FLOW_IS_FATAL (nuv->last_video_return))
1.45 + return FALSE;
1.46 +
1.47 + if (GST_FLOW_IS_FATAL (nuv->last_audio_return))
1.48 + return FALSE;
1.49 +
1.50 + return TRUE;
1.51 +}
1.52 +
1.53 static GstFlowReturn
1.54 gst_nuv_demux_stream_data (GstNuvDemux * nuv)
1.55 {
1.56 @@ -552,11 +558,6 @@
1.57 if (h->i_length == 0)
1.58 break;
1.59
1.60 - if (!gst_pad_is_linked (nuv->src_video_pad)) {
1.61 - gst_buffer_unref (buf);
1.62 - break;
1.63 - }
1.64 -
1.65 if (nuv->new_video_segment) {
1.66 /* send new segment event*/
1.67 gst_pad_push_event (nuv->src_video_pad,
1.68 @@ -567,10 +568,11 @@
1.69
1.70 GST_BUFFER_SIZE (buf) = h->i_length;
1.71 gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_video_pad));
1.72 - ret = gst_pad_push (nuv->src_video_pad, buf);
1.73 - if (ret != GST_FLOW_OK) {
1.74 - GST_WARNING_OBJECT (nuv, "error pushing on srcpad %s, is linked? = %d",
1.75 - gst_pad_get_name (nuv->src_video_pad), gst_pad_is_linked (nuv->src_video_pad));
1.76 + nuv->last_video_return = gst_pad_push (nuv->src_video_pad, buf);
1.77 + if (!gst_nuv_combine_flow (nuv)) {
1.78 + ret = nuv->last_video_return;
1.79 + GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s, is linked? = %d",
1.80 + nuv->last_video_return, gst_pad_get_name (nuv->src_video_pad), gst_pad_is_linked (nuv->src_video_pad));
1.81 }
1.82 break;
1.83 }
1.84 @@ -578,11 +580,6 @@
1.85 {
1.86 if (h->i_length == 0)
1.87 break;
1.88 -
1.89 - if (!gst_pad_is_linked (nuv->src_audio_pad)) {
1.90 - gst_buffer_unref (buf);
1.91 - break;
1.92 - }
1.93
1.94 if (nuv->new_audio_segment) {
1.95 /* send new segment event*/
1.96 @@ -594,10 +591,11 @@
1.97
1.98 GST_BUFFER_SIZE (buf) = h->i_length;
1.99 gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_audio_pad));
1.100 - ret = gst_pad_push (nuv->src_audio_pad, buf);
1.101 - if (ret != GST_FLOW_OK) {
1.102 - GST_WARNING_OBJECT (nuv, "Error pushing on srcpad %s, is linked? = %d",
1.103 - gst_pad_get_name (nuv->src_audio_pad), gst_pad_is_linked (nuv->src_audio_pad));
1.104 + nuv->last_audio_return = gst_pad_push (nuv->src_audio_pad, buf);
1.105 + if (!gst_nuv_combine_flow (nuv)) {
1.106 + ret = nuv->last_audio_return;
1.107 + GST_WARNING_OBJECT (nuv, "Error %d pushing on srcpad %s, is linked? = %d",
1.108 + nuv->last_audio_return, gst_pad_get_name (nuv->src_audio_pad), gst_pad_is_linked (nuv->src_audio_pad));
1.109 }
1.110 break;
1.111 }
2.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.h Wed Nov 15 18:07:23 2006 +0000
2.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.h Wed Nov 15 18:11:45 2006 +0000
2.3 @@ -165,6 +165,9 @@
2.4 GstPad *src_video_pad;
2.5 GstPad *src_audio_pad;
2.6
2.7 + GstFlowReturn last_video_return;
2.8 + GstFlowReturn last_audio_return;
2.9 +
2.10 /* NUV decoding state */
2.11 GstNuvDemuxState state;
2.12 guint64 duration;