summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_idcin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_idcin.c')
-rw-r--r--src/demuxers/demux_idcin.c83
1 files changed, 21 insertions, 62 deletions
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c
index 461771425..695470415 100644
--- a/src/demuxers/demux_idcin.c
+++ b/src/demuxers/demux_idcin.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
*/
/*
@@ -64,8 +64,6 @@
* - scan through all 768 palette bytes
* - if any bytes exceed 63, do not shift the bytes at all before
* transmitting them to the video decoder
- *
- * $Id: demux_idcin.c,v 1.55 2007/02/20 00:34:55 dgp85 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -85,10 +83,10 @@
* demuxer is dispatching to the engine */
/* #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"
@@ -130,7 +128,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) {
unsigned char disk_palette[PALETTE_SIZE * 3];
palette_entry_t palette[PALETTE_SIZE];
int i;
- unsigned int remaining_sample_bytes;
+ int remaining_sample_bytes;
int scale_bits;
/* figure out what the next data is */
@@ -191,7 +189,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) {
this->status = DEMUX_FINISHED;
return this->status;
}
- remaining_sample_bytes = LE_32(&preamble[0]) - 4;
+ remaining_sample_bytes = _X_LE_32(&preamble[0]) - 4;
lprintf("dispatching %d video bytes\n", remaining_sample_bytes);
while (remaining_sample_bytes) {
@@ -293,28 +291,28 @@ static int open_idcin_file(demux_idcin_t *this) {
*/
/* check the width */
- bih->biWidth = LE_32(&header[0]);
+ bih->biWidth = _X_LE_32(&header[0]);
if ((bih->biWidth == 0) || (bih->biWidth > 1024))
return 0;
/* check the height */
- bih->biHeight = LE_32(&header[4]);
+ bih->biHeight = _X_LE_32(&header[4]);
if ((bih->biHeight == 0) || (bih->biHeight > 1024))
return 0;
/* check the audio sample rate */
- this->wave.nSamplesPerSec = LE_32(&header[8]);
+ this->wave.nSamplesPerSec = _X_LE_32(&header[8]);
if ((this->wave.nSamplesPerSec != 0) &&
((this->wave.nSamplesPerSec < 8000) || (this->wave.nSamplesPerSec > 48000)))
return 0;
/* check the audio bytes/sample */
- this->wave.wBitsPerSample = LE_32(&header[12]) * 8;
+ this->wave.wBitsPerSample = _X_LE_32(&header[12]) * 8;
if (this->wave.wBitsPerSample > 16)
return 0;
/* check the audio channels */
- this->wave.nChannels = LE_32(&header[16]);
+ this->wave.nChannels = _X_LE_32(&header[16]);
if (this->wave.nChannels > 2)
return 0;
@@ -359,7 +357,8 @@ static void demux_idcin_send_headers(demux_plugin_t *this_gen) {
demux_idcin_t *this = (demux_idcin_t *) this_gen;
buf_element_t *buf;
xine_bmiheader *bih = (xine_bmiheader *)this->bih;
- uint32_t i, size;
+ uint32_t i;
+ int size;
this->video_fifo = this->stream->video_fifo;
this->audio_fifo = this->stream->audio_fifo;
@@ -445,11 +444,6 @@ static int demux_idcin_seek (demux_plugin_t *this_gen, off_t start_pos, int star
return this->status;
}
-static void demux_idcin_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_idcin_get_status (demux_plugin_t *this_gen) {
demux_idcin_t *this = (demux_idcin_t *) this_gen;
@@ -481,7 +475,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_idcin_send_headers;
this->demux_plugin.send_chunk = demux_idcin_send_chunk;
this->demux_plugin.seek = demux_idcin_seek;
- this->demux_plugin.dispose = demux_idcin_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_idcin_get_status;
this->demux_plugin.get_stream_length = demux_idcin_get_stream_length;
this->demux_plugin.get_capabilities = demux_idcin_get_capabilities;
@@ -492,19 +486,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,40 +505,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 "Id Quake II Cinematic file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Id CIN";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "cin";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_idcin_class_t *this = (demux_idcin_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_idcin_init_plugin (xine_t *xine, void *data) {
demux_idcin_class_t *this;
this = xine_xmalloc (sizeof (demux_idcin_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_("Id Quake II Cinematic file demux plugin");
+ this->demux_class.identifier = "Id CIN";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "cin";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}