diff --git a/ChangeLog b/ChangeLog index 6bc2177d9a..679d6faad4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-03-28 Benjamin Otte + + * 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 * gst/mpegstream/gstmpegdemux.c: diff --git a/gst/mpegstream/gstdvddemux.c b/gst/mpegstream/gstdvddemux.c index 7c5074db11..98926e3951 100644 --- a/gst/mpegstream/gstdvddemux.c +++ b/gst/mpegstream/gstdvddemux.c @@ -636,52 +636,44 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux, case 0: /* Private stream 1. */ - switch (ps_id_code) { - case 0x80...0x87: - GST_LOG_OBJECT (dvd_demux, - "we have an audio (AC3) packet, track %d", ps_id_code - 0x80); - outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux, - ps_id_code - 0x80, GST_DVD_DEMUX_AUDIO_AC3, NULL); + if (ps_id_code >= 0x80 && ps_id_code <= 0x87) { + GST_LOG_OBJECT (dvd_demux, + "we have an audio (AC3) packet, track %d", ps_id_code - 0x80); + outstream = DEMUX_CLASS (dvd_demux)->get_audio_stream (mpeg_demux, + ps_id_code - 0x80, GST_DVD_DEMUX_AUDIO_AC3, NULL); - /* Determine the position of the "first access". This - should always be the beginning of an AC3 frame. */ - first_access = *(basebuf + headerlen + 6) * 256 + - *(basebuf + headerlen + 7); + /* Determine the position of the "first access". This + should always be the beginning of an AC3 frame. */ + first_access = *(basebuf + headerlen + 6) * 256 + + *(basebuf + headerlen + 7); - headerlen += 4; - datalen -= 4; - break; + headerlen += 4; + datalen -= 4; + } 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: - 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); + /* Determine the position of the "first access". */ + first_access = *(basebuf + headerlen + 6) * 256 + + *(basebuf + headerlen + 7); - /* Determine the position of the "first access". */ - first_access = *(basebuf + headerlen + 6) * 256 + - *(basebuf + headerlen + 7); + /* Get rid of the LPCM header. */ + 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 += 7; - datalen -= 7; - break; - - 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; + headerlen += 1; + datalen -= 1; + } else { + GST_ERROR_OBJECT (dvd_demux, + "unknown DVD (private 1) id 0x%02x", ps_id_code); } break; diff --git a/gst/mpegstream/gstmpegdemux.c b/gst/mpegstream/gstmpegdemux.c index 0c612b1028..b63d7cd89a 100644 --- a/gst/mpegstream/gstmpegdemux.c +++ b/gst/mpegstream/gstmpegdemux.c @@ -551,38 +551,26 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse, GstBuffer * buffer) buf_byte_size_bound = STD_buffer_size_bound * 1024; } - switch (stream_id) { - case 0xBD: - /* Private stream 1. */ - outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux, - 0, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL); - break; + if (stream_id == 0xBD) { + /* Private stream 1. */ + outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux, + 0, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL); + } else if (stream_id == 0xBF) { + /* 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: - /* Private stream 2. */ - outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux, - 1, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL); - 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; + outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux, + stream_id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version); + } else { + GST_WARNING_OBJECT (mpeg_demux, "unkown stream id 0x%02x", stream_id); } GST_DEBUG_OBJECT (mpeg_demux, "STD_buffer_bound_scale %d", @@ -736,46 +724,35 @@ done: timestamp = GST_CLOCK_TIME_NONE; } - switch (id) { - case 0xBD: - /* Private stream 1. */ - GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet"); - CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp, - headerlen, datalen); - break; + if (id == 0xBD) { + /* Private stream 1. */ + GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet"); + CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp, + headerlen, datalen); + } else if (id == 0xBF) { + /* 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: - /* 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; + GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet"); - case 0xC0...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); - 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; + 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); + } else { + GST_WARNING_OBJECT (mpeg_demux, "unkown stream id 0x%02x", id); } 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", headerlen, datalen); - switch (id) { - case 0xBD: - /* Private stream 1. */ - GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet"); - CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp, - headerlen, datalen); - break; + if (id == 0xBD) { + /* Private stream 1. */ + GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet"); + CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp, + headerlen, datalen); + } else if (id == 0xBF) { + /* 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: - /* 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; + GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet"); - case 0xC0...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); - 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; + 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); + } else { + GST_WARNING_OBJECT (mpeg_demux, "unkown stream id 0x%02x", id); } return TRUE;