# HG changeset patch # User renatofilho # Date 1164819147 0 # Node ID a60f905e0412a2d95c971eefdcef501a57a7ccc7 # Parent 3c5189bfdca692d693fed80bf90f169876566b6c [svn r137] diff -r 3c5189bfdca6 -r a60f905e0412 gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Wed Nov 29 13:02:32 2006 +0000 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Wed Nov 29 16:52:27 2006 +0000 @@ -747,10 +747,11 @@ pad = nuv->priv->src_video_pad; if (nuv->priv->new_video_segment) { + /* send new segment event*/ - gst_pad_push_event (nuv->priv->src_video_pad, - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, - GST_CLOCK_TIME_NONE, 0)); +// gst_pad_push_event (nuv->priv->src_video_pad, +// gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, +// GST_CLOCK_TIME_NONE, 0)); if (nuv->priv->time_start == GST_CLOCK_TIME_NONE) { nuv->priv->time_start = timestamp; @@ -766,9 +767,9 @@ if (nuv->priv->new_audio_segment) { /* send new segment event*/ - gst_pad_push_event (nuv->priv->src_audio_pad, - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, - GST_CLOCK_TIME_NONE, 0)); +// gst_pad_push_event (nuv->priv->src_audio_pad, +// gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, +// GST_CLOCK_TIME_NONE, 0)); if (nuv->priv->time_start == GST_CLOCK_TIME_NONE) { nuv->priv->time_start = timestamp; @@ -819,6 +820,8 @@ ret = gst_pad_push (pad, buf); if (ret != GST_FLOW_OK) { + GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad)); + if (pad == nuv->priv->src_video_pad) { nuv->priv->last_video_return = ret; } @@ -831,7 +834,7 @@ ret = GST_FLOW_OK; } - GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad)); + //GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad)); } } @@ -960,58 +963,49 @@ if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - if (nuv->priv->state != GST_NUV_DEMUX_HEADER_DATA) - break; + break; case GST_NUV_DEMUX_HEADER_DATA: res = gst_nuv_demux_stream_header_data (nuv); if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - if (nuv->priv->state != GST_NUV_DEMUX_EXTRA_DATA) - break; + break; case GST_NUV_DEMUX_EXTRA_DATA: res = gst_nuv_demux_stream_extra_data (nuv); if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - if (nuv->priv->state != GST_NUV_DEMUX_MPEG_DATA) - break; + break; case GST_NUV_DEMUX_MPEG_DATA: res = gst_nuv_demux_stream_mpeg_data (nuv); if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - - if (nuv->priv->state != GST_NUV_DEMUX_EXTEND_HEADER) - break; + break; case GST_NUV_DEMUX_EXTEND_HEADER: res = gst_nuv_demux_stream_extend_header (nuv); if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - if (nuv->priv->state != GST_NUV_DEMUX_EXTEND_HEADER_DATA) - break; + break; case GST_NUV_DEMUX_EXTEND_HEADER_DATA: res = gst_nuv_demux_stream_extend_header_data (nuv); if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - - if (nuv->priv->state != GST_NUV_DEMUX_FRAME_HEADER) - break; + break; case GST_NUV_DEMUX_FRAME_HEADER: res = gst_nuv_demux_read_head_frame (nuv); if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } - if (nuv->priv->state != GST_NUV_DEMUX_MOVI) - break; + break; case GST_NUV_DEMUX_MOVI: res = gst_nuv_demux_stream_data (nuv); @@ -1019,6 +1013,7 @@ goto pause; } break; + case GST_NUV_DEMUX_INVALID_DATA: goto pause; break; @@ -1144,7 +1139,6 @@ { GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad)); - g_debug ("gst_nuv_demux_sink_activate_push: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"); if (active) { @@ -1234,6 +1228,7 @@ GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad)); GST_DEBUG_OBJECT (nuv, " gst_nuv_demux_chain function"); + g_debug (" gst_nuv_demux_chain function"); gst_adapter_push (nuv->priv->adapter, buf); gst_object_unref (nuv); @@ -1298,8 +1293,9 @@ { GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + g_debug ("TRANSI %d", transition); switch (transition) { - case GST_STATE_CHANGE_READY_TO_PAUSED: + case GST_STATE_CHANGE_NULL_TO_READY: g_debug ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx= RESET"); gst_nuv_demux_reset (GST_NUV_DEMUX (element)); gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element)); @@ -1309,8 +1305,10 @@ } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - if (ret == GST_STATE_CHANGE_FAILURE) + if (ret == GST_STATE_CHANGE_FAILURE) { + g_debug ("FFFFFFFFFFFFFFFFFFFFFAAAAAAAAAAAAAAAAAIIIIIIIIIIIIIIIIIILLLLLLLLLLLLLLLLLL"); goto done; + } switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: @@ -1343,13 +1341,19 @@ if (duration_bytes == GST_CLOCK_TIME_NONE) return; - interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND); - average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval); - nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average); - nuv->priv->last_update = current_timestamp; - msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average); - gst_element_post_message (GST_ELEMENT (nuv), msg); - GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average); + if (current_timestamp > 0) { + interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND); + if (interval > 0) { + average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval); + } + if (average > 0) { + nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average); + } + nuv->priv->last_update = current_timestamp; + msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average); + gst_element_post_message (GST_ELEMENT (nuv), msg); + GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average); + } } }