gst/mpegstream/: get rid of non-standard "..." ranges in case statements.

Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_private):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(gst_mpeg_demux_parse_packet), (gst_mpeg_demux_parse_pes):
get rid of non-standard "..." ranges in case statements.
This commit is contained in:
Benjamin Otte 2004-03-28 01:44:31 +00:00
parent 40b740126e
commit a6b45475b2
3 changed files with 113 additions and 148 deletions

View file

@ -1,3 +1,10 @@
2004-03-28 Benjamin Otte <otte@gnome.org>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_private):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(gst_mpeg_demux_parse_packet), (gst_mpeg_demux_parse_pes):
get rid of non-standard "..." ranges in case statements.
2004-03-27 Martin Soto <martinsoto@users.sourceforge.net> 2004-03-27 Martin Soto <martinsoto@users.sourceforge.net>
* gst/mpegstream/gstmpegdemux.c: * gst/mpegstream/gstmpegdemux.c:

View file

@ -636,52 +636,44 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
case 0: case 0:
/* Private stream 1. */ /* Private stream 1. */
switch (ps_id_code) { if (ps_id_code >= 0x80 && ps_id_code <= 0x87) {
case 0x80...0x87: GST_LOG_OBJECT (dvd_demux,
GST_LOG_OBJECT (dvd_demux, "we have an audio (AC3) packet, track %d", ps_id_code - 0x80);
"we have an audio (AC3) packet, track %d", ps_id_code - 0x80); outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux,
outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux, ps_id_code - 0x80, GST_DVD_DEMUX_AUDIO_AC3, NULL);
ps_id_code - 0x80, GST_DVD_DEMUX_AUDIO_AC3, NULL);
/* Determine the position of the "first access". This /* Determine the position of the "first access". This
should always be the beginning of an AC3 frame. */ should always be the beginning of an AC3 frame. */
first_access = *(basebuf + headerlen + 6) * 256 + first_access = *(basebuf + headerlen + 6) * 256 +
*(basebuf + headerlen + 7); *(basebuf + headerlen + 7);
headerlen += 4; headerlen += 4;
datalen -= 4; datalen -= 4;
break; } else if (ps_id_code >= 0xA0 && ps_id_code <= 0xA7) {
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);
case 0xA0...0xA7: /* Determine the position of the "first access". */
GST_LOG_OBJECT (dvd_demux, first_access = *(basebuf + headerlen + 6) * 256 +
"we have an audio (LPCM) packet, track %d", ps_id_code - 0xA0); *(basebuf + headerlen + 7);
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);
/* Determine the position of the "first access". */ /* Get rid of the LPCM header. */
first_access = *(basebuf + headerlen + 6) * 256 + headerlen += 7;
*(basebuf + headerlen + 7); datalen -= 7;
} else if (ps_id_code >= 0x20 && ps_id_code <= 0x3F) {
GST_LOG_OBJECT (dvd_demux,
"we have a subpicture packet, track %d", ps_id_code - 0x20);
outstream = CLASS (dvd_demux)->get_subpicture_stream (mpeg_demux,
ps_id_code - 0x20, GST_DVD_DEMUX_SUBP_DVD, NULL);
/* Get rid of the LPCM header. */ headerlen += 1;
headerlen += 7; datalen -= 1;
datalen -= 7; } else {
break; GST_ERROR_OBJECT (dvd_demux,
"unknown DVD (private 1) id 0x%02x", ps_id_code);
case 0x20...0x3f:
GST_LOG_OBJECT (dvd_demux,
"we have a subpicture packet, track %d", ps_id_code - 0x20);
outstream = CLASS (dvd_demux)->get_subpicture_stream (mpeg_demux,
ps_id_code - 0x20, GST_DVD_DEMUX_SUBP_DVD, NULL);
headerlen += 1;
datalen -= 1;
break;
default:
GST_ERROR_OBJECT (dvd_demux,
"unknown DVD (private 1) id 0x%02x", ps_id_code);
break;
} }
break; break;

View file

@ -551,38 +551,26 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
buf_byte_size_bound = STD_buffer_size_bound * 1024; buf_byte_size_bound = STD_buffer_size_bound * 1024;
} }
switch (stream_id) { if (stream_id == 0xBD) {
case 0xBD: /* Private stream 1. */
/* Private stream 1. */ outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux, 0, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
0, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL); } else if (stream_id == 0xBF) {
break; /* Private stream 2. */
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
1, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
} else if (stream_id >= 0xC0 && stream_id <= 0xDF) {
/* Audio. */
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
stream_id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
} else if (stream_id >= 0xE0 && stream_id <= 0xEF) {
/* Video. */
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
case 0xBF: outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
/* Private stream 2. */ stream_id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux, } else {
1, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL); GST_WARNING_OBJECT (mpeg_demux, "unkown stream id 0x%02x", stream_id);
break;
case 0xC0...0xDF:
/* Audio. */
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
stream_id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
break;
case 0xE0...0xEF:
/* Video. */
{
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
stream_id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
}
break;
default:
GST_WARNING ("unkown stream id 0x%02x", stream_id);
break;
} }
GST_DEBUG_OBJECT (mpeg_demux, "STD_buffer_bound_scale %d", GST_DEBUG_OBJECT (mpeg_demux, "STD_buffer_bound_scale %d",
@ -736,46 +724,35 @@ done:
timestamp = GST_CLOCK_TIME_NONE; timestamp = GST_CLOCK_TIME_NONE;
} }
switch (id) { if (id == 0xBD) {
case 0xBD: /* Private stream 1. */
/* Private stream 1. */ GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet");
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet"); CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp,
CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp, headerlen, datalen);
headerlen, datalen); } else if (id == 0xBF) {
break; /* Private stream 2. */
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 2 packet");
CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 1, timestamp,
headerlen, datalen);
} else if (id >= 0xC0 && id <= 0xDF) {
/* Audio. */
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
timestamp, headerlen + 4, datalen);
} else if (id >= 0xE0 && id <= 0xEF) {
/* Video. */
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
case 0xBF: GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet");
/* Private stream 2. */
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 2 packet");
CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 1, timestamp,
headerlen, datalen);
break;
case 0xC0...0xDF: outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
/* Audio. */ id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet"); CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux, timestamp, headerlen + 4, datalen);
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL); } else {
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer, GST_WARNING_OBJECT (mpeg_demux, "unkown stream id 0x%02x", id);
timestamp, headerlen + 4, datalen);
break;
case 0xE0...0xEF:
/* Video. */
GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet");
{
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
}
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
timestamp, headerlen + 4, datalen);
break;
default:
GST_WARNING ("unkown stream id 0x%02x", id);
break;
} }
return TRUE; return TRUE;
@ -876,46 +853,35 @@ gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
GST_DEBUG_OBJECT (mpeg_demux, "headerlen is %d, datalen is %d", GST_DEBUG_OBJECT (mpeg_demux, "headerlen is %d, datalen is %d",
headerlen, datalen); headerlen, datalen);
switch (id) { if (id == 0xBD) {
case 0xBD: /* Private stream 1. */
/* Private stream 1. */ GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet");
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet"); CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp,
CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp, headerlen, datalen);
headerlen, datalen); } else if (id == 0xBF) {
break; /* Private stream 2. */
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 2 packet");
CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 1, timestamp,
headerlen, datalen);
} else if (id >= 0xC0 && id <= 0xDF) {
/* Audio. */
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
timestamp, headerlen + 4, datalen);
} else if (id >= 0xE0 && id <= 0xEF) {
/* Video. */
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
case 0xBF: GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet");
/* Private stream 2. */
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 2 packet");
CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 1, timestamp,
headerlen, datalen);
break;
case 0xC0...0xDF: outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
/* Audio. */ id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet"); CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux, timestamp, headerlen + 4, datalen);
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL); } else {
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer, GST_WARNING_OBJECT (mpeg_demux, "unkown stream id 0x%02x", id);
timestamp, headerlen + 4, datalen);
break;
case 0xE0...0xEF:
/* Video. */
GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet");
{
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
}
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
timestamp, headerlen + 4, datalen);
break;
default:
GST_WARNING ("unkown stream id 0x%02x", id);
break;
} }
return TRUE; return TRUE;