Originally committed as revision 16057 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -47,16 +47,16 @@ int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){ | |||||
| return ((lsb - delta)&mask) + delta; | return ((lsb - delta)&mask) + delta; | ||||
| } | } | ||||
| int ff_nut_sp_pos_cmp(syncpoint_t *a, syncpoint_t *b){ | |||||
| int ff_nut_sp_pos_cmp(Syncpoint *a, Syncpoint *b){ | |||||
| return ((a->pos - b->pos) >> 32) - ((b->pos - a->pos) >> 32); | return ((a->pos - b->pos) >> 32) - ((b->pos - a->pos) >> 32); | ||||
| } | } | ||||
| int ff_nut_sp_pts_cmp(syncpoint_t *a, syncpoint_t *b){ | |||||
| int ff_nut_sp_pts_cmp(Syncpoint *a, Syncpoint *b){ | |||||
| return ((a->ts - b->ts) >> 32) - ((b->ts - a->ts) >> 32); | 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){ | void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts){ | ||||
| syncpoint_t *sp= av_mallocz(sizeof(syncpoint_t)); | |||||
| Syncpoint *sp= av_mallocz(sizeof(Syncpoint)); | |||||
| struct AVTreeNode *node= av_mallocz(av_tree_node_size); | struct AVTreeNode *node= av_mallocz(av_tree_node_size); | ||||
| sp->pos= pos; | sp->pos= pos; | ||||
| @@ -50,14 +50,14 @@ typedef enum{ | |||||
| FLAG_MATCH_TIME =2048, ///<If set, match_time_delta is coded in the frame header | FLAG_MATCH_TIME =2048, ///<If set, match_time_delta is coded in the frame header | ||||
| FLAG_CODED =4096, ///<if set, coded_flags are stored in the frame header | FLAG_CODED =4096, ///<if set, coded_flags are stored in the frame header | ||||
| FLAG_INVALID =8192, ///<if set, frame_code is invalid | FLAG_INVALID =8192, ///<if set, frame_code is invalid | ||||
| }flag_t; | |||||
| } Flag; | |||||
| typedef struct { | typedef struct { | ||||
| uint64_t pos; | uint64_t pos; | ||||
| uint64_t back_ptr; | uint64_t back_ptr; | ||||
| // uint64_t global_key_pts; | // uint64_t global_key_pts; | ||||
| int64_t ts; | int64_t ts; | ||||
| } syncpoint_t; | |||||
| } Syncpoint; | |||||
| typedef struct { | typedef struct { | ||||
| uint16_t flags; | uint16_t flags; | ||||
| @@ -106,8 +106,8 @@ typedef struct { | |||||
| void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val); | void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val); | ||||
| int64_t ff_lsb2full(StreamContext *stream, int64_t lsb); | int64_t ff_lsb2full(StreamContext *stream, int64_t lsb); | ||||
| int ff_nut_sp_pos_cmp(syncpoint_t *a, syncpoint_t *b); | |||||
| int ff_nut_sp_pts_cmp(syncpoint_t *a, syncpoint_t *b); | |||||
| int ff_nut_sp_pos_cmp(Syncpoint *a, Syncpoint *b); | |||||
| int ff_nut_sp_pts_cmp(Syncpoint *a, Syncpoint *b); | |||||
| void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts); | void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts); | ||||
| extern const Dispositions ff_nut_dispositions[]; | extern const Dispositions ff_nut_dispositions[]; | ||||
| @@ -846,9 +846,9 @@ assert(0); | |||||
| static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags){ | static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags){ | ||||
| NUTContext *nut = s->priv_data; | NUTContext *nut = s->priv_data; | ||||
| AVStream *st= s->streams[stream_index]; | AVStream *st= s->streams[stream_index]; | ||||
| syncpoint_t dummy={.ts= pts*av_q2d(st->time_base)*AV_TIME_BASE}; | |||||
| syncpoint_t nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE}; | |||||
| syncpoint_t *sp, *next_node[2]= {&nopts_sp, &nopts_sp}; | |||||
| Syncpoint dummy={.ts= pts*av_q2d(st->time_base)*AV_TIME_BASE}; | |||||
| Syncpoint nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE}; | |||||
| Syncpoint *sp, *next_node[2]= {&nopts_sp, &nopts_sp}; | |||||
| int64_t pos, pos2, ts; | int64_t pos, pos2, ts; | ||||
| int i; | int i; | ||||
| @@ -260,7 +260,7 @@ static void put_v(ByteIOContext *bc, uint64_t val){ | |||||
| put_byte(bc, val&127); | put_byte(bc, val&127); | ||||
| } | } | ||||
| static void put_t(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){ | |||||
| static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){ | |||||
| val *= nut->time_base_count; | val *= nut->time_base_count; | ||||
| val += nus->time_base - nut->time_base; | val += nus->time_base - nut->time_base; | ||||
| put_v(bc, val); | put_v(bc, val); | ||||
| @@ -664,7 +664,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ | |||||
| //FIXME: Ensure store_sp is 1 in the first place. | //FIXME: Ensure store_sp is 1 in the first place. | ||||
| if(store_sp){ | if(store_sp){ | ||||
| syncpoint_t *sp, dummy= {.pos= INT64_MAX}; | |||||
| Syncpoint *sp, dummy= {.pos= INT64_MAX}; | |||||
| ff_nut_reset_ts(nut, *nus->time_base, pkt->dts); | ff_nut_reset_ts(nut, *nus->time_base, pkt->dts); | ||||
| for(i=0; i<s->nb_streams; i++){ | for(i=0; i<s->nb_streams; i++){ | ||||
| @@ -684,7 +684,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ | |||||
| ret = url_open_dyn_buf(&dyn_bc); | ret = url_open_dyn_buf(&dyn_bc); | ||||
| if(ret < 0) | if(ret < 0) | ||||
| return ret; | return ret; | ||||
| put_t(nut, nus, dyn_bc, pkt->dts); | |||||
| put_tt(nut, nus, dyn_bc, pkt->dts); | |||||
| put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0); | put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0); | ||||
| put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE); | put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE); | ||||