Skip to content

Commit

Permalink
util: extra safety checks
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information
felipec committed Nov 9, 2012
1 parent 9e47242 commit 9caca46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util.c
Expand Up @@ -16,11 +16,15 @@
int64_t gstav_timestamp_to_pts(AVCodecContext *ctx, int64_t ts)
{
AVRational bq = { 1, GST_SECOND * ctx->ticks_per_frame };
if (ts == -1)
return AV_NOPTS_VALUE;
return av_rescale_q(ts, bq, ctx->time_base);
}

int64_t gstav_pts_to_timestamp(AVCodecContext *ctx, int64_t pts)
{
AVRational bq = { 1, GST_SECOND * ctx->ticks_per_frame };
if (pts == (int64_t) AV_NOPTS_VALUE)
return -1;
return av_rescale_q(pts, ctx->time_base, bq);
}

0 comments on commit 9caca46

Please sign in to comment.