Skip to content

Commit

Permalink
upipe_rtp_prepend: infer property from flow def
Browse files Browse the repository at this point in the history
Use input flow def to infer RTP type, clockrate and timestamp sync
clock.
  • Loading branch information
quarium committed May 7, 2015
1 parent c48a685 commit 148802f
Show file tree
Hide file tree
Showing 2 changed files with 302 additions and 78 deletions.
70 changes: 55 additions & 15 deletions include/upipe-modules/upipe_rtp_prepend.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ extern "C" {
enum upipe_rtp_prepend_command {
UPIPE_RTP_PREPEND_SENTINEL = UPIPE_CONTROL_LOCAL,

/** set rtp type/clockrate (uint8_t, uint32_t) */
/** set rtp type/clockrate (uint8_t) */
UPIPE_RTP_PREPEND_SET_TYPE,
/** set rtp type/clockrate (uint8_t*, uint32_t*) */
/** set rtp type/clockrate (uint8_t*) */
UPIPE_RTP_PREPEND_GET_TYPE,
/** set rtp timestamp sync (enum upipe_rtp_prepend_ts_sync) */
/** overwrite rtp clock rate (uint32_t) */
UPIPE_RTP_PREPEND_SET_CLOCKRATE,
/** get current rtp clock rate value (uint32_t*) */
UPIPE_RTP_PREPEND_GET_CLOCKRATE,
/** overwrite rtp timestamp sync (enum upipe_rtp_prepend_ts_sync) */
UPIPE_RTP_PREPEND_SET_TS_SYNC,
/** get rtp timestamp sync (enum upipe_rtp_prepend_ts_sync *) */
UPIPE_RTP_PREPEND_GET_TS_SYNC,
Expand All @@ -58,39 +62,69 @@ enum upipe_rtp_prepend_command {
*
* @param upipe description structure of the pipe
* @param type_p rtp type
* @param clockrate_p rtp timestamp clock rate
* @return an error code
*/
static inline int upipe_rtp_prepend_get_type(struct upipe *upipe,
uint8_t *type_p,
uint32_t *clockrate_p)
uint8_t *type_p)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_GET_TYPE,
UPIPE_RTP_PREPEND_SIGNATURE, type_p, clockrate_p);
UPIPE_RTP_PREPEND_SIGNATURE, type_p);
}

/** @This sets the RTP type.
*
* @param upipe description structure of the pipe
* @param type rtp payload type
* @param clockrate rtp timestamp and clock rate (optional, set
* according to rfc 3551 if null)
* @return an error code
*/
static inline int upipe_rtp_prepend_set_type(struct upipe *upipe,
uint8_t type,
uint32_t clockrate)
uint8_t type)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_SET_TYPE,
UPIPE_RTP_PREPEND_SIGNATURE, type, clockrate);
UPIPE_RTP_PREPEND_SIGNATURE, type);
}

/** @This overwrite the RTP clock rate value.
*
* @param upipe description structure of the pipe
* @param clockrate rtp timestamp and clock rate (optional, set
* according to rfc 3551 if null)
* @return an error code
*/
static inline int upipe_rtp_prepend_set_clockrate(struct upipe *upipe,
uint32_t clockrate)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_SET_CLOCKRATE,
UPIPE_RTP_PREPEND_SIGNATURE, clockrate);
}

/** @This get the current RTP clock rate value.
*
* @param upipe description structure of the pipe
* @param clockrate_p rtp clock rate value
* @return an error code
*/
static inline int upipe_rtp_prepend_get_clockrate(struct upipe *upipe,
uint32_t *clockrate_p)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_GET_CLOCKRATE,
UPIPE_RTP_PREPEND_SIGNATURE, clockrate_p);
}

/** @This timestamps sync clock values. */
enum upipe_rtp_prepend_ts_sync {
UPIPE_RTP_PREPEND_TS_SYNC_AUTO,
/** timestamps sync on cr clock */
UPIPE_RTP_PREPEND_TS_SYNC_CR,
/** timestamps sync on pts clock */
UPIPE_RTP_PREPEND_TS_SYNC_PTS,
};

/** @This overwrite the timestamps sync clock.
*
* @param upipe description structure of the pipe
* @param sync timestamp sync clock
* @return an error code
*/
static inline int
upipe_rtp_prepend_set_ts_sync(struct upipe *upipe,
enum upipe_rtp_prepend_ts_sync sync)
Expand All @@ -99,12 +133,18 @@ upipe_rtp_prepend_set_ts_sync(struct upipe *upipe,
UPIPE_RTP_PREPEND_SIGNATURE, sync);
}

/** @This get the current timestamps sync clock.
*
* @param upipe description structure of the pipe
* @param sync_p current timestamps sync clock
* @return an error code
*/
static inline int
upipe_rtp_prepend_get_ts_sync(struct upipe *upipe,
enum upipe_rtp_prepend_ts_sync *sync)
enum upipe_rtp_prepend_ts_sync *sync_p)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_GET_TS_SYNC,
UPIPE_RTP_PREPEND_SIGNATURE, sync);
UPIPE_RTP_PREPEND_SIGNATURE, sync_p);
}

/** @This returns the management structure for rtp_prepend pipes.
Expand Down
Loading

0 comments on commit 148802f

Please sign in to comment.