aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/lib
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-30 09:31:51 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-30 09:31:51 +0000
commitea92932825739b6d7f5ac1434382a1a59a0371fd (patch)
tree15c0807b5fdbe064a1a9a786a12d308650aeac61 /Game/Code/lib
parentbb4a6304aab5a215055813617130c01d91d80a83 (diff)
downloadusdx-ea92932825739b6d7f5ac1434382a1a59a0371fd.tar.gz
usdx-ea92932825739b6d7f5ac1434382a1a59a0371fd.tar.xz
usdx-ea92932825739b6d7f5ac1434382a1a59a0371fd.zip
- new acinerella.dll (based on 1.4)
- the song does not restart if you change the video gap in the editor while playing - some corrections in Blue Sensation theme; darker sing notes graphics - some bugfixes - max fps at ~200 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2425 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/lib')
-rw-r--r--Game/Code/lib/acinerella/acinerella.c58
-rw-r--r--Game/Code/lib/acinerella/acinerella.h7
-rw-r--r--Game/Code/lib/acinerella/acinerella.pas13
3 files changed, 50 insertions, 28 deletions
diff --git a/Game/Code/lib/acinerella/acinerella.c b/Game/Code/lib/acinerella/acinerella.c
index 05c52232..bae6b0e8 100644
--- a/Game/Code/lib/acinerella/acinerella.c
+++ b/Game/Code/lib/acinerella/acinerella.c
@@ -129,11 +129,7 @@ void init_info(lp_ac_file_info info)
info->bitrate = -1;
}
-lp_ac_instance CALL_CONVT ac_init(void) {
- //Initialize FFMpeg libraries
- avcodec_register_all();
- av_register_all();
-
+lp_ac_instance CALL_CONVT ac_init(void) {
//Allocate a new instance of the videoplayer data and return it
lp_ac_data ptmp;
ptmp = (lp_ac_data)mgr_malloc(sizeof(ac_data));
@@ -181,7 +177,7 @@ static int64_t io_seek(void *opaque, int64_t pos, int whence)
return -1;
}
-static AVInputFormat *av_probe_input_format2(AVProbeData *pd, int *score_max)
+static AVInputFormat *_av_probe_input_format2(AVProbeData *pd, int *score_max)
{
AVInputFormat *fmt1, *fmt;
int score;
@@ -227,7 +223,7 @@ void ac_release_buffer(struct AVCodecContext *c, AVFrame *pic){
avcodec_default_release_buffer(c, pic);
}
-AVInputFormat* ac_probe_input_buffer(
+lp_ac_proberesult CALL_CONVT ac_probe_input_buffer(
char* buf,
int bufsize,
char* filename,
@@ -235,6 +231,10 @@ AVInputFormat* ac_probe_input_buffer(
{
AVProbeData pd;
+ //Initialize FFMpeg libraries
+ avcodec_register_all();
+ av_register_all();
+
//Set the filename
pd.filename = "";
if (filename) {
@@ -246,7 +246,7 @@ AVInputFormat* ac_probe_input_buffer(
pd.buf_size = bufsize;
//Test it
- return av_probe_input_format2(&pd, score_max);
+ return (lp_ac_proberesult) _av_probe_input_format2(&pd, score_max);
}
#define PROBE_BUF_MIN 2048
@@ -291,7 +291,7 @@ AVInputFormat* ac_probe_input_stream(
}
//Probe it
- fmt = ac_probe_input_buffer(tmp_buf, probe_size, filename, &score);
+ fmt = (AVInputFormat*)ac_probe_input_buffer(tmp_buf, probe_size, filename, &score);
//Set the new buffer
*buf = tmp_buf;
@@ -308,7 +308,8 @@ int CALL_CONVT ac_open(
ac_openclose_callback open_proc,
ac_read_callback read_proc,
ac_seek_callback seek_proc,
- ac_openclose_callback close_proc)
+ ac_openclose_callback close_proc,
+ lp_ac_proberesult proberesult)
{
pacInstance->opened = 0;
@@ -327,13 +328,21 @@ int CALL_CONVT ac_open(
open_proc(sender);
}
- //Probe the input format
+ AVInputFormat* fmt = NULL;
int probe_size = 0;
- AVInputFormat* fmt = ac_probe_input_stream(sender, read_proc, "",
+
+ //Probe the input format, if no probe result is specified
+ if(proberesult == NULL)
+ {
+ fmt = ac_probe_input_stream(sender, read_proc, "",
(void*)&((lp_ac_data)pacInstance)->buffer, &probe_size);
-
- if (!fmt) return -1;
+ }
+ else
+ {
+ fmt = (AVInputFormat*)proberesult;
+ }
+ if (!fmt) return -1;
if (!seek_proc) {
init_put_byte(
@@ -428,16 +437,19 @@ void CALL_CONVT ac_get_stream_info(lp_ac_instance pacInstance, int nb, lp_ac_str
((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->width;
info->additional_info.video_info.frame_height =
((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->height;
- info->additional_info.video_info.pixel_aspect =
- av_q2d(((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->sample_aspect_ratio);
- //Sometime "pixel aspect" may be zero. Correct this.
- if (info->additional_info.video_info.pixel_aspect == 0.0) {
+
+ double pixel_aspect_num = ((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->sample_aspect_ratio.num;
+ double pixel_aspect_den = ((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->sample_aspect_ratio.den;
+
+ //Sometime "pixel aspect" may be zero or have other invalid values. Correct this.
+ if (pixel_aspect_num <= 0.0 || pixel_aspect_den <= 0.0)
info->additional_info.video_info.pixel_aspect = 1.0;
- }
+ else
+ info->additional_info.video_info.pixel_aspect = pixel_aspect_num / pixel_aspect_den;
- info->additional_info.video_info.frames_per_second =
- (double)((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->r_frame_rate.num /
- (double)((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->r_frame_rate.den;
+ info->additional_info.video_info.frames_per_second =
+ (double)((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->r_frame_rate.num /
+ (double)((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->r_frame_rate.den;
break;
case CODEC_TYPE_AUDIO:
//Set stream type to "AUDIO"
@@ -689,7 +701,7 @@ int ac_decode_video_package(lp_ac_package pPackage, lp_ac_video_decoder pDecoder
sws_scale(
pDecoder->pSwsCtx,
- (uint8_t*)(pDecoder->pFrame->data),
+ (const uint8_t* const*)(pDecoder->pFrame->data),
pDecoder->pFrame->linesize,
0, //?
pDecoder->pCodecCtx->height,
diff --git a/Game/Code/lib/acinerella/acinerella.h b/Game/Code/lib/acinerella/acinerella.h
index 0fafc011..a758164d 100644
--- a/Game/Code/lib/acinerella/acinerella.h
+++ b/Game/Code/lib/acinerella/acinerella.h
@@ -184,6 +184,8 @@ typedef struct _ac_package ac_package;
/*Pointer on TAc_package*/
typedef ac_package* lp_ac_package;
+typedef void* lp_ac_proberesult;
+
/*Callback function used to ask the application to read data. Should return
the number of bytes read or an value smaller than zero if an error occured.*/
typedef int CALL_CONVT (*ac_read_callback)(void *sender, char *buf, int size);
@@ -221,7 +223,8 @@ extern int CALL_CONVT ac_open(
ac_openclose_callback open_proc,
ac_read_callback read_proc,
ac_seek_callback seek_proc,
- ac_openclose_callback close_proc);
+ ac_openclose_callback close_proc,
+ lp_ac_proberesult proberesult);
/*Closes an opened media file.*/
extern void CALL_CONVT ac_close(lp_ac_instance pacInstance);
@@ -248,4 +251,6 @@ The parameter "dir" specifies the seek direction: 0 for forward, -1 for backward
The target_pos paremeter is in milliseconds. Returns 1 if the functions succeded.*/
extern int CALL_CONVT ac_seek(lp_ac_decoder pDecoder, int dir, int64_t target_pos);
+extern lp_ac_proberesult CALL_CONVT ac_probe_input_buffer(char* buf, int bufsize, char* filename, int* score_max);
+
#endif /*VIDEOPLAY_H*/
diff --git a/Game/Code/lib/acinerella/acinerella.pas b/Game/Code/lib/acinerella/acinerella.pas
index 06d8db41..c806cc8f 100644
--- a/Game/Code/lib/acinerella/acinerella.pas
+++ b/Game/Code/lib/acinerella/acinerella.pas
@@ -73,8 +73,8 @@ type
AC_OUTPUT_BGRA32 = 3
);
- TAc_infostr = array[0..511] of Char;
- TAc_infostr2 = array[0..31] of Char;
+ TAc_infostr = array[0..511] of AnsiChar;
+ TAc_infostr2 = array[0..31] of AnsiChar;
{Contains information about the whole file/stream that has been opened. Default
values are "" for strings and -1 for integer values.}
@@ -180,6 +180,8 @@ type
end;
{Pointer on TAc_package}
PAc_package = ^TAc_package;
+
+ PAc_proberesult = Pointer;
{Callback function used to ask the application to read data. Should return
the number of bytes read or an value smaller than zero if an error occured.}
@@ -212,7 +214,8 @@ function ac_open(
open_proc: TAc_openclose_callback;
read_proc: TAc_read_callback;
seek_proc: TAc_seek_callback;
- close_proc: TAc_openclose_callback): integer; cdecl; external ac_dll;
+ close_proc: TAc_openclose_callback;
+ proberesult: PAc_proberesult): integer; cdecl; external ac_dll;
{Closes an opened media file.}
procedure ac_close(inst: PAc_instance);cdecl; external ac_dll;
@@ -241,7 +244,9 @@ The parameter "dir" specifies the seek direction: 0 for forward, -1 for backward
The target_pos paremeter is in milliseconds. Returns 1 if the functions succeded.}
function ac_seek(pDecoder: PAc_decoder; dir: integer; target_pos: int64): integer; cdecl; external ac_dll;
-
+function ac_probe_input_buffer(buf: PChar; bufsize: Integer; filename: PChar;
+ var score_max: Integer): PAc_proberesult; cdecl; external ac_dll;
+
implementation
{Connect the library memory management to the host application. This happens