Mercurial > libavcodec.hg
comparison parser.c @ 6985:7c8df4f99d08 libavcodec
Allow matching timestamps to be removed by fetch_timestamp().
| author | michael |
|---|---|
| date | Mon, 02 Jun 2008 13:12:54 +0000 |
| parents | 22a3d9efb4a2 |
| children | 6ef755b234c2 |
comparison
equal
deleted
inserted
replaced
| 6984:22a3d9efb4a2 | 6985:7c8df4f99d08 |
|---|---|
| 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, int off){ | 79 void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){ |
| 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 + off >= 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 + off < 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 if(remove) | |
| 91 s->cur_frame_offset[i]= INT64_MAX; | |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 } | 94 } |
| 93 | 95 |
| 94 /** | 96 /** |
| 140 | 142 |
| 141 if (s->fetch_timestamp){ | 143 if (s->fetch_timestamp){ |
| 142 s->fetch_timestamp=0; | 144 s->fetch_timestamp=0; |
| 143 s->last_pts = s->pts; | 145 s->last_pts = s->pts; |
| 144 s->last_dts = s->dts; | 146 s->last_dts = s->dts; |
| 145 ff_fetch_timestamp(s, 0); | 147 ff_fetch_timestamp(s, 0, 0); |
| 146 } | 148 } |
| 147 | 149 |
| 148 /* WARNING: the returned index can be negative */ | 150 /* WARNING: the returned index can be negative */ |
| 149 index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size); | 151 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); | 152 //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); |
