Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
21st January 2006, 19:05 | #1 | Link |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
A new version of AVSredirect.dll
Hi,
I went into the code of AVSredirect and modified it a bit so it could be more handy to appl. developers. It will be accessed via stdcall and got some addons. Avs Scripts now can be easely handled in VB, Delphi, Purebasic etc. without the common VFW workouts. Scripts at given string pointers also can be handled. Code:
*env = avs_create() Creates a Scripenvironment for later use ErrorLength = avs_getlasterror(char *str, int len)) Returns the length of the Errorstring which will be stored at the *str stringpointer *char = avs_getlasterrorb() Returns a string pointer where the last Error is stored. The linebreaks of the string do come as chr(10)+chr(13) istead of a single chr(10) clip = avs_open(*env, char *fname, AVSDLLVideoInfo *vi) Opens an avs file, passes the VideoInfo to *vi and returns the clipnumber clip = avs_script(*env, char *script, AVSDLLVideoInfo *vi, "RGB24") Takes a string (an avs script) strored at *script, passes the VideoInfo to *vi and returns the clipnumber. Note, you can force the output to a given Colorpace. Options are "RGB24", "RGB32", "YV12" and "YVY2" *p = avs_getvframe(*env, clip, frame ) Returns the adress where the Bitmap is stored. avs_getaframe(*env, clip, *buffer, __int64 start, __int64 count) Reads the audiodata from the sample start to the sample end and stores it at the given *buffer adress avs_close(*env, clip) Releases the clip and the scriptenvironment The AVSdllVideoInfo Structure: typedef struct AVSDLLVideoInfo { // Video int width; int height; int raten; int rated; int aspectn; // ? int aspectd; // ? int interlaced_frame; int top_field_first; int num_frames; int pixel_type; // Audio int audio_samples_per_second; int sample_type; int nchannels; int num_audio_frames; int64_t num_audio_samples; } AVSDLLVideoInfo; Inc. Last edited by Inc; 21st January 2006 at 19:11. |
21st January 2006, 19:09 | #2 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
please, upload it @ mytemdir.com
PS. I just finished my own avsredirect modification
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
23rd January 2006, 09:48 | #5 | Link |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
Create a scriptenvironment, open the avs-file or the avs-script-string, get the wanted videoframe, get the wanted audiodata, get the errors if the calls before did return an error value, if not --> .... play it.
Close the avs if you want to release the script. Look into the sources - they are included as its GPL licensed - the sources speak for themself. |
23rd January 2006, 18:37 | #6 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
23rd January 2006, 21:20 | #7 | Link |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
Yupp, how about adding ...
Code:
env->BitBlt(bufferVidOut, outPitch, f->GetReadPtr(), f->GetPitch(), f->GetRowSize(), f->GetHeight()); But how obtaining the right value for the 'outPitch' depending on the Outputcolorspace (RGB24/32,YV12,YUY2) ? Last edited by Inc; 23rd January 2006 at 21:22. |
24th January 2006, 00:34 | #8 | Link |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
I added to the the avs_getvframe() function the BitBlt() so the problem about the smartpointer issue should be solved:
Code:
int __stdcall avs_getvframe(IScriptEnvironment* env, int clip_num, BYTE *buf, int frm ) { try { PVideoFrame f = clip[clip_num]->GetFrame(frm, env); env->BitBlt(buf,f->GetPitch(), f->GetReadPtr(), f->GetPitch(), f->GetRowSize(), f->GetHeight()); g_lasterr[0] = 0; return 0; } catch(AvisynthError err) { strncpy(g_lasterr,err.msg,ERRMSG_LEN-1); return -1; } } I tested the playback and it works fine on a RGB24 previewing output. Dimzon, I had a closer look at the mod's you did on AVSRedirect. You did made a separate __patchScript() function, which makes sense, but in case of avs_open() you do force an YV12 output! I have been even thinking about getting rid of the YV12 and YUY2 output option as it makes imho no sense in case of a wrapper which gots its purpose to provide Videoframes mainly for later displaying in previewing apps. |
24th January 2006, 02:09 | #9 | Link |
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
Permission to add to RealAnime
__________________
Detritus Software |
24th January 2006, 09:40 | #10 | Link |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
Of course
But as you see its not really ready yet. Lets wait if the BitBlt approach above is correct done. I want to implement a cropping/resizing function and some more addons. Last edited by Inc; 24th January 2006 at 09:43. |
24th January 2006, 11:37 | #11 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
24th January 2006, 12:48 | #12 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
Waht does I obtain @ the output, how I must threat this values, which buffer size i must provide to to this function?
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
24th January 2006, 13:31 | #13 | Link |
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
@incredible
Is it ready for at least getting the audio and video informations?
__________________
Detritus Software |
24th January 2006, 13:32 | #14 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
24th January 2006, 13:42 | #15 | Link |
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
Cool! I will try it this weekend! Thanks!
__________________
Detritus Software |
24th January 2006, 13:51 | #16 | Link |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
@ Dimzon
In PureBasic Syntax *buf = AllocateMemory( vi.width * vi.height * 3 ) ;// an RGB 24 buffer avs_getvframe(*env, clip_num, *buf, frm ) thats like if you do avs_getaframe(). By doing this you get a 'naked' raw RGB24 Bitmap at *buf. The result value out of the call itself is just a bool like in the other function calls incl. providig the error string to the getlasterror() function if a -1 returns. Then use a predifined BITMAPINFOHEADER Structure where you do set the obligatory values for width, height, planes, bitcount etc. Pass these values to the APIs SetDIBits() command and you will have a standard RGB24 Bitmap for displaying in an imageframe. I do assume as MeGUI also obtaines raw RGB24 Bitmaps out of the DgDecode access, so do look how in MeGUI those raw Bitmaps will be treaten to be displayed in a picture frame. Last edited by Inc; 24th January 2006 at 14:44. |
24th January 2006, 13:54 | #17 | Link | |
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
Quote:
So you dont have to provide another dll like the one provided in here with your applikation |
|
24th January 2006, 14:13 | #18 | Link | |
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
Quote:
__________________
Detritus Software |
|
24th January 2006, 14:31 | #19 | Link | ||
Squeeze it!
Join Date: Oct 2003
Location: Germany
Posts: 472
|
Code:
struct AVSDLLVideoInfo { // Video int width; // From AvifileInfo int height; // From AvifileInfo int raten; // From AviStreamInfo int rated; // From AviStreamInfo int aspectn; // -->Not provided viy Avisynth int aspectd; // -->Not provided viy Avisynth int interlaced_frame; // really needed? int top_field_first; // really needed? and if ... is this result proof? int num_frames; // From AviStreamInfo int pixel_type; From the BitmapInfoHeader // Audio int audio_samples_per_second; // From AviStreamInfo/StreamTypeAudio-->WaveFormatEx int sample_type; // From AviStreamInfo/StreamTypeAudio-->WaveFormatEx int nchannels; // From AviStreamInfo/StreamTypeAudio-->WaveFormatEx int num_audio_frames; // From AviStreamInfo/StreamTypeAudio int64_t num_audio_samples; // Calculate from above } If you need some Infos *ring the bell* Quote:
The *buf generation is done before the getting frames loop. And the avs BitBlt function seems to be verrry fast related to dev reports in here. Thats btw. the approch included in Triticals Brief explanation some threads below. EDIT: Wait .... Quote:
I did understand that the framedata in the memory at the "smart pointer" could get lost? And not the Adress itself!? Last edited by Inc; 24th January 2006 at 14:45. |
||
24th January 2006, 15:42 | #20 | Link |
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
"AviFil32 API" can open AVS?
__________________
Detritus Software |
Thread Tools | Search this Thread |
Display Modes | |
|
|