diff options
Diffstat (limited to 'src/demuxers/demux_4xm.c')
-rw-r--r-- | src/demuxers/demux_4xm.c | 104 |
1 files changed, 31 insertions, 73 deletions
diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index 56360542c..6256cb042 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.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 */ /* * 4X Technologies (.4xm) File Demuxer by Mike Melanson (melanson@pcisys.net) * For more information on the 4xm file format, visit: * http://www.pcisys.net/~melanson/codecs/ - * - * $Id: demux_4xm.c,v 1.16 2007/01/19 00:26:39 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -42,10 +40,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" @@ -144,8 +142,8 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { return 0; /* check for the signature tags */ - if ((LE_32(&preview[0]) != RIFF_TAG) || - (LE_32(&preview[8]) != _4XMV_TAG)) + if ((_X_LE_32(&preview[0]) != RIFF_TAG) || + (_X_LE_32(&preview[8]) != _4XMV_TAG)) return 0; /* file is qualified; skip over the header bytes in the stream */ @@ -154,12 +152,12 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { /* fetch the LIST-HEAD header */ if (fourxm->input->read(fourxm->input, preview, 12) != 12) return 0; - if ((LE_32(&preview[0]) != LIST_TAG) || - (LE_32(&preview[8]) != HEAD_TAG)) + if ((_X_LE_32(&preview[0]) != LIST_TAG) || + (_X_LE_32(&preview[8]) != HEAD_TAG)) return 0; /* read the whole header */ - header_size = LE_32(&preview[4]) - 4; + header_size = _X_LE_32(&preview[4]) - 4; header = xine_xmalloc(header_size); if (fourxm->input->read(fourxm->input, header, header_size) != header_size) { free(header); @@ -174,8 +172,8 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { /* take the lazy approach and search for any and all vtrk and strk chunks */ for (i = 0; i < header_size - 8; i++) { - fourcc_tag = LE_32(&header[i]); - size = LE_32(&header[i + 4]); + fourcc_tag = _X_LE_32(&header[i]); + size = _X_LE_32(&header[i + 4]); if (fourcc_tag == std__TAG) { fps = get_le_float(&header[i + 12]); @@ -186,13 +184,13 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { free(header); return 0; } - total_frames = LE_32(&header[i + 24]); + total_frames = _X_LE_32(&header[i + 24]); fourxm->duration_in_ms = total_frames; fourxm->duration_in_ms *= fourxm->video_pts_inc; fourxm->duration_in_ms /= 90000; fourxm->duration_in_ms *= 1000; - fourxm->bih.biWidth = LE_32(&header[i + 36]); - fourxm->bih.biHeight = LE_32(&header[i + 40]); + fourxm->bih.biWidth = _X_LE_32(&header[i + 36]); + fourxm->bih.biHeight = _X_LE_32(&header[i + 40]); i += 8 + size; } else if (fourcc_tag == strk_TAG) { /* check that there is enough data */ @@ -200,7 +198,7 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { free(header); return 0; } - current_track = LE_32(&header[i + 8]); + current_track = _X_LE_32(&header[i + 8]); if (current_track + 1 > fourxm->track_count) { fourxm->track_count = current_track + 1; fourxm->tracks = realloc(fourxm->tracks, @@ -211,10 +209,10 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { } } - fourxm->tracks[current_track].channels = LE_32(&header[i + 36]); - fourxm->tracks[current_track].sample_rate = LE_32(&header[i + 40]); - fourxm->tracks[current_track].bits = LE_32(&header[i + 44]); - audio_type = LE_32(&header[i + 12]); + fourxm->tracks[current_track].channels = _X_LE_32(&header[i + 36]); + fourxm->tracks[current_track].sample_rate = _X_LE_32(&header[i + 40]); + fourxm->tracks[current_track].bits = _X_LE_32(&header[i + 44]); + audio_type = _X_LE_32(&header[i + 12]); if (audio_type == 0) fourxm->tracks[current_track].audio_type = BUF_AUDIO_LPCM_LE; else if (audio_type == 1) @@ -253,8 +251,8 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { return this->status; } - fourcc_tag = LE_32(&header[0]); - size = LE_32(&header[4]); + fourcc_tag = _X_LE_32(&header[0]); + size = _X_LE_32(&header[4]); switch (fourcc_tag) { @@ -314,8 +312,8 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - current_track = LE_32(&header[0]); -// size = LE_32(&header[4]); + current_track = _X_LE_32(&header[0]); +// size = _X_LE_32(&header[4]); if (current_track >= this->track_count) { lprintf ("bad audio track number (%d >= %d)\n", @@ -441,12 +439,6 @@ static int demux_fourxm_seek (demux_plugin_t *this_gen, return this->status; } -static void demux_fourxm_dispose (demux_plugin_t *this_gen) { - demux_fourxm_t *this = (demux_fourxm_t *) this_gen; - - free(this->tracks); -} - static int demux_fourxm_get_status (demux_plugin_t *this_gen) { demux_fourxm_t *this = (demux_fourxm_t *) this_gen; @@ -481,7 +473,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.send_headers = demux_fourxm_send_headers; this->demux_plugin.send_chunk = demux_fourxm_send_chunk; this->demux_plugin.seek = demux_fourxm_seek; - this->demux_plugin.dispose = demux_fourxm_dispose; + this->demux_plugin.dispose = default_demux_plugin_dispose; this->demux_plugin.get_status = demux_fourxm_get_status; this->demux_plugin.get_stream_length = demux_fourxm_get_stream_length; this->demux_plugin.get_capabilities = demux_fourxm_get_capabilities; @@ -492,19 +484,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: @@ -523,39 +503,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 "4X Technologies (4xm) demux plugin"; -} - -static const char *get_identifier (demux_class_t *this_gen) { - return "4X Technologies"; -} - -static const char *get_extensions (demux_class_t *this_gen) { - return "4xm"; -} - -static const char *get_mimetypes (demux_class_t *this_gen) { - return NULL; -} - -static void class_dispose (demux_class_t *this_gen) { - demux_fourxm_class_t *this = (demux_fourxm_class_t *) this_gen; - - free (this); -} - void *demux_fourxm_init_plugin (xine_t *xine, void *data) { demux_fourxm_class_t *this; this = xine_xmalloc (sizeof (demux_fourxm_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_("4X Technologies (4xm) demux plugin"); + this->demux_class.identifier = "4X Technologies"; + this->demux_class.mimetypes = NULL; + this->demux_class.extensions = "4xm"; + this->demux_class.dispose = default_demux_class_dispose; return this; } |