From: Thomas V. S. <th...@ur...> - 2002-09-19 10:51:51
|
Hey ronald, I can understand you not wanting to update your version just yet, but now you're just breaking the build by backing out uraeus's license change ;) can you please fix that ? Thanks ;) Thomas > CVS Root: /cvsroot/gstreamer > Module: gst-plugins > Changes by: rbultje > Date: Thu Sep 19 2002 03:46:14 PDT > > Log message: > This fixes some problems when recording AVI files with gstrec > > Modified files: > gst/avi : gstavimux.c gstavimux.h > > Links: > http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/avi/gstavimux.c.diff?r1=1.19&r2=1.20 > http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/avi/gstavimux.h.diff?r1=1.5&r2=1.6 > > ====Begin Diffs==== > Index: gstavimux.c > =================================================================== > RCS file: /cvsroot/gstreamer/gst-plugins/gst/avi/gstavimux.c,v > retrieving revision 1.19 > retrieving revision 1.20 > diff -u -d -r1.19 -r1.20 > --- gstavimux.c 18 Sep 2002 19:02:32 -0000 1.19 > +++ gstavimux.c 19 Sep 2002 10:46:01 -0000 1.20 > @@ -47,7 +47,6 @@ > { > "Avi multiplexer", > "Codec/Muxer", > - "LGPL", > "Muxes audio and video into an avi stream", > VERSION, > "Ronald Bultje <rb...@ro...>", > @@ -260,9 +259,11 @@ > for (i=0;i<MAX_NUM_AUDIO_PADS;i++) > avimux->audiosinkpad[i] = NULL; > avimux->num_audio_pads = 0; > + avimux->num_audio_pads_connected = 0; > for (i=0;i<MAX_NUM_VIDEO_PADS;i++) > avimux->videosinkpad[i] = NULL; > avimux->num_video_pads = 0; > + avimux->num_video_pads_connected = 0; > > avimux->num_frames = 0; > > @@ -417,6 +418,56 @@ > return GST_PAD_CONNECT_OK; > } > > +static void > +gst_avimux_pad_connect (GstPad *pad, > + GstPad *peer, > + gpointer data) > +{ > + GstAviMux *avimux = GST_AVIMUX(data); > + const gchar *padname = gst_pad_get_name (pad); > + > + if (!strncmp(padname, "audio_", 6)) > + { > + avimux->num_audio_pads_connected++; > + } > + else if (!strncmp(padname, "video_", 6)) > + { > + avimux->num_video_pads_connected++; > + } > + else > + { > + g_warning("Unknown padname '%s'", padname); > + return; > + } > + > + GST_DEBUG(GST_CAT_PLUGIN_INFO, "pad '%s' connected", padname); > +} > + > +static void > +gst_avimux_pad_disconnect (GstPad *pad, > + GstPad *peer, > + gpointer data) > +{ > + GstAviMux *avimux = GST_AVIMUX(data); > + const gchar *padname = gst_pad_get_name (pad); > + > + if (!strncmp(padname, "audio_", 6)) > + { > + avimux->num_audio_pads_connected--; > + } > + else if (!strncmp(padname, "video_", 6)) > + { > + avimux->num_video_pads_connected--; > + } > + else > + { > + g_warning("Unknown padname '%s'", padname); > + return; > + } > + > + GST_DEBUG(GST_CAT_PLUGIN_INFO, "pad '%s' disconnected", padname); > +} > + > static GstPad* > gst_avimux_request_new_pad (GstElement *element, > GstPadTemplate *templ, > @@ -460,6 +511,10 @@ > return NULL; > } > > + g_signal_connect(newpad, "connected", > + G_CALLBACK(gst_avimux_pad_connect), (gpointer)avimux); > + g_signal_connect(newpad, "disconnected", > + G_CALLBACK(gst_avimux_pad_disconnect), (gpointer)avimux); > gst_pad_set_chain_function (newpad, gst_avimux_chain); > gst_pad_set_connect_function (newpad, gst_avimux_sinkconnect); > gst_element_add_pad (element, newpad); > @@ -484,12 +539,12 @@ > /* first, let's see what actually needs to be in the buffer */ > GST_BUFFER_SIZE(buffer) = 0; > GST_BUFFER_SIZE(buffer) += 32 + sizeof(gst_riff_avih); /* avi header */ > - if (avimux->num_video_pads) > + if (avimux->num_video_pads_connected) > { /* we have video */ > GST_BUFFER_SIZE(buffer) += 28 + sizeof(gst_riff_strh) + sizeof(gst_riff_strf_vids); /* vid hdr */ > GST_BUFFER_SIZE(buffer) += 24; /* odml header */ > } > - if (avimux->num_audio_pads) > + if (avimux->num_audio_pads_connected) > { /* we have audio */ > GST_BUFFER_SIZE(buffer) += 28 + sizeof(gst_riff_strh) + sizeof(gst_riff_strf_auds); /* aud hdr */ > } > @@ -542,7 +597,7 @@ > temp32 = LE_FROM_GUINT32(avimux->avi_hdr.length); > memcpy(buffdata, &temp32, 4); buffdata += 4; > > - if (avimux->num_video_pads) > + if (avimux->num_video_pads_connected) > { > /* video header metadata */ > memcpy(buffdata, "LIST", 4); buffdata += 4; > @@ -607,7 +662,7 @@ > memcpy(buffdata, &temp32, 4); buffdata += 4; > } > > - if (avimux->num_audio_pads) > + if (avimux->num_audio_pads_connected) > { > /* audio header */ > memcpy(buffdata, "LIST", 4); buffdata += 4; > @@ -662,7 +717,7 @@ > memcpy(buffdata, &temp16, 2); buffdata += 2; > } > > - if (avimux->num_video_pads) > + if (avimux->num_video_pads_connected) > { > /* odml header */ > memcpy(buffdata, "LIST", 4); buffdata += 4; > @@ -743,17 +798,14 @@ > /* some other usable functions (thankyou xawtv ;-) ) */ > > static void > -gst_avimux_add_index (GstAviMux *avimux, guint32 fourcc, guint32 flags, guint32 size) > +gst_avimux_add_index (GstAviMux *avimux, guchar *code, guint32 flags, guint32 size) > { > - guint32 temp32; > - > if (avimux->idx_index == avimux->idx_count) > { > avimux->idx_count += 256; > avimux->idx = realloc(avimux->idx, avimux->idx_count*sizeof(gst_riff_index_entry)); > } > - temp32 = LE_FROM_GUINT32(fourcc); > - memcpy(&(avimux->idx[avimux->idx_index].id), &temp32, 4); > + memcpy(&(avimux->idx[avimux->idx_index].id), code, 4); > avimux->idx[avimux->idx_index].flags = LE_FROM_GUINT32(flags); > avimux->idx[avimux->idx_index].offset = LE_FROM_GUINT32(avimux->idx_offset-avimux->header_size-8); > avimux->idx[avimux->idx_index].size = LE_FROM_GUINT32(size); > @@ -852,7 +904,7 @@ > avimux->idx = NULL; > > /* header */ > - avimux->avi_hdr.streams = avimux->num_video_pads + avimux->num_audio_pads; > + avimux->avi_hdr.streams = avimux->num_video_pads_connected + avimux->num_audio_pads_connected; > avimux->is_bigfile = FALSE; > > header = gst_avimux_riff_get_avi_header(avimux); > @@ -870,7 +922,7 @@ > GstBuffer *header; > > /* if bigfile, rewrite header, else write indexes */ > - if (avimux->num_video_pads) > + if (avimux->num_video_pads_connected) > { > if (avimux->is_bigfile) > { > @@ -885,17 +937,17 @@ > > /* statistics/total_frames/... */ > avimux->avi_hdr.tot_frames = avimux->num_frames; > - if (avimux->num_video_pads) > + if (avimux->num_video_pads_connected) > avimux->vids_hdr.length = avimux->num_frames; > - if (avimux->num_audio_pads) > + if (avimux->num_audio_pads_connected) > avimux->auds_hdr.length = avimux->audio_size/avimux->auds_hdr.scale; > > /* TODO: fps calculation!! */ > avimux->avi_hdr.us_frame = 1000000/avimux->framerate; > avimux->avi_hdr.max_bps = 0; > - if (avimux->num_audio_pads) > + if (avimux->num_audio_pads_connected) > avimux->avi_hdr.max_bps += avimux->auds.av_bps; > - if (avimux->num_video_pads) > + if (avimux->num_video_pads_connected) > avimux->avi_hdr.max_bps += avimux->vids.bit_cnt/8 * avimux->framerate; > > /* seek and rewrite the header */ > @@ -982,7 +1034,7 @@ > { > avimux->data_size += GST_BUFFER_SIZE(newbuf) + GST_BUFFER_SIZE(buf); > avimux->audio_size += GST_BUFFER_SIZE(buf); > - gst_avimux_add_index(avimux, avimux->auds.format, 0x0, GST_BUFFER_SIZE(buf)); > + gst_avimux_add_index(avimux, "01wb", 0x0, GST_BUFFER_SIZE(buf)); > } > > gst_pad_push(avimux->srcpad, newbuf); > @@ -1016,7 +1068,7 @@ > { > avimux->data_size += GST_BUFFER_SIZE(newbuf) + GST_BUFFER_SIZE(buf); > avimux->num_frames++; > - gst_avimux_add_index(avimux, avimux->vids.compression, 0x12, GST_BUFFER_SIZE(buf)); > + gst_avimux_add_index(avimux, "00db", 0x12, GST_BUFFER_SIZE(buf)); > } > > gst_pad_push(avimux->srcpad, newbuf); > Index: gstavimux.h > =================================================================== > RCS file: /cvsroot/gstreamer/gst-plugins/gst/avi/gstavimux.h,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -u -d -r1.5 -r1.6 > --- gstavimux.h 20 Feb 2002 07:25:39 -0000 1.5 > +++ gstavimux.h 19 Sep 2002 10:46:01 -0000 1.6 > @@ -55,9 +55,9 @@ > /* pads */ > GstPad *srcpad; > GstPad *audiosinkpad[MAX_NUM_AUDIO_PADS]; > - gint num_audio_pads; > + gint num_audio_pads, num_audio_pads_connected; > GstPad *videosinkpad[MAX_NUM_VIDEO_PADS]; > - gint num_video_pads; > + gint num_video_pads, num_video_pads_connected; > > /* timestamps of first and current frame + num_frames for fps calculation */ > gdouble framerate; > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > gstreamer-cvs-verbose mailing list > gst...@li... > https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose > -- The Dave/Dina Project : future TV today ! - http://davedina.apestaart.org/ <-*- -*-> And I'm not the drowning man you think I flail my arms and refuse to sink <-*- th...@ap... -*-> URGent, the best radio on the Internet - 24/7 ! - http://urgent.rug.ac.be/ |