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

Fix: replicate gst_sample_get_buffer{,list} returns NULL semantic #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 9, 2022

  1. Fix: replicate gst_sample_get_buffer{,list} returns NULL semantic

    gst_sample_get_buffer{,list} returns NULL if a buffer{,list} has
    not been set.  Previous go-gst behaviour wrapped this NULL pointer
    in the respective go-gst proxy object.
    
    This causes a problem with AppSink when one needs to disambiguate
    between whether a GstSample contains a GstBufferList, a GstBuffer
    or indeed nothing at all.  For example:
    
    ```
    sink := app.SinkFromElement(element)
    sink.SetBufferListSupport(true)
    sink.SetCallbacks(&app.SinkCallbacks{
    	NewSampleFunc: func(sink *app.Sink) gst.FlowReturn {
    		if sample := sink.PullSample(); sample == nil {
    			return gst.FlowEOS
    		} else if bufferList := sample.GetBufferList(); bufferList != nil {
    			// consume bufferlist
    			return gst.FlowOK
    		} else if buffer := sample.GetBuffer(); buffer != nil {
    			// consume buffer
    			return gst.FlowOK
    		} else {
    			return gst.FlowError
    		}
    	},
    })
    ```
    Atish Nazir committed Sep 9, 2022
    Configuration menu
    Copy the full SHA
    871f360 View commit details
    Browse the repository at this point in the history