diff options
Diffstat (limited to 'src/demuxers/demux_vmd.c')
-rw-r--r-- | src/demuxers/demux_vmd.c | 84 |
1 files changed, 21 insertions, 63 deletions
diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index e2b68fbb1..c2902eac1 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -15,7 +15,7 @@ * * 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 */ /* @@ -27,8 +27,6 @@ * Note that the only way that this demuxer validates by content is by * checking the first 2 bytes, which are 0x2E 0x03 in a Sierra VMD file. * There is a 1/65536 chance of a false positive using this method. - * - * $Id: demux_vmd.c,v 1.4 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -47,10 +45,10 @@ #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" @@ -115,7 +113,7 @@ static int open_vmd_file(demux_vmd_t *this) { VMD_HEADER_SIZE) return 0; - if (LE_16(&vmd_header[0]) != VMD_HEADER_SIZE - 2) + if (_X_LE_16(&vmd_header[0]) != VMD_HEADER_SIZE - 2) return 0; /* file is minimally qualified at this point, proceed to load */ @@ -125,11 +123,11 @@ static int open_vmd_file(demux_vmd_t *this) { this->data_size = 1; bih->biSize = sizeof(xine_bmiheader) + VMD_HEADER_SIZE; - bih->biWidth = LE_16(&vmd_header[12]); - bih->biHeight = LE_16(&vmd_header[14]); - this->wave.nSamplesPerSec = LE_16(&vmd_header[804]); + bih->biWidth = _X_LE_16(&vmd_header[12]); + bih->biHeight = _X_LE_16(&vmd_header[14]); + this->wave.nSamplesPerSec = _X_LE_16(&vmd_header[804]); this->wave.nChannels = (vmd_header[811] & 0x80) ? 2 : 1; - this->wave.nBlockAlign = LE_16(&vmd_header[806]); + this->wave.nBlockAlign = _X_LE_16(&vmd_header[806]); if (this->wave.nBlockAlign & 0x8000) { this->wave.nBlockAlign -= 0x8000; this->wave.wBitsPerSample = 16; @@ -149,8 +147,8 @@ static int open_vmd_file(demux_vmd_t *this) { /* skip over the offset table and load the table of contents; don't * care about the offset table since demuxer will calculate those * independently */ - toc_offset = LE_32(&vmd_header[812]); - this->frame_count = LE_16(&vmd_header[6]); + toc_offset = _X_LE_32(&vmd_header[812]); + this->frame_count = _X_LE_16(&vmd_header[6]); this->input->seek(this->input, toc_offset + this->frame_count * 6, SEEK_SET); /* while we have the toal number of blocks, calculate the total running @@ -172,7 +170,7 @@ static int open_vmd_file(demux_vmd_t *this) { this->frame_table = xine_xmalloc(this->frame_count * sizeof(vmd_frame_t)); - current_offset = this->data_start = LE_32(&vmd_header[20]); + current_offset = this->data_start = _X_LE_32(&vmd_header[20]); this->data_size = toc_offset - this->data_start; current_frame_record = raw_frame_table; total_frames = this->frame_count; @@ -180,7 +178,7 @@ static int open_vmd_file(demux_vmd_t *this) { while (total_frames--) { /* if the frame size is 0, do not count the frame and bring the * total frame count down */ - this->frame_table[i].frame_size = LE_32(¤t_frame_record[2]); + this->frame_table[i].frame_size = _X_LE_32(¤t_frame_record[2]); /* this logic is present so that 0-length audio chunks are not * accounted */ @@ -391,12 +389,6 @@ static int demux_vmd_seek (demux_plugin_t *this_gen, return this->status; } -static void demux_vmd_dispose (demux_plugin_t *this_gen) { - demux_vmd_t *this = (demux_vmd_t *) this_gen; - - free(this); -} - static int demux_vmd_get_status (demux_plugin_t *this_gen) { demux_vmd_t *this = (demux_vmd_t *) this_gen; @@ -430,7 +422,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.send_headers = demux_vmd_send_headers; this->demux_plugin.send_chunk = demux_vmd_send_chunk; this->demux_plugin.seek = demux_vmd_seek; - this->demux_plugin.dispose = demux_vmd_dispose; + this->demux_plugin.dispose = default_demux_plugin_dispose; this->demux_plugin.get_status = demux_vmd_get_status; this->demux_plugin.get_stream_length = demux_vmd_get_stream_length; this->demux_plugin.get_capabilities = demux_vmd_get_capabilities; @@ -441,19 +433,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: @@ -472,39 +452,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 "Sierra VMD file demux plugin"; -} - -static const char *get_identifier (demux_class_t *this_gen) { - return "VMD"; -} - -static const char *get_extensions (demux_class_t *this_gen) { - return "vmd"; -} - -static const char *get_mimetypes (demux_class_t *this_gen) { - return NULL; -} - -static void class_dispose (demux_class_t *this_gen) { - demux_vmd_class_t *this = (demux_vmd_class_t *) this_gen; - - free (this); -} - void *demux_vmd_init_plugin (xine_t *xine, void *data) { demux_vmd_class_t *this; this = xine_xmalloc (sizeof (demux_vmd_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_("Sierra VMD file demux plugin"); + this->demux_class.identifier = "VMD"; + this->demux_class.mimetypes = NULL; + this->demux_class.extensions = "vmd"; + this->demux_class.dispose = default_demux_class_dispose; return this; } |