mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
gst push function.
This commit is contained in:
parent
710d0c9cd0
commit
7bc9a40677
@ -82,3 +82,13 @@ void gstreamer_pipeline_stop(GstElement *pipeline) {
|
|||||||
gst_element_set_state(pipeline, GST_STATE_NULL);
|
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||||
gst_object_unref(pipeline);
|
gst_object_unref(pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gstreamer_pipeline_push(GstElement *pipeline, char *sinkName, void *buffer, int bufferLen) {
|
||||||
|
GstElement *src = gst_bin_get_by_name(GST_BIN(pipeline), sinkName);
|
||||||
|
if (src != NULL) {
|
||||||
|
gpointer p = g_memdup(buffer, bufferLen);
|
||||||
|
GstBuffer *buffer = gst_buffer_new_wrapped(p, bufferLen);
|
||||||
|
gst_app_src_push_buffer(GST_APP_SRC(src), buffer);
|
||||||
|
gst_object_unref(src);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -74,6 +74,16 @@ func (p *Pipeline) Stop() {
|
|||||||
C.gstreamer_pipeline_stop(p.Pipeline)
|
C.gstreamer_pipeline_stop(p.Pipeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Pipeline) Push(sinkName string, buffer []byte) {
|
||||||
|
sinkNameUnsafe := C.CString(sinkName)
|
||||||
|
defer C.free(unsafe.Pointer(sinkNameUnsafe))
|
||||||
|
|
||||||
|
bytes := C.CBytes(buffer)
|
||||||
|
defer C.free(bytes)
|
||||||
|
|
||||||
|
C.gstreamer_pipeline_push(p.Pipeline, sinkNameUnsafe, bytes, C.int(len(buffer)))
|
||||||
|
}
|
||||||
|
|
||||||
// gst-inspect-1.0
|
// gst-inspect-1.0
|
||||||
func CheckPlugins(plugins []string) error {
|
func CheckPlugins(plugins []string) error {
|
||||||
var plugin *C.GstPlugin
|
var plugin *C.GstPlugin
|
||||||
|
@ -9,5 +9,6 @@ void gstreamer_pipeline_attach_appsink(GstElement *pipeline, char *sinkName, int
|
|||||||
GstElement *gstreamer_pipeline_create(char *pipelineStr, GError **error);
|
GstElement *gstreamer_pipeline_create(char *pipelineStr, GError **error);
|
||||||
void gstreamer_pipeline_play(GstElement *pipeline);
|
void gstreamer_pipeline_play(GstElement *pipeline);
|
||||||
void gstreamer_pipeline_stop(GstElement *pipeline);
|
void gstreamer_pipeline_stop(GstElement *pipeline);
|
||||||
|
void gstreamer_pipeline_push(GstElement *pipeline, char *sinkName, void *buffer, int bufferLen);
|
||||||
|
|
||||||
void gstreamer_init(void);
|
void gstreamer_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user