mirror of
				https://github.com/notedit/gst.git
				synced 2025-10-31 19:42:34 +08:00 
			
		
		
		
	add more api
This commit is contained in:
		
							
								
								
									
										7
									
								
								clock.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								clock.go
									
									
									
									
									
								
							| @@ -14,4 +14,11 @@ type Clock struct { | ||||
| } | ||||
|  | ||||
|  | ||||
| func (c *Clock) GetClockTime() uint64  { | ||||
|  | ||||
| 	clocktime := C.gst_clock_get_time(c.C) | ||||
| 	return uint64(clocktime) | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -121,6 +121,12 @@ func (e *Element) AddPad(pad *Pad) bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| func (e *Element) GetClockBaseTime() uint64 { | ||||
|  | ||||
| 	CClockTime := C.gst_element_get_base_time(e.GstElement) | ||||
|  | ||||
| 	return uint64(CClockTime) | ||||
| } | ||||
|  | ||||
|  | ||||
| func (e *Element) GetClock() (gstClock *Clock) { | ||||
|   | ||||
							
								
								
									
										26
									
								
								gst.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								gst.c
									
									
									
									
									
								
							| @@ -68,13 +68,6 @@ void X_gst_g_object_setv(GObject *object, guint n_properties, const gchar *names | ||||
|   g_object_setv(object, n_properties, names, value); | ||||
| } | ||||
|  | ||||
| GstElement* cb_request_aux_receiver(GstElement *rtpbin, guint session, gpointer user_data) { | ||||
|   //return go_callback_request_aux_receiver_thunk(rtpbin, session, user_data); | ||||
| } | ||||
|  | ||||
| GstElement* cb_request_aux_sender(GstElement *rtpbin, guint session, gpointer user_data) { | ||||
|   //return go_callback_request_aux_sender_thunk(rtpbin, session, user_data); | ||||
| } | ||||
|  | ||||
| void cb_new_pad(GstElement *element, GstPad *pad, gpointer data) { | ||||
|   gchar *name; | ||||
| @@ -181,6 +174,25 @@ GstBus* X_gst_pipeline_get_bus(GstElement* element) { | ||||
| 	return gst_pipeline_get_bus(GST_PIPELINE(element)); | ||||
| } | ||||
|  | ||||
| GstClock * X_gst_pipeline_get_clock(GstElement* element) { | ||||
|   return gst_pipeline_get_clock(GST_PIPELINE(element)); | ||||
| } | ||||
|  | ||||
|  | ||||
| GstClockTime X_gst_pipeline_get_delay(GstElement* element) { | ||||
|   return gst_pipeline_get_delay(GST_PIPELINE(element)); | ||||
| } | ||||
|  | ||||
|  | ||||
| GstClockTime X_gst_pipeline_get_latency(GstElement* element) { | ||||
|   return gst_pipeline_get_latency(GST_PIPELINE(element)); | ||||
| } | ||||
|  | ||||
| void X_gst_pipeline_set_latency(GstElement* element, GstClockTime clockTime) { | ||||
|    | ||||
|   gst_pipeline_set_latency(GST_PIPELINE(element), clockTime); | ||||
| } | ||||
|  | ||||
| void cb_bus_message(GstBus * bus, GstMessage * message, gpointer poll_data) { | ||||
|   //go_callback_bus_message_thunk(bus, message, poll_data); | ||||
| } | ||||
|   | ||||
							
								
								
									
										8
									
								
								gst.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								gst.h
									
									
									
									
									
								
							| @@ -16,8 +16,6 @@ extern void X_gst_g_object_set(GstElement* e, const gchar* p_name, const GValue* | ||||
| extern void X_gst_g_object_set_structure(GstElement *e, const gchar* p_name, const GstStructure *p_value); | ||||
| extern void X_gst_g_object_setv(GObject* object, guint n_properties, const gchar* names[], const GValue value[]); | ||||
| extern void X_g_signal_connect(GstElement* element, gchar* detailed_signal, void (*f)(GstElement*, GstPad*, gpointer), gpointer data); | ||||
| extern GstElement* cb_request_aux_receiver(GstElement *rtpbin, guint session, gpointer user_data); | ||||
| extern GstElement* cb_request_aux_sender(GstElement *rtpbin, guint session, gpointer user_data); | ||||
| extern void cb_new_pad(GstElement* element, GstPad* pad, gpointer data); | ||||
| extern void cb_need_data(GstElement *element, guint size, gpointer data); | ||||
| extern void cb_enough_data(GstElement *element, gpointer data); | ||||
| @@ -37,5 +35,11 @@ extern void X_gst_structure_set_bool(GstStructure *structure, const gchar *name, | ||||
| extern GstEventType X_GST_EVENT_TYPE(GstEvent* event); | ||||
| extern GstMessageType X_GST_MESSAGE_TYPE(GstMessage *message); | ||||
| extern GstBus* X_gst_pipeline_get_bus(GstElement* element); | ||||
| extern GstClock * X_gst_pipeline_get_clock(GstElement* element); | ||||
| extern GstClockTime X_gst_pipeline_get_delay(GstElement* element); | ||||
| extern GstClockTime X_gst_pipeline_get_latency(GstElement* element); | ||||
| extern void X_gst_pipeline_set_latency(GstElement* element, GstClockTime clockTime); | ||||
|  | ||||
|  | ||||
| extern void cb_bus_message(GstBus * bus, GstMessage * message, gpointer poll_data); | ||||
| extern void X_g_signal_connect_data(gpointer instance, const gchar *detailed_signal, void (*f)(GstElement*, GstBus*, GstMessage*, gpointer), gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags); | ||||
|   | ||||
							
								
								
									
										43
									
								
								pipeline.go
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								pipeline.go
									
									
									
									
									
								
							| @@ -90,23 +90,40 @@ func (p *Pipeline) GetBus() (bus *Bus) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // func (p *GstPipeline) GetClock() (gstClock *GstClock) { | ||||
| func (p *Pipeline) GetClock() (clock *Clock) { | ||||
|  | ||||
| // 	CElementClock := C.gst_pipeline_get_clock(p.gstElement) | ||||
| 	CElementClock := C.X_gst_pipeline_get_clock(p.GstElement) | ||||
|  | ||||
| // 	gstClock = &GstClock{ | ||||
| // 		C: CElementClock, | ||||
| // 	} | ||||
| 	clock = &Clock{ | ||||
| 		C: CElementClock, | ||||
| 	} | ||||
|  | ||||
| // 	runtime.SetFinalizer(gstClock, func(gstClock *GstClock) { | ||||
| // 		C.gst_object_unref(C.gpointer(unsafe.Pointer(gstClock.C))) | ||||
| // 	}) | ||||
| 	runtime.SetFinalizer(clock, func(clock *Clock) { | ||||
| 		C.gst_object_unref(C.gpointer(unsafe.Pointer(clock.C))) | ||||
| 	}) | ||||
|  | ||||
| // 	return | ||||
| // } | ||||
| 	return | ||||
| } | ||||
|  | ||||
|  | ||||
| func (p *Pipeline) GetDelay() uint64 { | ||||
|  | ||||
| 	CClockTime := C.X_gst_pipeline_get_delay(p.GstElement) | ||||
| 	return uint64(CClockTime) | ||||
| } | ||||
|  | ||||
|  | ||||
| func (p *Pipeline) GetLatency() uint64 { | ||||
|  | ||||
| 	CClockTime := C.X_gst_pipeline_get_latency(p.GstElement) | ||||
| 	return uint64(CClockTime) | ||||
| } | ||||
|  | ||||
|  | ||||
| func (p *Pipeline) SetLatency(latency uint64) { | ||||
| 	 | ||||
| 	C.X_gst_pipeline_set_latency(p.GstElement,C.GstClockTime(latency)) | ||||
| } | ||||
|  | ||||
|  | ||||
| // TODO   | ||||
| // get/set delay  | ||||
| // get/set latency | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 notedit
					notedit