mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
catch gstreamer errors.
This commit is contained in:
parent
49c3b6d4fe
commit
f32ebe7935
@ -61,11 +61,6 @@ GstFlowReturn gstreamer_send_new_sample_handler(GstElement *object, gpointer use
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
GstElement *gstreamer_send_create_pipeline(char *pipeline) {
|
||||
GError *error = NULL;
|
||||
return gst_parse_launch(pipeline, &error);
|
||||
}
|
||||
|
||||
void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId) {
|
||||
SampleHandlerUserData *s = calloc(1, sizeof(SampleHandlerUserData));
|
||||
s->pipelineId = pipelineId;
|
||||
|
@ -197,8 +197,18 @@ func CreatePipeline(pipelineStr string, codecName string, clockRate float32) (*P
|
||||
pipelinesLock.Lock()
|
||||
defer pipelinesLock.Unlock()
|
||||
|
||||
var gstPipeline *C.GstElement
|
||||
var gstError *C.GError
|
||||
|
||||
gstPipeline = C.gst_parse_launch(pipelineStrUnsafe, &gstError)
|
||||
defer C.g_error_free(gstError)
|
||||
|
||||
if gstPipeline == nil || gstError != nil {
|
||||
return nil, fmt.Errorf("(pipeline error) %s", C.GoString(gstError.message))
|
||||
}
|
||||
|
||||
p := &Pipeline{
|
||||
Pipeline: C.gstreamer_send_create_pipeline(pipelineStrUnsafe),
|
||||
Pipeline: gstPipeline,
|
||||
Sample: make(chan types.Sample),
|
||||
CodecName: codecName,
|
||||
ClockRate: clockRate,
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
extern void goHandlePipelineBuffer(void *buffer, int bufferLen, int samples, int pipelineId);
|
||||
|
||||
GstElement *gstreamer_send_create_pipeline(char *pipeline);
|
||||
|
||||
void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId);
|
||||
void gstreamer_send_play_pipeline(GstElement *pipeline);
|
||||
void gstreamer_send_stop_pipeline(GstElement *pipeline);
|
||||
|
Loading…
Reference in New Issue
Block a user