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

upipe_rtp_prepend: support timestamp sync on pts #19

Merged
merged 3 commits into from
May 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 77 additions & 11 deletions include/upipe-modules/upipe_rtp_prepend.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,41 +44,107 @@ 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,
/** 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,
};

/** @This returns the configured RTP type.
*
* @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 {
/** 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)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_SET_TS_SYNC,
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_p)
{
return upipe_control(upipe, UPIPE_RTP_PREPEND_GET_TS_SYNC,
UPIPE_RTP_PREPEND_SIGNATURE, sync_p);
}

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