From: <rb...@fr...> - 2004-10-09 19:33:36
|
CVS Root: /home/cvs/gstreamer Module: gst-plugins Changes by: rbultje Date: Sat Oct 09 2004 12:33:33 PDT Log message: * gst/avi/gstavidemux.c: (gst_avi_demux_massage_index): OK, so the original code was too strict. It makes random AVI files hang for seconds upon opening, which is unacceptable and is far beyond the original goal of getting multiple chunks for one-chunk sounc stream files. So now do just that. Modified files: . : ChangeLog gst/avi : gstavidemux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.1149&r2=1.1150 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/avi/gstavidemux.c.diff?r1=1.120&r2=1.121 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.1149 retrieving revision 1.1150 diff -u -d -r1.1149 -r1.1150 --- ChangeLog 9 Oct 2004 13:50:33 -0000 1.1149 +++ ChangeLog 9 Oct 2004 19:33:21 -0000 1.1150 @@ -1,5 +1,13 @@ 2004-10-09 Ronald S. Bultje <rb...@ro...> + * gst/avi/gstavidemux.c: (gst_avi_demux_massage_index): + OK, so the original code was too strict. It makes random AVI files + hang for seconds upon opening, which is unacceptable and is far + beyond the original goal of getting multiple chunks for one-chunk + sounc stream files. So now do just that. + +2004-10-09 Ronald S. Bultje <rb...@ro...> * gst/playback/gstplaybasebin.c: (setup_source), (gst_play_base_bin_change_state): Actually clean up streaminfo if output fails. This would trigger Index: gstavidemux.c RCS file: /home/cvs/gstreamer/gst-plugins/gst/avi/gstavidemux.c,v retrieving revision 1.120 retrieving revision 1.121 diff -u -d -r1.120 -r1.121 --- gstavidemux.c 5 Oct 2004 15:28:08 -0000 1.120 +++ gstavidemux.c 9 Oct 2004 19:33:21 -0000 1.121 @@ -1380,65 +1380,70 @@ GST_LOG ("I'm now going to cut large chunks into smaller pieces"); /* cut chunks in small (seekable) pieces */ - for (one = list; one != NULL; one = one->next) { - entry = one->data; - - if (entry->stream_nr >= avi->num_streams) + for (i = 0; i < avi->num_streams; i++) { + if (avi->stream[i].total_frames != 1) continue; -#define MAX_DURATION (GST_SECOND / 2) + for (one = list; one != NULL; one = one->next) { + entry = one->data; - /* check for max duration of a single buffer. I suppose that - * the allocation of index entries could be improved. */ - stream = &avi->stream[entry->stream_nr]; - if (entry->dur > MAX_DURATION && stream->strh->type == GST_RIFF_FCC_auds) { - guint32 ideal_size = stream->bitrate / 10; - gst_avi_index_entry *entries; - gint old_size, num_added; - GList *one2; + if (entry->stream_nr != i) + continue; - /* copy index */ - old_size = entry->size; - num_added = (entry->size - 1) / ideal_size; - avi->index_size += num_added; - entries = g_malloc (sizeof (gst_avi_index_entry) * num_added); - alloc_list = g_list_prepend (alloc_list, entries); - for (one2 = one->next; one2 != NULL; one2 = one2->next) { - gst_avi_index_entry *entry2 = one2->data; +#define MAX_DURATION (GST_SECOND / 2) - entry2->index_nr += num_added; - if (entry2->stream_nr == entry->stream_nr) - entry2->frames_before += num_added; - } + /* check for max duration of a single buffer. I suppose that + * the allocation of index entries could be improved. */ + stream = &avi->stream[entry->stream_nr]; + if (entry->dur > MAX_DURATION && stream->strh->type == GST_RIFF_FCC_auds) { + guint32 ideal_size = stream->bitrate / 10; + gst_avi_index_entry *entries; + gint old_size, num_added; + GList *one2; - /* new sized index chunks */ - for (i = 0; i < num_added + 1; i++) { - gst_avi_index_entry *entry2; + /* copy index */ + old_size = entry->size; + num_added = (entry->size - 1) / ideal_size; + avi->index_size += num_added; + entries = g_malloc (sizeof (gst_avi_index_entry) * num_added); + alloc_list = g_list_prepend (alloc_list, entries); + for (one2 = one->next; one2 != NULL; one2 = one2->next) { + gst_avi_index_entry *entry2 = one2->data; - if (i == 0) { - entry2 = entry; - } else { - entry2 = &entries[i - 1]; - list = g_list_insert_before (list, one->next, entry2); - entry = one->data; - one = one->next; - memcpy (entry2, entry, sizeof (gst_avi_index_entry)); + entry2->index_nr += num_added; + if (entry2->stream_nr == entry->stream_nr) + entry2->frames_before += num_added; } - if (old_size >= ideal_size) { - entry2->size = ideal_size; - old_size -= ideal_size; - entry2->size = old_size; - } + /* new sized index chunks */ + for (i = 0; i < num_added + 1; i++) { + gst_avi_index_entry *entry2; - entry2->dur = GST_SECOND * entry2->size / stream->bitrate; - if (i != 0) { - entry2->index_nr++; - entry2->ts += entry->dur; - entry2->offset += entry->size; - entry2->bytes_before += entry->size; - entry2->frames_before++; + if (i == 0) { + entry2 = entry; + } else { + entry2 = &entries[i - 1]; + list = g_list_insert_before (list, one->next, entry2); + entry = one->data; + one = one->next; + memcpy (entry2, entry, sizeof (gst_avi_index_entry)); + } + if (old_size >= ideal_size) { + entry2->size = ideal_size; + old_size -= ideal_size; + entry2->size = old_size; + entry2->dur = GST_SECOND * entry2->size / stream->bitrate; + if (i != 0) { + entry2->index_nr++; + entry2->ts += entry->dur; + entry2->offset += entry->size; + entry2->bytes_before += entry->size; + entry2->frames_before++; } } |