mirror of
https://github.com/notedit/gst.git
synced 2025-10-04 07:46:28 +08:00
Expose GstBuffer timing values
This commit is contained in:
@@ -182,10 +182,16 @@ func (e *Element) PullSample() (sample *Sample, err error) {
|
|||||||
copy(data, CData[:])
|
copy(data, CData[:])
|
||||||
|
|
||||||
duration := uint64(C.X_gst_buffer_get_duration(gstBuffer))
|
duration := uint64(C.X_gst_buffer_get_duration(gstBuffer))
|
||||||
|
pts := uint64(C.X_gst_buffer_get_pts(gstBuffer))
|
||||||
|
dts := uint64(C.X_gst_buffer_get_dts(gstBuffer))
|
||||||
|
offset := uint64(C.X_gst_buffer_get_offset(gstBuffer))
|
||||||
|
|
||||||
sample = &Sample{
|
sample = &Sample{
|
||||||
Data: data,
|
Data: data,
|
||||||
Duration: duration,
|
Duration: duration,
|
||||||
|
Pts: pts,
|
||||||
|
Dts: dts,
|
||||||
|
Offset: offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
C.gst_buffer_unmap(gstBuffer, mapInfo)
|
C.gst_buffer_unmap(gstBuffer, mapInfo)
|
||||||
|
13
gst.c
13
gst.c
@@ -210,6 +210,19 @@ GstClockTime X_gst_buffer_get_duration(GstBuffer* buffer) {
|
|||||||
return GST_BUFFER_DURATION(buffer);
|
return GST_BUFFER_DURATION(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GstClockTime X_gst_buffer_get_pts(GstBuffer* buffer) {
|
||||||
|
return GST_BUFFER_PTS(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
GstClockTime X_gst_buffer_get_dts(GstBuffer* buffer) {
|
||||||
|
return GST_BUFFER_DTS(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
GstClockTime X_gst_buffer_get_offset(GstBuffer* buffer) {
|
||||||
|
return GST_BUFFER_OFFSET(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
gchar* X_gst_pad_get_name(GstPad* pad) {
|
gchar* X_gst_pad_get_name(GstPad* pad) {
|
||||||
return gst_pad_get_name(pad);
|
return gst_pad_get_name(pad);
|
||||||
}
|
}
|
||||||
|
3
gst.go
3
gst.go
@@ -18,6 +18,9 @@ func init() {
|
|||||||
type Sample struct {
|
type Sample struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
Duration uint64
|
Duration uint64
|
||||||
|
Pts uint64
|
||||||
|
Dts uint64
|
||||||
|
Offset uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckPlugins(plugins []string) error {
|
func CheckPlugins(plugins []string) error {
|
||||||
|
4
gst.h
4
gst.h
@@ -53,6 +53,10 @@ extern void X_gst_pipeline_set_latency(GstElement* element, GstClockTime clockTi
|
|||||||
extern GstFlowReturn X_gst_app_src_push_buffer(GstElement* element, void *buffer,int len);
|
extern GstFlowReturn X_gst_app_src_push_buffer(GstElement* element, void *buffer,int len);
|
||||||
extern GstClockTime X_gst_buffer_get_duration(GstBuffer* buffer);
|
extern GstClockTime X_gst_buffer_get_duration(GstBuffer* buffer);
|
||||||
|
|
||||||
|
extern GstClockTime X_gst_buffer_get_pts(GstBuffer* buffer);
|
||||||
|
extern GstClockTime X_gst_buffer_get_dts(GstBuffer* buffer);
|
||||||
|
extern GstClockTime X_gst_buffer_get_offset(GstBuffer* buffer);
|
||||||
|
|
||||||
extern gchar* X_gst_pad_get_name(GstPad* pad);
|
extern gchar* X_gst_pad_get_name(GstPad* pad);
|
||||||
extern void cb_bus_message(GstBus * bus, GstMessage * message, gpointer poll_data);
|
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);
|
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);
|
||||||
|
Reference in New Issue
Block a user