upipe/upipe_helper_input.h header reference

Upipe helper functions for input More

Header inclusion  

Members  

Macro  

Description  

It allows to block a source pump, and to bufferize incoming urefs.

Members detail  

#define UPIPE_HELPER_INPUT(STRUCTURE, UREFS, NB_UREFS, MAX_UREFS, BLOCKERS, OUTPUT)  

This macro is declared in upipe/upipe_helper_input.h source file, line 150.

This macro declares nine functions helping a pipe to block source pumps, and to hold urefs that can't be immediately output.

You must add four members to your private upipe structure, for instance:

struct uchain urefs;
unsigned int nb_urefs;
unsigned int max_urefs;
struct uchain blockers;

You must also declare UPIPE_HELPER_UPIPE prior to using this macro.

Supposing the name of your structure is upipe_foo, it declares:

  • void upipe_foo_init_input(struct upipe *upipe)

    Typically called in your upipe_foo_alloc() function.

  • void upipe_foo_block_input_cb(struct upump_blocker *blocker)

    Used internally as the callback of the blocker, called when the source pump is released.

  • void upipe_foo_block_input(struct upipe *upipe, struct upump **upump_p)

    Called when you need to block a source pump.

  • void upipe_foo_unblock_input(struct upipe *upipe)

    Called when you want to restart the source pump(s).

  • bool upipe_foo_check_input(struct upipe *upipe)

    Returns true if no uref has been held.

  • void upipe_foo_hold_input(struct upipe *upipe, struct uref *uref)

    Holds the given uref that can't be immediately output.

  • struct uref *upipe_foo_pop_input(struct upipe *upipe)

    Returns the first buffered uref.

  • void upipe_foo_unshift_input(struct upipe *upipe, struct uref *uref)

    Pushes an uref back into the buffered urefs.

  • bool upipe_foo_output_input(struct upipe *upipe)

    Outputs urefs that have been held.

  • int upipe_foo_get_max_length(struct upipe *upipe, unsigned int *p)

    Typically called from your upipe_foo_control() handler, such as:

    case UPIPE_GET_MAX_LENGTH: {
    unsigned int *p = va_arg(args, unsigned int *);
    return upipe_foo_get_max_length(upipe, p);
    }
  • int upipe_foo_set_max_length(struct upipe *upipe, unsigned int max_length)

    Typically called from your upipe_foo_control() handler, such as:

    case UPIPE_SET_MAX_LENGTH: {
    unsigned int max_length = va_arg(args, unsigned int);
    return upipe_foo_set_max_length(upipe, max_length);
    }
  • void upipe_foo_clean_input(struct upipe *upipe)

    Free all urefs that have been held, and unblocks all pumps.

  • bool upipe_foo_flush_input(struct upipe *upipe)

    Free all urefs that have been held, unblocks all pumps, and reinitializes the input. Returns true if the input was previsouly blocked.

Parameter list:

  • STRUCTURE: name of your private upipe structure
  • UREFS: name of the struct uchain field of your private upipe structure, corresponding to a list of urefs
  • BLOCKERS: name of the struct uchain field of your private upipe structure, corresponding to a list of blockers
  • OUTPUT: function to use to output urefs (struct upipe *, struct uref *, struct upump **), returns false when the uref can't be written

#define _UPIPE_UPIPE_HELPER_INPUT_H_  

This macro is declared in upipe/upipe_helper_input.h source file, line 32.

Valid XHTML 1.0 StrictGenerated by cmassiot on Fri Feb 2 23:57:19 2018 using MkDoc