diff -r cb885ee44618 -r e711a64ba03d gst-gmyth/nuvdemux/gstnuvdemux.c --- a/gst-gmyth/nuvdemux/gstnuvdemux.c Thu Jun 14 20:40:47 2007 +0100 +++ b/gst-gmyth/nuvdemux/gstnuvdemux.c Thu Aug 23 20:24:11 2007 +0100 @@ -739,8 +739,13 @@ static void gst_nuv_demux_create_pads(GstNuvDemux * nuv) { - if (nuv->priv->h.i_video_blocks != 0) { - GstCaps *video_caps = NULL; + if ((nuv->priv->src_video_pad != NULL) || + (nuv->priv->src_audio_pad != NULL)) { + return; + } + + if (nuv->priv->h.i_video_blocks != 0){ + GstCaps *video_caps = NULL; video_caps = gst_caps_new_simple("video/x-divx", "divxversion", G_TYPE_INT, 4, @@ -764,13 +769,15 @@ } if (nuv->priv->h.i_audio_blocks != 0) { - GstCaps *audio_caps = NULL; + GstCaps *audio_caps = NULL; - audio_caps = gst_caps_new_simple("audio/mpeg", "rate", G_TYPE_INT, nuv->priv->eh.i_audio_sample_rate, "format", GST_TYPE_FOURCC, nuv->priv->eh.i_audio_fcc, "channels", G_TYPE_INT, nuv->priv->eh.i_audio_channels, "layer", G_TYPE_INT, 3, // fixme: - // magic - // number - "mpegversion", G_TYPE_INT, - nuv->priv->eh.i_version, NULL); + audio_caps = gst_caps_new_simple("audio/mpeg", + "rate", G_TYPE_INT, nuv->priv->eh.i_audio_sample_rate, + "format", GST_TYPE_FOURCC, nuv->priv->eh.i_audio_fcc, + "channels", G_TYPE_INT, nuv->priv->eh.i_audio_channels, + "layer", G_TYPE_INT, 3, // fixme: magic number + "mpegversion", G_TYPE_INT, nuv->priv->eh.i_version, + NULL); nuv->priv->src_audio_pad = gst_nuv_demux_create_pad(nuv, audio_caps, &audio_src_template, @@ -854,7 +861,7 @@ return TRUE; } -static GstFlowReturn +static GstFlowReturn gst_nuv_demux_stream_data(GstNuvDemux * nuv) { GstFlowReturn ret = GST_FLOW_OK; @@ -1643,57 +1650,17 @@ nuv = GST_NUV_DEMUX(gst_pad_get_parent(pad)); switch (GST_EVENT_TYPE(event)) { - case GST_EVENT_NEWSEGMENT: - { - gboolean update; - gdouble rate; - GstFormat format; - gint64 start; - gint64 stop; - gint64 position; - - gst_event_parse_new_segment(event, &update, &rate, &format, - &start, &stop, &position); - if ((format == GST_FORMAT_BYTES) && (start == 0)) { - g_debug("NEW SEGMENT 0"); - if (nuv->priv->segment > 0) { - nuv->priv->new_file = TRUE; - nuv->priv->state = GST_NUV_DEMUX_START; - nuv->priv->offset = 0; - } - nuv->priv->segment++; - - /* - * newsegment_event = gst_event_new_new_segment (FALSE, - * rate, GST_FORMAT_TIME, 0, GST_CLOCK_TIME_NONE, - * GST_CLOCK_TIME_NONE); - * - * gst_pad_push_event (nuv->priv->src_audio_pad, - * gst_event_ref (newsegment_event)); gst_pad_push_event - * (nuv->priv->src_video_pad, gst_event_ref - * (newsegment_event)); gst_event_unref - * (newsegment_event); - */ - res = gst_pad_event_default(pad, event); - } - break; - } - case GST_EVENT_CUSTOM_DOWNSTREAM: - { - /* - * nuv->priv->new_file = TRUE; nuv->priv->state = - * GST_NUV_DEMUX_START; nuv->priv->offset = 0; - */ + case GST_EVENT_NEWSEGMENT: GST_PAD_STREAM_LOCK(pad); gst_nuv_demux_reset(nuv); GST_PAD_STREAM_UNLOCK(pad); + //res = gst_pad_event_default(pad, event); + res = TRUE; + break; + default: res = gst_pad_event_default(pad, event); break; - } - default: - res = gst_pad_event_default(pad, event); - break; } return res; @@ -1783,7 +1750,6 @@ { GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; - g_debug("Nuvdemux state_change"); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: gst_nuv_demux_reset(GST_NUV_DEMUX(element)); @@ -1793,8 +1759,6 @@ break; } - g_debug("Nuvdemux state_change: 1"); - ret = GST_ELEMENT_CLASS(parent_class)->change_state(element, transition); if (ret == GST_STATE_CHANGE_FAILURE) { @@ -1802,8 +1766,6 @@ } - g_debug("Nuvdemux state_change: 2"); - switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: gst_nuv_demux_reset(GST_NUV_DEMUX(element)); @@ -1812,10 +1774,6 @@ default: break; } - - - g_debug("Nuvdemux state_change: DONE"); - done: return ret; }