Author Topic: BassVideo  (Read 436019 times)

kenshin1101

  • Posts: 545
BassVideo
« on: 23 Dec '07 - 05:45 »
BassVideo current stable version is 2.4.1.2
Download :
2.4.1.2
http://www.un4seen.com/filez/6/BassVideo_2.4.1.2.zip

Delphi source code is available to buy, contact me for more information


2.4.1.3 beta 3
use as an Bass plugin  8)
http://www.un4seen.com/filez/6/BassVideo_2.4.1.3_beta3.zip

2.4.1.3 beta 2

http://www.un4seen.com/filez/6/BassVideo_2.4.1.3_beta2.zip

Last Update :

2.4.1.2
+ TASFConfig structure changes
+ Correct function BassVideo_EncodeAudio
+ Save graph to new graph format that can view in any computer
+ Custom WMV Encoding
beta 2
+ BassVideo_DVD_...Subtile -> BassVideo_DVD_...Subtitle (correct syntax)
+ Add even when play/pause/stop
+ Fix some documents bug
beta 1
+ New convert API added ( BassVideo_Encoder_Create)
+ DVD API
+ Capture API
+ Draw text/image to video

2.4.1.1
+ Convert Video
+ C/C++ header + demo
+ Add license
2.4.1.0
+ Add Pitch/Audio Extract/Extra video info
+ Some little changes
2.4.0.9
+ BassVideo_HaveFilterPropertyPage change to BassVideo_HasFilterPropertyPage
+ Allow play the video from memory (see PlayFromMem example)
+ Allow use user define function to read video (see UserProc example)
New function are :
+ BassVideo_StreamCreateFileUser
+ BassVideo_StreamCreateFileMem
changes in "BassVideo_AddVideo" : add flags value

2.4.0.8
Remove C++ declare for each function.
(i don't know it correct or not and i'm not a C++ coder. I'll add full API for C,C++/VB/Delphi until there a support for C++)

Add VB API, example (thanks to mike and the other who help me write this)

+ Add Unicode/Ansi for BassVideo_CaptureBitmap

+ BassVideo_GetVideoInfo : Get video height, width

+ Tempo support (build in)

+ Some function for work with Filter/Graph

Other news function are :

     BassVideo_CloseWindow
     BassVideo_GetVideoWindow
     BassVideo_SetTempoValue,
     BassVideo_SetTempoEnable,
     BassVideo_GetTempoValue,
     BassVideo_GetTempoEnable,

     BassVideo_EnumFilter,
     BassVideo_HaveFilterPropertyPage,
     BassVideo_ShowFilterPropertyPage,
     BassVideo_SaveGraphFile

2.4.0.7
+ Capture bitmap
+ Auto Size/Move/Paint
+ Color set (demo) for Vmr9
2.4.0.6
+ Work with BassMix
+ Add function to frame step
+ Add function to get the FilterGraph
+ Add documents :D

+ Reduce size, bassvideo is only ~40 KB
+ Aspect ratio mode support.

Default Supported File Type : (MS DirectShow)

Windows Media® Audio (WMA)*
Windows Media® Video (WMV)*
Advanced Systems Format (ASF)*
Motion Picture Experts Group (MPEG)
Audio-Video Interleaved (AVI)
QuickTime (version 2 and lower)
WAV
AIFF
AU
SND

« Last Edit: 9 Jul '09 - 13:22 by kenshin1101 »

radio42

  • Posts: 4839
Re: BassVideo Demo
« Reply #1 on: 23 Dec '07 - 10:57 »
Hi,

nice demo!!!
But a lot of AVIs, WMVs are hanging in the middle or some don't play at all ?
Are there any limitations to it?

kenshin1101

  • Posts: 545
Re: BassVideo Demo
« Reply #2 on: 23 Dec '07 - 11:10 »
i play 6 video file in one time, but none of them stop ?
some avi requires right codec to play normally.

try add more bass buffer. if the problem exists send me that file.

ken

  • Posts: 752
Re: BassVideo Demo
« Reply #3 on: 23 Dec '07 - 19:13 »
very nice, like to see C# code for this dll.

radio42

  • Posts: 4839
Re: BassVideo Demo
« Reply #4 on: 23 Dec '07 - 20:30 »
If "bass_video" will become an 'official' add-on it will of course be added to BASS.NET.
I'll guess at latest til new year you can expect it to be there!

ken

  • Posts: 752
Re: BassVideo Demo
« Reply #5 on: 24 Dec '07 - 13:51 »
Thx Bernd, I knew you would fix that  ;)

kenshin1101

  • Posts: 545
Re: BassVideo Demo
« Reply #6 on: 24 Dec '07 - 14:53 »
i will release new version soon :
+ support set ratio mode : 4:3/16:9/source/free/custom
+ fix VMR9Renderless
Hope someone can convert it header to C/VB :)

ken

  • Posts: 752
Re: BassVideo Demo
« Reply #7 on: 24 Dec '07 - 16:49 »
>kenshin1101

Will you have a 3D allocator that you run the video graph on, so I can play (add, remove,start, stop independently) several videos at the same time (not mixing in VMR9)?


kenshin1101

  • Posts: 545
Re: BassVideo Demo
« Reply #8 on: 25 Dec '07 - 02:23 »
good idea!

it possible! i'll implement it for next release
« Last Edit: 25 Dec '07 - 07:58 by kenshin1101 »

big_gun

  • Posts: 353
Re: BassVideo Demo
« Reply #9 on: 26 Dec '07 - 03:46 »
I've been waiting years for this! My only request is dual outputs. meaning, put a infinite tee filter on there, and 2 vmr 9 renderers if possible.

e.g.
Code: [Select]
BASS_Video_SetDisplay(0, hWnd1)
BASS_Video_SetDisplay(1, hWnd2)

SoundMike

  • Posts: 369
Re: BassVideo Demo
« Reply #10 on: 26 Dec '07 - 04:37 »
I'm also very interested! Need the 16:9 resolution you've said is coming. I haven't tried BASSVideo in a program yet as I'm in a VB6 environment, but it shouldn't be difficult to create the necessary Declares. Any plans to support fade-in / fade-out of the image?

kenshin1101

  • Posts: 545
Re: BassVideo Demo
« Reply #11 on: 26 Dec '07 - 06:24 »
I've been waiting years for this! My only request is dual outputs. meaning, put a infinite tee filter on there, and 2 vmr 9 renderers if possible.

e.g.
Code: [Select]
BASS_Video_SetDisplay(0, hWnd1)
BASS_Video_SetDisplay(1, hWnd2)


I'm also very interested! Need the 16:9 resolution you've said is coming. I haven't tried BASSVideo in a program yet as I'm in a VB6 environment, but it shouldn't be difficult to create the necessary Declares. Any plans to support fade-in / fade-out of the image?

To do fade/in/out i must create a video transform filter & work with YUY2, RGB,... type image. This work can't be done in few day ;)
Dual/Tripe/... output too ;)

You can use custom Aspect ratio 1:1, 16:10,... not only 4:3, 16:9 :D

This time i want to complete normal function first :) so please wait until the other function is coded.

Current plant is :
+ Correct display ratio for EVR/Windowed mode (VMR9-Renderless done)
+ Play multi file in one graph
+ Decode the data (sound + video) like BASS_STREAM_DECODE
+ Allow user to Mixing the sound use BassMix
+ Add tempo function

ken

  • Posts: 752
Re: BassVideo Beta
« Reply #12 on: 27 Dec '07 - 13:35 »
Fade in/out is not that dificult, each filtergraph on the a surfaceallocator you change the "vertexBuffer", that holds R,G,B and alpha. You don't change anything on the graph it self, you cahange the "holder" where the graph is rederd in.

I have a C# example that I done that plays 2 video's and overlay image and text but not using Bass, that you can have. PM me.

Yes a secons output display (for preview) would be nice, mabye use GMFBridge and VRM7 for rendering that window to save performance

GMFBridge: http://www.gdcl.co.uk/gmfbridge/index.htm

radio42

  • Posts: 4839
Re: BassVideo Beta
« Reply #13 on: 27 Dec '07 - 15:47 »
Another wish would be, to make BASS_video use the BASS plugin system!

nyxtom

  • Posts: 10
Re: BassVideo Beta
« Reply #14 on: 1 Jan '08 - 12:29 »
I have written the C# wrapper for the delphi library using the given delphi header file. Please correct any mistakes since I think I may have made a few.

Code: [Select]
    public class BassVideo
    {
        // Video display
        public const string BassVideoDLL             = "bassvideo.dll";
        public const int BassVideo_Renderer          = 100;

        public const int BassVideo_Default           = 0;
        public const int BassVideo_VMR9              = 1;
        public const int BassVideo_VMR9_Windowless   = 2;
        public const int BassVideo_EVR               = 3;
        public const int BassVideo_Overlay           = 4;
        public const int BassVideo_NOVIdeo           = 5;

        // Action
        public const int BassVideo_OpenDone          = 1;
        public const int BassVideo_Buffering         = 2;
        public const int BassVideo_FoundVideo        = 3;

        public delegate void VIDEOPROC(int Handle, int Action, int param1, int param2, int user);

        public struct TAudioInfo
        {
            public int Channels;
            public int Frequency;
            public int Bit;
            public bool Float;
            public bool SPDIF;
            public bool DTS;
        }

        public enum TVideoType
        {
            RGB8,
            RGB32,
            RGB24,
            RGB16,
            YUY2,
            YUV,
            YV12,
            YUV12,
            YVYU,
            UYVY,
            YUY9,
            Y800
        }

        public static char[] TCodecName = new char[100];

        public struct TVideoInfo
        {
            public int Height;
            public int Width;
            public TVideoType VideoType;
            public IntPtr Codec;
        }

        [DllImport("bassvideo.dll")]
        public static extern int BassVideo_GetErrorCode();

        [DllImport("bassvideo.dll")]
        public static extern int BassVideo_StreamCreate(string FileName, int Flags, int BassFlags, VIDEOPROC CallBackProc);

        [DllImport("bassvideo.dll")]
        public static extern void BassVideo_SetConfig(int Option, int Value);

        [DllImport("bassvideo.dll")]
        public static extern int BassVideo_GetConfig(int Option);

        [DllImport("bassvideo.dll")]
        public static extern bool BassVideo_Play(int handle, bool restart);

        [DllImport("bassvideo.dll")]
        public static extern bool BassVideo_Stop(int handle);

        [DllImport("bassvideo.dll")]
        public static extern bool BassVideo_Pause(int handle);

        [DllImport("bassvideo.dll")]
        public static extern bool BassVideo_SetPosition(int handle, int pos);

        [DllImport("bassvideo.dll")]
        public static extern int BassVideo_GetPosition(int handle);

        [DllImport("bassvideo.dll")]
        public static extern int BassVideo_GetLength(int handle);

        [DllImport("bassvideo.dll")]
        public static extern void BassVideo_StreamFree(int handle);

        [DllImport("bassvideo.dll")]
        public static extern bool BassVideo_Init();

        [DllImport("bassvideo.dll")]
        public static extern void BassVideo_Free();

        [DllImport("bassvideo.dll")]
        public static extern void BASSVideo_SetVideoWindow(int handle, IntPtr VideoWindowHandle, Rect rect);

        [DllImport("bassvideo.dll")]
        public static extern void BASSVideo_Repaint(int handle, IntPtr WinHandle, IntPtr DC);

        [DllImport("bassvideo.dll")]
        public static extern void BassVideo_WindowResize(int handle, Rect Rect);

        [DllImport("bassvideo.dll")]
        public static extern void BassVideo_WindowMove(int handle, int Msg, long wParam, long lParam);

        [DllImport("bassvideo.dll")]
        public static extern bool BassVideo_SetFullScreen(int handle, bool FullScreen);
    }

versus the given delphi header for the bassvideo dll.

Code: [Select]
unit BassVideo;

interface

uses Windows;
const // video display
      BassVideoDLL = 'bassvideo.dll';
      BassVideo_Renderer           = $100; // for BassVideo_GetConfig/SetConfig

      BassVideo_Default            = 0;
      BassVideo_VMR9               = 1;
      BassVideo_VMR9_Windowless    = 2;
      BassVideo_EVR                = 3;
      BassVideo_Overlay            = 4;
      BassVideo_NOVIdeo            = 5;
      // action
      BassVideo_OpenDone     = 1;
      BassVideo_Buffering    = 2;
      BassVideo_FoundVideo   = 3;

//      BassVideo
type TVideoSync = procedure(Action, param1, param2, user : DWORD);
     VIDEOPROC = procedure(Handle : DWORD; Action, param1, param2, user : DWORD); stdcall;
     HSTREAM = DWORD;
     TAudioInfo  = record
       Channels  : integer;
       Frequency : integer;
       Bit       : integer;
       Float     : BOOL;
       SPDIF     : BOOL;// reserverd, currently not supported!
       DTS       : BOOL;// reserverd, currently not supported!
     end;

     TVideoType = (RGB8, RGB32, RGB24, RGB16, YUY2, YUV,
                   // reserved type, not supported at this time :(
                   YV12, YUV12, YVYU, UYVY, YUY9, Y800);//, 444P, 422P 411P );

     PCodecName = ^TCodecName;
     TCodecName = array[0..100] of char;

     TVideoInfo  = record
       Height : integer;
       Width  : integer;
       VideoType : TVideoType;
       Codec  : PCodecName;
     end;

    QWORD = int64;

function BassVideo_ErrorGetCode : integer; stdcall; external BassVideoDLL;
function BassVideo_StreamCreate(FileName : Pointer; Flags, BassFlags : DWORD; CallBackProc : VIDEOPROC) : DWORD; stdcall; external BassVideoDLL;
procedure BassVideo_SetConfig(Option : DWORD; Value : DWORD); stdcall; external BassVideoDLL;
function BassVideo_GetConfig(Option : DWORD) : DWORD; stdcall; external BassVideoDLL;

function BassVideo_Play(handle: DWORD; restart : BOOL) : BOOL; stdcall; external BassVideoDLL;
function BassVideo_Stop(handle: DWORD) : BOOL; stdcall; external BassVideoDLL;
function BassVideo_Pause(handle: DWORD) : BOOL; stdcall; external BassVideoDLL;
function BassVideo_SetPosition(handle: DWORD; pos: QWORD): BOOL; stdcall; external BassVideoDLL;
function BASSVideo_GetPosition(handle: DWORD): QWORD; stdcall; external BassVideoDLL;
function BASSVideo_GetLength(handle: DWORD): QWORD; stdcall; external BassVideoDLL;
procedure BassVideo_StreamFree(handle: DWORD); stdcall; external BassVideoDLL;
function BassVideo_Init : BOOL; stdcall; external BassVideoDLL;
procedure BassVideo_Free; stdcall; external BassVideoDLL;

// for video windows function
procedure BASSVideo_SetVideoWindow(handle : HSTREAM; VideoWindowHandle : THandle; VideoRect : TRect); stdcall; external BassVideoDLL;
procedure BASSVideo_Repaint(handle : HSTREAM; WinHandle : HWND; DC : HDC); stdcall; external BassVideoDLL;
procedure BassVideo_WindowResize(handle : HSTREAM; Rect : TRect); stdcall; external BassVideoDLL;
procedure BassVideo_WindowMove(handle : HSTREAM; Msg : DWORD; wParam, lParam : LongInt); stdcall; external BassVideoDLL;
function BassVideo_SetFullScreen(handle : HSTREAM; FullScreen : BOOL) : BOOL; stdcall; external BassVideoDLL;


implementation

end.

nyxtom

  • Posts: 10
Re: BassVideo Beta
« Reply #15 on: 1 Jan '08 - 12:47 »
Yay! It works! Here is the code for the Windows Form demo. You'll have to change the BassVideo code to use the Rectangle class instead of Rect (I was using WPF at first).

Code: [Select]
    public partial class Form1 : Form
    {
        BassVideo.VIDEOPROC callback;
        int stream;

        public Form1()
        {
            InitializeComponent();
            callback = new BassVideo.VIDEOPROC(MyVideoCallback);
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, null);

            BassVideo.BassVideo_Init();

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                stream = BassVideo.BassVideo_StreamCreate((string)openFileDialog1.FileName, 0, 0, callback);

                if (stream != 0 && stream != -1)
                {
                    BassVideo.BassVideo_Play(stream, false);
                }
            }
        }

        private void MyVideoCallback(int Handle, int Action, int param1, int param2, int user)
        {
            Rectangle rect;
            switch (Action)
            {
                case BassVideo.BassVideo_FoundVideo:
                    rect = this.ClientRectangle;
                    BassVideo.BASSVideo_SetVideoWindow(Handle, this.Handle, rect);
                    break;
            }
        }

        ~Form1()
        {
            BassVideo.BassVideo_Free();

            Bass.BASS_Free();
        }
    }

The only thing missing is the WndProc code override. I haven't coded the Message yet to handle the lparam, rparam data since I'm not sure what the constructs are supposed to be. I wrote some code to send messages using WM_COPYDATA between two processes so I'll take a look at that since it uses the WndProc override.

kenshin1101

  • Posts: 545
Re: BassVideo Beta
« Reply #16 on: 10 Jan '08 - 16:39 »
i was upload the new version.
from now it size is small than bass.dll :p

There something that i don't know how to do. it about the decoder flags. i can run the graph and feed it to bass. But when create a decoder channels, i don't know how to feed it. Because data it wait for user to get by Bass_ChannelGetData & i can't get the data simply like use ReadFile(some data, some size). If i feed it all to bass without wait user call get data then memory used will be large. Need some suggestions!!!
« Last Edit: 10 Jan '08 - 17:03 by kenshin1101 »

smesser

  • Posts: 122
Re: BassVideo Beta
« Reply #17 on: 11 Jan '08 - 22:01 »
EDITED ---

« Last Edit: 12 Jan '08 - 07:35 by smesser »

smesser

  • Posts: 122
Re: BassVideo Beta
« Reply #18 on: 12 Jan '08 - 06:25 »
EDIT ---

Never mind I figured it out
« Last Edit: 12 Jan '08 - 07:34 by smesser »

smesser

  • Posts: 122
Re: BassVideo Beta
« Reply #19 on: 12 Jan '08 - 07:14 »
Here is the code for the override of WndProc in C#

 
Code: [Select]
public const int WM_MOVE = 0x0003;
 public const int WM_SIZE = 0x0005;


Code: [Select]
protected override void WndProc(ref Message m)
{
     switch(m.Msg)
     {
          case BassVideoWrapper.WM_MOVE:
          {
               BassVideoWrapper.BassVideo_WindowMove(stream, m.Msg, m.WParam, m.LParam);
          }
           break;

          case BassVideoWrapper.WM_SIZE:
          {
               Rectangle r = pictureBox1.ClientRectangle;

               BassVideoWrapper.BassVideo_WindowResize(stream, r);
           }
           break;
      }

      base.WndProc(ref m);
}

smesser

  • Posts: 122
Multi-Monitor question
« Reply #20 on: 12 Jan '08 - 07:31 »
I am not a directx (direct show) guru but I have a question.

I am seeing what I consider a strange behavior but it may be an expected behavior.

In my demo as well as in the Delphi demo if you drag the window playing the movie
to a second monitor it abruptly quits playing.

Is that a directx thing or what?

« Last Edit: 12 Jan '08 - 07:35 by smesser »

kenshin1101

  • Posts: 545
Re: BassVideo Beta
« Reply #21 on: 12 Jan '08 - 09:24 »
no you don't need to learn any DirectX or DirectShow. Just some API code to set the windowed mode. I recommended you to use windowless mode :). if you use this mode you don't see that problem.
« Last Edit: 12 Jan '08 - 11:43 by kenshin1101 »

smesser

  • Posts: 122
Re: BassVideo Beta
« Reply #22 on: 12 Jan '08 - 16:09 »
Thanks,

I will try that.


kenshin1101

  • Posts: 545
Re: BassVideo Beta
« Reply #23 on: 12 Jan '08 - 16:47 »
i was update new version

+ Add Function BassVideo_AddFile : use this function to play multifile in one graph.
Delphi demo for multifile are avaiable

+ i had try write a VB demo & C++ header but it doesn't work.See it in VB & CPP directory

Please note that some Filter installed when use Nero have anti debug & it will cause application exit when debug
« Last Edit: 12 Jan '08 - 17:13 by kenshin1101 »

smesser

  • Posts: 122
Re: BassVideo Beta
« Reply #24 on: 13 Jan '08 - 04:23 »
kenshin1101 ,

Could you add a getversion method?

Could you also explain how to get an end of video notification?

« Last Edit: 13 Jan '08 - 04:29 by smesser »