1.1 --- a/gst-gmyth/nuvdemux/gstnuvdemux.c Thu Jun 14 20:40:47 2007 +0100
1.2 +++ b/gst-gmyth/nuvdemux/gstnuvdemux.c Mon Oct 08 19:35:09 2007 +0100
1.3 @@ -739,8 +739,13 @@
1.4 static void
1.5 gst_nuv_demux_create_pads(GstNuvDemux * nuv)
1.6 {
1.7 - if (nuv->priv->h.i_video_blocks != 0) {
1.8 - GstCaps *video_caps = NULL;
1.9 + if ((nuv->priv->src_video_pad != NULL) ||
1.10 + (nuv->priv->src_audio_pad != NULL)) {
1.11 + return;
1.12 + }
1.13 +
1.14 + if (nuv->priv->h.i_video_blocks != 0){
1.15 + GstCaps *video_caps = NULL;
1.16
1.17 video_caps = gst_caps_new_simple("video/x-divx",
1.18 "divxversion", G_TYPE_INT, 4,
1.19 @@ -764,13 +769,15 @@
1.20 }
1.21
1.22 if (nuv->priv->h.i_audio_blocks != 0) {
1.23 - GstCaps *audio_caps = NULL;
1.24 + GstCaps *audio_caps = NULL;
1.25
1.26 - 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:
1.27 - // magic
1.28 - // number
1.29 - "mpegversion", G_TYPE_INT,
1.30 - nuv->priv->eh.i_version, NULL);
1.31 + audio_caps = gst_caps_new_simple("audio/mpeg",
1.32 + "rate", G_TYPE_INT, nuv->priv->eh.i_audio_sample_rate,
1.33 + "format", GST_TYPE_FOURCC, nuv->priv->eh.i_audio_fcc,
1.34 + "channels", G_TYPE_INT, nuv->priv->eh.i_audio_channels,
1.35 + "layer", G_TYPE_INT, 3, // fixme: magic number
1.36 + "mpegversion", G_TYPE_INT, nuv->priv->eh.i_version,
1.37 + NULL);
1.38
1.39 nuv->priv->src_audio_pad =
1.40 gst_nuv_demux_create_pad(nuv, audio_caps, &audio_src_template,
1.41 @@ -854,7 +861,7 @@
1.42 return TRUE;
1.43 }
1.44
1.45 -static GstFlowReturn
1.46 +static GstFlowReturn
1.47 gst_nuv_demux_stream_data(GstNuvDemux * nuv)
1.48 {
1.49 GstFlowReturn ret = GST_FLOW_OK;
1.50 @@ -1643,57 +1650,17 @@
1.51 nuv = GST_NUV_DEMUX(gst_pad_get_parent(pad));
1.52
1.53 switch (GST_EVENT_TYPE(event)) {
1.54 - case GST_EVENT_NEWSEGMENT:
1.55 - {
1.56 - gboolean update;
1.57 - gdouble rate;
1.58 - GstFormat format;
1.59 - gint64 start;
1.60 - gint64 stop;
1.61 - gint64 position;
1.62 -
1.63 - gst_event_parse_new_segment(event, &update, &rate, &format,
1.64 - &start, &stop, &position);
1.65 - if ((format == GST_FORMAT_BYTES) && (start == 0)) {
1.66 - g_debug("NEW SEGMENT 0");
1.67 - if (nuv->priv->segment > 0) {
1.68 - nuv->priv->new_file = TRUE;
1.69 - nuv->priv->state = GST_NUV_DEMUX_START;
1.70 - nuv->priv->offset = 0;
1.71 - }
1.72 - nuv->priv->segment++;
1.73 -
1.74 - /*
1.75 - * newsegment_event = gst_event_new_new_segment (FALSE,
1.76 - * rate, GST_FORMAT_TIME, 0, GST_CLOCK_TIME_NONE,
1.77 - * GST_CLOCK_TIME_NONE);
1.78 - *
1.79 - * gst_pad_push_event (nuv->priv->src_audio_pad,
1.80 - * gst_event_ref (newsegment_event)); gst_pad_push_event
1.81 - * (nuv->priv->src_video_pad, gst_event_ref
1.82 - * (newsegment_event)); gst_event_unref
1.83 - * (newsegment_event);
1.84 - */
1.85 - res = gst_pad_event_default(pad, event);
1.86 - }
1.87 - break;
1.88 - }
1.89 - case GST_EVENT_CUSTOM_DOWNSTREAM:
1.90 - {
1.91 - /*
1.92 - * nuv->priv->new_file = TRUE; nuv->priv->state =
1.93 - * GST_NUV_DEMUX_START; nuv->priv->offset = 0;
1.94 - */
1.95 + case GST_EVENT_NEWSEGMENT:
1.96 GST_PAD_STREAM_LOCK(pad);
1.97 gst_nuv_demux_reset(nuv);
1.98 GST_PAD_STREAM_UNLOCK(pad);
1.99
1.100 + //res = gst_pad_event_default(pad, event);
1.101 + res = TRUE;
1.102 + break;
1.103 + default:
1.104 res = gst_pad_event_default(pad, event);
1.105 break;
1.106 - }
1.107 - default:
1.108 - res = gst_pad_event_default(pad, event);
1.109 - break;
1.110 }
1.111
1.112 return res;
1.113 @@ -1783,7 +1750,6 @@
1.114 {
1.115 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
1.116
1.117 - g_debug("Nuvdemux state_change");
1.118 switch (transition) {
1.119 case GST_STATE_CHANGE_NULL_TO_READY:
1.120 gst_nuv_demux_reset(GST_NUV_DEMUX(element));
1.121 @@ -1793,8 +1759,6 @@
1.122 break;
1.123 }
1.124
1.125 - g_debug("Nuvdemux state_change: 1");
1.126 -
1.127 ret =
1.128 GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
1.129 if (ret == GST_STATE_CHANGE_FAILURE) {
1.130 @@ -1802,8 +1766,6 @@
1.131 }
1.132
1.133
1.134 - g_debug("Nuvdemux state_change: 2");
1.135 -
1.136 switch (transition) {
1.137 case GST_STATE_CHANGE_READY_TO_NULL:
1.138 gst_nuv_demux_reset(GST_NUV_DEMUX(element));
1.139 @@ -1812,10 +1774,6 @@
1.140 default:
1.141 break;
1.142 }
1.143 -
1.144 -
1.145 - g_debug("Nuvdemux state_change: DONE");
1.146 -
1.147 done:
1.148 return ret;
1.149 }