mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
gst/mpegstream/gstdvddemux.*: Fix crash (#159759). Doesn't work, though. :-(.
Original commit message from CVS: * 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. :-(.
This commit is contained in:
parent
1857c455e2
commit
fb744af7a9
3 changed files with 40 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-11-28 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* 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 <otte@gnome.org>
|
2004-11-28 Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
* gst/audioconvert/gstchannelmix.c: (gst_audio_convert_mix):
|
* gst/audioconvert/gstchannelmix.c: (gst_audio_convert_mix):
|
||||||
|
|
|
@ -596,6 +596,9 @@ gst_dvd_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
|
||||||
|
|
||||||
|
|
||||||
lpcm_str->sample_info = sample_info;
|
lpcm_str->sample_info = sample_info;
|
||||||
|
lpcm_str->width = width;
|
||||||
|
lpcm_str->rate = rate;
|
||||||
|
lpcm_str->channels = channels;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_DVD_DEMUX_AUDIO_AC3:
|
case GST_DVD_DEMUX_AUDIO_AC3:
|
||||||
|
@ -690,6 +693,7 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
guint8 ps_id_code, lpcm_sample_info;
|
guint8 ps_id_code, lpcm_sample_info;
|
||||||
GstMPEGStream *outstream = NULL;
|
GstMPEGStream *outstream = NULL;
|
||||||
guint first_access = 0;
|
guint first_access = 0;
|
||||||
|
gint align = 1, len, off;
|
||||||
|
|
||||||
basebuf = GST_BUFFER_DATA (buffer);
|
basebuf = GST_BUFFER_DATA (buffer);
|
||||||
|
|
||||||
|
@ -718,11 +722,14 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
headerlen += 4;
|
headerlen += 4;
|
||||||
datalen -= 4;
|
datalen -= 4;
|
||||||
} else if (ps_id_code >= 0xA0 && ps_id_code <= 0xA7) {
|
} else if (ps_id_code >= 0xA0 && ps_id_code <= 0xA7) {
|
||||||
|
GstDVDLPCMStream *lpcm_str;
|
||||||
|
|
||||||
GST_LOG_OBJECT (dvd_demux,
|
GST_LOG_OBJECT (dvd_demux,
|
||||||
"we have an audio (LPCM) packet, track %d", ps_id_code - 0xA0);
|
"we have an audio (LPCM) packet, track %d", ps_id_code - 0xA0);
|
||||||
lpcm_sample_info = basebuf[headerlen + 9];
|
lpcm_sample_info = basebuf[headerlen + 9];
|
||||||
outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux,
|
outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux,
|
||||||
ps_id_code - 0xA0, GST_DVD_DEMUX_AUDIO_LPCM, &lpcm_sample_info);
|
ps_id_code - 0xA0, GST_DVD_DEMUX_AUDIO_LPCM, &lpcm_sample_info);
|
||||||
|
lpcm_str = (GstDVDLPCMStream *) outstream;
|
||||||
|
|
||||||
/* Determine the position of the "first access". */
|
/* Determine the position of the "first access". */
|
||||||
first_access = *(basebuf + headerlen + 6) * 256 +
|
first_access = *(basebuf + headerlen + 6) * 256 +
|
||||||
|
@ -731,6 +738,9 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
/* Get rid of the LPCM header. */
|
/* Get rid of the LPCM header. */
|
||||||
headerlen += 7;
|
headerlen += 7;
|
||||||
datalen -= 7;
|
datalen -= 7;
|
||||||
|
|
||||||
|
/* align by samples */
|
||||||
|
align = lpcm_str->width * lpcm_str->channels / 8;
|
||||||
} else if (ps_id_code >= 0x20 && ps_id_code <= 0x3F) {
|
} else if (ps_id_code >= 0x20 && ps_id_code <= 0x3F) {
|
||||||
GST_LOG_OBJECT (dvd_demux,
|
GST_LOG_OBJECT (dvd_demux,
|
||||||
"we have a subpicture packet, track %d", ps_id_code - 0x20);
|
"we have a subpicture packet, track %d", ps_id_code - 0x20);
|
||||||
|
@ -784,14 +794,29 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
a means to associate a timestamp to the middle of a buffer, we
|
a means to associate a timestamp to the middle of a buffer, we
|
||||||
send two separate buffers and put the timestamp in the second
|
send two separate buffers and put the timestamp in the second
|
||||||
one. */
|
one. */
|
||||||
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
off = headerlen + 4;
|
||||||
buffer, GST_CLOCK_TIME_NONE, headerlen + 4, first_access - 1);
|
len = first_access - 1;
|
||||||
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
len -= len % align;
|
||||||
buffer, timestamp,
|
if (len > 0) {
|
||||||
headerlen + 3 + first_access, datalen - (first_access - 1));
|
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
||||||
|
buffer, GST_CLOCK_TIME_NONE, headerlen + 4, first_access - 1);
|
||||||
|
}
|
||||||
|
off += len;
|
||||||
|
len = datalen - len;
|
||||||
|
len -= len % align;
|
||||||
|
if (len > 0) {
|
||||||
|
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
||||||
|
buffer, timestamp,
|
||||||
|
headerlen + 3 + first_access, datalen - (first_access - 1));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
off = headerlen + 4;
|
||||||
buffer, timestamp, headerlen + 4, datalen);
|
len = datalen;
|
||||||
|
len -= len % align;
|
||||||
|
if (len > 0) {
|
||||||
|
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
||||||
|
buffer, timestamp, headerlen + 4, datalen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ struct _GstDVDLPCMStream {
|
||||||
values are bit fields with the same
|
values are bit fields with the same
|
||||||
format of the sample_info field in
|
format of the sample_info field in
|
||||||
the linear PCM header. */
|
the linear PCM header. */
|
||||||
|
gint rate, channels, width;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue