Mercurial > libavcodec.hg
comparison parser.c @ 6984:22a3d9efb4a2 libavcodec
Add off argument so that fetch_timestamp can search for timestamps
not associated with the first byte of access units.
author | michael |
---|---|
date | Mon, 02 Jun 2008 13:09:56 +0000 |
parents | 29a10e3232d8 |
children | 7c8df4f99d08 |
comparison
equal
deleted
inserted
replaced
6983:29a10e3232d8 | 6984:22a3d9efb4a2 |
---|---|
74 s->fetch_timestamp=1; | 74 s->fetch_timestamp=1; |
75 s->pict_type = FF_I_TYPE; | 75 s->pict_type = FF_I_TYPE; |
76 return s; | 76 return s; |
77 } | 77 } |
78 | 78 |
79 void ff_fetch_timestamp(AVCodecParserContext *s){ | 79 void ff_fetch_timestamp(AVCodecParserContext *s, int off){ |
80 int i; | 80 int i; |
81 s->dts= s->pts= AV_NOPTS_VALUE; | 81 s->dts= s->pts= AV_NOPTS_VALUE; |
82 s->offset= 0; | 82 s->offset= 0; |
83 for(i = 0; i < AV_PARSER_PTS_NB; i++) { | 83 for(i = 0; i < AV_PARSER_PTS_NB; i++) { |
84 if ( s->next_frame_offset >= s->cur_frame_offset[i] | 84 if ( s->next_frame_offset + off >= s->cur_frame_offset[i] |
85 &&(s-> frame_offset < s->cur_frame_offset[i] || !s->frame_offset) | 85 &&(s-> frame_offset < s->cur_frame_offset[i] || !s->frame_offset) |
86 && s->next_frame_offset < s->cur_frame_end[i]){ | 86 && s->next_frame_offset + off < s->cur_frame_end[i]){ |
87 s->dts= s->cur_frame_dts[i]; | 87 s->dts= s->cur_frame_dts[i]; |
88 s->pts= s->cur_frame_pts[i]; | 88 s->pts= s->cur_frame_pts[i]; |
89 s->offset = s->next_frame_offset - s->cur_frame_offset[i]; | 89 s->offset = s->next_frame_offset - s->cur_frame_offset[i]; |
90 } | 90 } |
91 } | 91 } |
140 | 140 |
141 if (s->fetch_timestamp){ | 141 if (s->fetch_timestamp){ |
142 s->fetch_timestamp=0; | 142 s->fetch_timestamp=0; |
143 s->last_pts = s->pts; | 143 s->last_pts = s->pts; |
144 s->last_dts = s->dts; | 144 s->last_dts = s->dts; |
145 ff_fetch_timestamp(s); | 145 ff_fetch_timestamp(s, 0); |
146 } | 146 } |
147 | 147 |
148 /* WARNING: the returned index can be negative */ | 148 /* WARNING: the returned index can be negative */ |
149 index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size); | 149 index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size); |
150 //av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id); | 150 //av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id); |