diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2004-10-26 11:22:07 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2004-10-26 11:22:07 +0000 |
commit | 1672e83d26cdf4232fb06ebb2120bfcf8b74de79 (patch) | |
tree | 5e682c2f5d61d2fa42941fa9313b80d328996894 | |
parent | 643c7ae9b1d9644bb11306510c06145edf097304 (diff) |
gst/avi/gstavimux.c: First calculate the rate, and only then use it. Hdr.rate is a multiple and not a derivative of h...
Original commit message from CVS:
* gst/avi/gstavimux.c: (gst_avimux_audsinkconnect),
(gst_avimux_stop_file):
First calculate the rate, and only then use it. Hdr.rate is a
multiple and not a derivative of hdr.scale. Scale is not the
same as blockalign but is solely related to rate.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gst/avi/gstavimux.c | 28 |
2 files changed, 22 insertions, 14 deletions
@@ -1,5 +1,13 @@ 2004-10-26 Ronald S. Bultje <rbultje@ronald.bitfreak.net> + * gst/avi/gstavimux.c: (gst_avimux_audsinkconnect), + (gst_avimux_stop_file): + First calculate the rate, and only then use it. Hdr.rate is a + multiple and not a derivative of hdr.scale. Scale is not the + same as blockalign but is solely related to rate. + +2004-10-26 Ronald S. Bultje <rbultje@ronald.bitfreak.net> + * ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_init), (gst_gnomevfssink_handle_event), (gst_gnomevfssink_chain): Implement seeking. diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index 0b709458..b1dee2a4 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -453,7 +453,7 @@ gst_avimux_audsinkconnect (GstPad * pad, const GstCaps * vscaps) avimux->auds_hdr.rate = avimux->auds.blockalign * avimux->auds.rate; avimux->auds_hdr.samplesize = avimux->auds.blockalign; - avimux->auds_hdr.scale = avimux->auds.blockalign; + avimux->auds_hdr.scale = 1; return GST_PAD_LINK_OK; } @@ -1039,31 +1039,21 @@ gst_avimux_stop_file (GstAviMux * avimux) } } - /* statistics/total_frames/... */ - avimux->avi_hdr.tot_frames = avimux->num_frames; - if (avimux->video_pad_connected) { - avimux->vids_hdr.length = avimux->num_frames; - } - if (avimux->audio_pad_connected) { - avimux->auds_hdr.length = - (avimux->audio_time * avimux->auds.rate) / GST_SECOND; - } - /* set rate and everything having to do with that */ avimux->avi_hdr.max_bps = 0; if (avimux->audio_pad_connected) { /* calculate bps if needed */ if (!avimux->auds.av_bps) { if (avimux->audio_time) { - avimux->auds_hdr.rate = + avimux->auds.av_bps = (GST_SECOND * avimux->audio_size) / avimux->audio_time; } else { GST_ELEMENT_ERROR (avimux, STREAM, MUX, (_("No or invalid input audio, AVI stream will be corrupt.")), (NULL)); - avimux->auds_hdr.rate = 0; + avimux->auds.av_bps = 0; } - avimux->auds.av_bps = avimux->auds_hdr.rate * avimux->auds_hdr.scale; + avimux->auds_hdr.rate = avimux->auds.av_bps * avimux->auds_hdr.scale; } avimux->avi_hdr.max_bps += avimux->auds.av_bps; } @@ -1072,6 +1062,16 @@ gst_avimux_stop_file (GstAviMux * avimux) (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size; } + /* statistics/total_frames/... */ + avimux->avi_hdr.tot_frames = avimux->num_frames; + if (avimux->video_pad_connected) { + avimux->vids_hdr.length = avimux->num_frames; + } + if (avimux->audio_pad_connected) { + avimux->auds_hdr.length = + (avimux->audio_time * avimux->auds_hdr.rate) / GST_SECOND; + } + /* seek and rewrite the header */ header = gst_avimux_riff_get_avi_header (avimux); event = gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, 0); |