CDXLPlay added with permission from Fredik Wikstrom.
[AROS-Contrib.git] / MultiMedia / cdxlplay / include / cdxlplay.h
blob5216b09eea2c5b5e6bba2ffc184dcba60753b2b3
1 /*
2 ** CDXLPlay (C) 2009 Fredrik Wikstrom
3 **/
5 #ifndef CDXLPLAY_H
6 #define CDXLPLAY_H
8 #include <SDL/SDL.h>
9 #ifdef __AROS__
10 #include <GL/gl.h>
11 #else
12 #include <GL/GL.h>
13 #endif
14 #include <stdio.h>
15 #include <unistd.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <sys/time.h>
19 #include "endian.h"
20 #include "lists.h"
21 #include "cdxl.h"
22 #include "p2c.h"
24 #define PROGNAME "CDXLPlay"
25 #define VSTRING "1.4"
27 #define NULL ((void *)0)
28 #define MAX(a,b) ((a)>(b)?(a):(b))
29 #define MIN(a,b) ((a)<(b)?(a):(b))
31 struct cdxl_file {
32 char *filename;
33 FILE *file;
34 int num_frames;
35 struct list list;
36 int padded_width;
37 uint8_t *chunky;
38 int has_audio;
41 struct cdxl_frame {
42 struct node node;
43 int index;
44 PAN pan;
45 off_t offset;
46 int size;
47 int cmap_size;
48 int plane_size;
49 int video_size;
50 int audio_size;
51 int is_ham;
52 int is_stereo;
53 uint8_t *buffer;
56 struct audio_node {
57 struct node node;
58 int frame;
59 int8_t *pcm;
60 int apos;
61 int alen;
64 struct player_data {
65 const char *filename;
66 uint32_t sdl_video_flags;
67 SDL_Surface *screen;
68 SDL_Surface *surf;
69 struct cdxl_file *cdxl;
70 struct cdxl_frame *frame;
71 SDL_TimerID timer_id;
72 struct cdxl_frame *aframe;
73 struct list audio_list;
74 SDL_mutex *audio_mutex;
75 SDL_cond *audio_cond;
76 int audio_enable;
77 int aprebuf;
78 int fps;
79 int freq;
80 int loop;
81 int width, height;
82 int pixel_ratio;
83 int status;
84 struct timeval tv;
87 enum {
88 PAUSED,
89 PLAYING
92 /* main.c */
93 int main (int argc, char *argv[]);
95 /* options.c */
96 int get_options (int argc, char *argv[], struct player_data *pd);
97 void free_options (void);
99 /* cdxlplay.c */
100 struct cdxl_file *open_cdxl(const char *filename);
101 void close_cdxl(struct cdxl_file *cdxl);
102 int read_cdxl_frame(struct cdxl_file *cdxl, struct cdxl_frame *frame);
103 void free_cdxl_frame(struct cdxl_file *cdxl, struct cdxl_frame *frame);
104 int decode_cdxl_frame(struct cdxl_file *cdxl, struct cdxl_frame *frame, SDL_Surface *surf);
106 /* scale.c */
107 void ScaleSurface(SDL_Surface *source, SDL_Surface *dest, uint32_t pix_ratio);
109 /* opengl.c */
110 void GLInit(int w, int h);
111 void GLExit();
112 void GLScaleSurface(SDL_Surface *source, SDL_Surface *dest, uint32_t pix_ratio);
114 #endif