From: <rb...@fr...> - 2004-11-28 21:18:03
|
CVS Root: /cvs/gstreamer Module: gst-plugins Changes by: rbultje Date: Sun Nov 28 2004 13:18:30 PST Log message: * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private): * gst/mpegstream/gstdvddemux.h: Fix crash (#159759). Doesn't work, though. :-(. Modified files: . : ChangeLog gst/mpegstream : gstdvddemux.c gstdvddemux.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.1342&r2=1.1343 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/mpegstream/gstdvddemux.c.diff?r1=1.11&r2=1.12 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/mpegstream/gstdvddemux.h.diff?r1=1.3&r2=1.4 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.1342 retrieving revision 1.1343 diff -u -d -r1.1342 -r1.1343 --- ChangeLog 28 Nov 2004 20:41:23 -0000 1.1342 +++ ChangeLog 28 Nov 2004 21:18:18 -0000 1.1343 @@ -1,3 +1,10 @@ +2004-11-28 Ronald S. Bultje <rb...@ro...> + + * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_audio_stream), + (gst_dvd_demux_process_private): + * gst/mpegstream/gstdvddemux.h: + Fix crash (#159759). Doesn't work, though. :-(. 2004-11-28 Benjamin Otte <ot...@gn...> * gst/audioconvert/gstchannelmix.c: (gst_audio_convert_mix): Index: gstdvddemux.c RCS file: /cvs/gstreamer/gst-plugins/gst/mpegstream/gstdvddemux.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- gstdvddemux.c 9 Nov 2004 06:08:22 -0000 1.11 +++ gstdvddemux.c 28 Nov 2004 21:18:18 -0000 1.12 @@ -596,6 +596,9 @@ lpcm_str->sample_info = sample_info; + lpcm_str->width = width; + lpcm_str->rate = rate; + lpcm_str->channels = channels; break; case GST_DVD_DEMUX_AUDIO_AC3: @@ -690,6 +693,7 @@ guint8 ps_id_code, lpcm_sample_info; GstMPEGStream *outstream = NULL; guint first_access = 0; + gint align = 1, len, off; basebuf = GST_BUFFER_DATA (buffer); @@ -718,11 +722,14 @@ headerlen += 4; datalen -= 4; } else if (ps_id_code >= 0xA0 && ps_id_code <= 0xA7) { + GstDVDLPCMStream *lpcm_str; GST_LOG_OBJECT (dvd_demux, "we have an audio (LPCM) packet, track %d", ps_id_code - 0xA0); lpcm_sample_info = basebuf[headerlen + 9]; outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux, ps_id_code - 0xA0, GST_DVD_DEMUX_AUDIO_LPCM, &lpcm_sample_info); + lpcm_str = (GstDVDLPCMStream *) outstream; /* Determine the position of the "first access". */ first_access = *(basebuf + headerlen + 6) * 256 + @@ -731,6 +738,9 @@ /* Get rid of the LPCM header. */ headerlen += 7; datalen -= 7; + /* align by samples */ + align = lpcm_str->width * lpcm_str->channels / 8; } else if (ps_id_code >= 0x20 && ps_id_code <= 0x3F) { "we have a subpicture packet, track %d", ps_id_code - 0x20); @@ -784,14 +794,29 @@ a means to associate a timestamp to the middle of a buffer, we send two separate buffers and put the timestamp in the second one. */ - DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream, - buffer, GST_CLOCK_TIME_NONE, headerlen + 4, first_access - 1); - buffer, timestamp, - headerlen + 3 + first_access, datalen - (first_access - 1)); + off = headerlen + 4; + len = first_access - 1; + len -= len % align; + if (len > 0) { + DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream, + buffer, GST_CLOCK_TIME_NONE, headerlen + 4, first_access - 1); + } + off += len; + len = datalen - len; + buffer, timestamp, + headerlen + 3 + first_access, datalen - (first_access - 1)); } else { - buffer, timestamp, headerlen + 4, datalen); + len = datalen; + buffer, timestamp, headerlen + 4, datalen); } } Index: gstdvddemux.h RCS file: /cvs/gstreamer/gst-plugins/gst/mpegstream/gstdvddemux.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstdvddemux.h 28 Jul 2004 13:47:59 -0000 1.3 +++ gstdvddemux.h 28 Nov 2004 21:18:18 -0000 1.4 @@ -86,6 +86,7 @@ values are bit fields with the same format of the sample_info field in the linear PCM header. */ + gint rate, channels, width; }; |