diff options
Diffstat (limited to 'src/demuxers/demux_smjpeg.c')
-rw-r--r-- | src/demuxers/demux_smjpeg.c | 86 |
1 files changed, 22 insertions, 64 deletions
diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index 9c86314c5..10cdf8120 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -15,15 +15,13 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ /* * SMJPEG File Demuxer by Mike Melanson (melanson@pcisys.net) * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 - * - * $Id: demux_smjpeg.c,v 1.51 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -41,10 +39,10 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" @@ -119,7 +117,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { this->input->seek(this->input, SMJPEG_SIGNATURE_SIZE + 4, SEEK_SET); if (this->input->read(this->input, header_chunk, 4) != 4) return 0; - this->duration = BE_32(&header_chunk[0]); + this->duration = _X_BE_32(&header_chunk[0]); /* initial state: no video and no audio (until headers found) */ this->video_type = this->audio_type = 0; @@ -131,7 +129,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { if (this->input->read(this->input, header_chunk, 4) != 4) return 0; - chunk_tag = BE_32(&header_chunk[0]); + chunk_tag = _X_BE_32(&header_chunk[0]); switch(chunk_tag) { @@ -145,8 +143,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { SMJPEG_VIDEO_HEADER_SIZE) != SMJPEG_VIDEO_HEADER_SIZE) return 0; - this->bih.biWidth = BE_16(&header_chunk[8]); - this->bih.biHeight = BE_16(&header_chunk[10]); + this->bih.biWidth = _X_BE_16(&header_chunk[8]); + this->bih.biHeight = _X_BE_16(&header_chunk[10]); this->bih.biCompression = *(uint32_t *)&header_chunk[12]; this->video_type = _x_fourcc_to_buf_video(this->bih.biCompression); break; @@ -156,13 +154,13 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { SMJPEG_AUDIO_HEADER_SIZE) != SMJPEG_AUDIO_HEADER_SIZE) return 0; - this->audio_sample_rate = BE_16(&header_chunk[4]); + this->audio_sample_rate = _X_BE_16(&header_chunk[4]); this->audio_bits = header_chunk[6]; this->audio_channels = header_chunk[7]; /* ADPCM in these files is ID'd by 'APCM' which is used in other * files to denote a slightly different format; thus, use the * following special case */ - if (BE_32(&header_chunk[8]) == APCM_TAG) { + if (_X_BE_32(&header_chunk[8]) == APCM_TAG) { audio_codec = be2me_32(APCM_TAG); this->audio_type = BUF_AUDIO_SMJPEG_IMA; } else { @@ -176,7 +174,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { * of the chunk */ if (this->input->read(this->input, header_chunk, 4) != 4) return 0; - this->input->seek(this->input, BE_32(&header_chunk[0]), SEEK_CUR); + this->input->seek(this->input, _X_BE_32(&header_chunk[0]), SEEK_CUR); break; } } @@ -210,8 +208,8 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) { return this->status; /* skip to next while() iteration to bail out */ } - chunk_tag = BE_32(&preamble[0]); - remaining_sample_bytes = BE_32(&preamble[8]); + chunk_tag = _X_BE_32(&preamble[0]); + remaining_sample_bytes = _X_BE_32(&preamble[8]); /* * Each sample has an absolute timestamp in millisecond units: @@ -238,7 +236,7 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) { pts /= (this->audio_sample_rate * this->audio_channels); audio_frame_count += ((remaining_sample_bytes - 4) * 2); } else { - pts = BE_32(&preamble[4]); + pts = _X_BE_32(&preamble[4]); pts *= 90; } @@ -364,12 +362,6 @@ static int demux_smjpeg_seek (demux_plugin_t *this_gen, off_t start_pos, int sta } -static void demux_smjpeg_dispose (demux_plugin_t *this_gen) { - demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen; - - free(this); -} - static int demux_smjpeg_get_status (demux_plugin_t *this_gen) { demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen; @@ -409,7 +401,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.send_headers = demux_smjpeg_send_headers; this->demux_plugin.send_chunk = demux_smjpeg_send_chunk; this->demux_plugin.seek = demux_smjpeg_seek; - this->demux_plugin.dispose = demux_smjpeg_dispose; + this->demux_plugin.dispose = default_demux_plugin_dispose; this->demux_plugin.get_status = demux_smjpeg_get_status; this->demux_plugin.get_stream_length = demux_smjpeg_get_stream_length; this->demux_plugin.get_capabilities = demux_smjpeg_get_capabilities; @@ -420,19 +412,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { - case METHOD_BY_EXTENSION: { - const char *extensions, *mrl; - - mrl = input->get_mrl (input); - extensions = class_gen->get_extensions (class_gen); - - if (!_x_demux_check_extension (mrl, extensions)) { - free (this); - return NULL; - } - } - /* falling through is intended */ - + case METHOD_BY_MRL: case METHOD_BY_CONTENT: case METHOD_EXPLICIT: @@ -451,39 +431,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static const char *get_description (demux_class_t *this_gen) { - return "SMJPEG file demux plugin"; -} - -static const char *get_identifier (demux_class_t *this_gen) { - return "SMJPEG"; -} - -static const char *get_extensions (demux_class_t *this_gen) { - return "mjpg"; -} - -static const char *get_mimetypes (demux_class_t *this_gen) { - return NULL; -} - -static void class_dispose (demux_class_t *this_gen) { - demux_smjpeg_class_t *this = (demux_smjpeg_class_t *) this_gen; - - free (this); -} - void *demux_smjpeg_init_plugin (xine_t *xine, void *data) { demux_smjpeg_class_t *this; this = xine_xmalloc (sizeof (demux_smjpeg_class_t)); this->demux_class.open_plugin = open_plugin; - this->demux_class.get_description = get_description; - this->demux_class.get_identifier = get_identifier; - this->demux_class.get_mimetypes = get_mimetypes; - this->demux_class.get_extensions = get_extensions; - this->demux_class.dispose = class_dispose; + this->demux_class.description = N_("SMJPEG file demux plugin"); + this->demux_class.identifier = "SMJPEG"; + this->demux_class.mimetypes = NULL; + this->demux_class.extensions = "mjpg"; + this->demux_class.dispose = default_demux_class_dispose; return this; } |