Skip to content

va: va: Handle input caps change (and other fixes)

    va: Handle input caps change
    
    Update output caps if it's notified by baseclass
    
    See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328
    vaav1dec: Use new vabasedec logic.
    
    Even that vaav1dec doesn't use vabasedec negotiate vmethod, it should align with
    the new scheme of using base's width & height for surface size and output_info
    structure for downstream display size negotiation.
    vavp9dec: Use gst_va_base_dec_set_output_state().
    
    As this element reopen the internal decoder differently, it only uses the helper
    function to negotiate.
    vampeg2dec: Streams are progressive by default.
    
    By initializating progressive, then interlaced streams are detected correctly.
    va: Add and use common decode negotiate vmethod.
    
    This vmethod can be used by decoders with the same VA decoder reopen logic:
    same profile, chroma, width and height.
    
    Also a new public method called gst_va_base_dec_set_output_state() with the
    common GStreamer code for setting the output state, which is always called by
    the negotiate vmethod.
    
    In order to do this refactoring, new variables in vabasedec have to be populated
    by the decoders:
    
    * width and height define the resolution set in VA decoder. In the case of H264
      would be de coded_width and codec_height, or max_width and max_height in AV1.
    * output_info is the downstream video info used for negotiation in
      gst_va_base_dec_set_output_state().
    * input_state, from codec parent class shall be also held by vabasedec
    vaav1dec: Use gst_va_base_dec_prepare_output_frame().
    
    And simplify a bit the code flow.
    va: Add and use gst_va_base_dec_prepare_output_frame().
    
    This helper will do downstream negotiation and later will
    allocate the output frame.
    
    H265 and AV1 decoders don't use this approach since their output
    frame allocation is different.
    va: Remove last_ret error handling in decoders.
    
    It was used in the early development of the base classes. Now it
    shouldn't be needed.
    va: Add and use gst_va_base_dec_output_picture().
    
    This function will copy the frame if needed and apply the buffer
    flags.
    
    The function is used by all the decoders.

cc: @He_Junyan, @seungha.yang, @ndufresne

Merge request reports