Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does go-sciter have a use case for video rendering? #332

Open
xs23933 opened this issue Mar 12, 2022 · 4 comments
Open

Does go-sciter have a use case for video rendering? #332

xs23933 opened this issue Mar 12, 2022 · 4 comments

Comments

@xs23933
Copy link

xs23933 commented Mar 12, 2022

I need to do video rendering about video frame

Render the h264 frame decoded by libavcodec to the display

Only see sciter VIDEO_BIND_RQ but no use case

或者任何
in-memory:cursor demo

@pravic
Copy link
Member

pravic commented Mar 12, 2022

I doubt we support VIDEO_BIND_RQ in Go.

Here's an example in C++: https://github.com/c-smile/sciter-sdk/blob/master/include/behaviors/behavior_video_generator.cpp#L40-L60

@xs23933
Copy link
Author

xs23933 commented Mar 14, 2022

thanks I will study again

@xs23933
Copy link
Author

xs23933 commented Mar 14, 2022

sciter-x-video-api.h is c++ syntax so it is difficult

I modified the file name sciter-x-video-api.hpp and include it
But the compiler still prompts error: unknown type name 'namespace'

@xs23933
Copy link
Author

xs23933 commented Mar 14, 2022

add scider-x-video.h
use c style
but how to call library member method , i can't

#ifndef __SCITER_X_VIDEO__
#define __SCITER_X_VIDEO__

#include <sciter-x.h>


typedef struct video_source {
    SBOOL SCFN( play )();
    SBOOL SCFN( pause )();
    SBOOL SCFN( stop )();
    SBOOL SCFN( get_is_ended )(SBOOL *eos);
    SBOOL SCFN( get_position )(double *seconds);
    SBOOL SCFN( set_position )(double seconds);
    SBOOL SCFN( get_duration )(double *seconds);
    // audio
    SBOOL SCFN( get_volume )(double* vol);
    SBOOL SCFN( set_volume )(double vol);
    SBOOL SCFN( get_balance )(double* vol);
    SBOOL SCFN( set_balance )(double vol);
} video_source_t;

typedef struct video_destination{
    SBOOL SCFN( is_alive )();
    SBOOL SCFN( start_streaming )(
        INT frame_width,
        INT frame_height,
        INT color_space,
        video_source_t* src
    );
    SBOOL SCFN( stop_streaming )();
    SBOOL SCFN( render_frame )(const BYTE* frame_data, UINT frame_data_size);
} video_destination_t;

video_destination_t* SVAPI() {
    return _SVAPI(NULL);
};


#endif

video.go

package sciter

// #include "sciter-x.h"
import "C"
import "unsafe"

type VideoSource C.video_source_t

type VideoDestination C.video_destination_t

func NewVideoDestination(ptr C.UINT_PTR) *VideoDestination {
	vd := &VideoDestination{}
	vd = (*VideoDestination)(unsafe.Pointer(uintptr(ptr)))
	return vd
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants