diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-08-09 23:24:02 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-08-09 23:24:02 +0000 |
commit | 4a3b5fe16afdce332eb0a78375da3591c4d5acb3 (patch) | |
tree | 18f2341b7cc959b890787c1e45e7552c9b9755c3 /libavformat/nut.c | |
parent | 073811cdd29e365498b3455ee4e0eda4b957a957 (diff) | |
download | ffmpeg-4a3b5fe16afdce332eb0a78375da3591c4d5acb3.tar.gz |
move syncpoint cache related stuff to common file
Originally committed as revision 10038 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/nut.c')
-rw-r--r-- | libavformat/nut.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavformat/nut.c b/libavformat/nut.c index 91509afbd8..4b41a05f33 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -42,3 +42,21 @@ int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){ return ((lsb - delta)&mask) + delta; } +int ff_nut_sp_pos_cmp(syncpoint_t *a, syncpoint_t *b){ + return (a->pos - b->pos>>32) - (b->pos - a->pos>>32); +} + +int ff_nut_sp_pts_cmp(syncpoint_t *a, syncpoint_t *b){ + return (a->ts - b->ts>>32) - (b->ts - a->ts>>32); +} + +void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts){ + syncpoint_t *sp2, *sp= av_mallocz(sizeof(syncpoint_t)); + + sp->pos= pos; + sp->back_ptr= back_ptr; + sp->ts= ts; + sp2= av_tree_insert(&nut->syncpoints, sp, ff_nut_sp_pos_cmp); + if(sp2 && sp2 != sp) + av_free(sp); +} |