Mercurial > libavcodec.hg
comparison mpegvideo.c @ 2427:d1b1a6258930 libavcodec
10l (dont modify the input picture pts)
author | michael |
---|---|
date | Thu, 13 Jan 2005 11:59:19 +0000 |
parents | 1ee03f2a6cd5 |
children | 548c87c06dbb |
comparison
equal
deleted
inserted
replaced
2426:1ee03f2a6cd5 | 2427:d1b1a6258930 |
---|---|
1954 } | 1954 } |
1955 | 1955 |
1956 | 1956 |
1957 static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ | 1957 static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ |
1958 AVFrame *pic=NULL; | 1958 AVFrame *pic=NULL; |
1959 int64_t pts; | |
1959 int i; | 1960 int i; |
1960 const int encoding_delay= s->max_b_frames; | 1961 const int encoding_delay= s->max_b_frames; |
1961 int direct=1; | 1962 int direct=1; |
1962 | 1963 |
1963 if(pic_arg){ | 1964 if(pic_arg){ |
1964 if(pic_arg->pts != AV_NOPTS_VALUE){ | 1965 pts= pic_arg->pts; |
1966 pic_arg->display_picture_number= s->input_picture_number++; | |
1967 | |
1968 if(pts != AV_NOPTS_VALUE){ | |
1965 if(s->user_specified_pts != AV_NOPTS_VALUE){ | 1969 if(s->user_specified_pts != AV_NOPTS_VALUE){ |
1966 int64_t time= av_rescale(pic_arg->pts, s->avctx->frame_rate, s->avctx->frame_rate_base*(int64_t)AV_TIME_BASE); | 1970 int64_t time= av_rescale(pts, s->avctx->frame_rate, s->avctx->frame_rate_base*(int64_t)AV_TIME_BASE); |
1967 int64_t last= av_rescale(s->user_specified_pts, s->avctx->frame_rate, s->avctx->frame_rate_base*(int64_t)AV_TIME_BASE); | 1971 int64_t last= av_rescale(s->user_specified_pts, s->avctx->frame_rate, s->avctx->frame_rate_base*(int64_t)AV_TIME_BASE); |
1968 | 1972 |
1969 if(time <= last){ | 1973 if(time <= last){ |
1970 av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%Ld, last=%Ld\n", pic_arg->pts, s->user_specified_pts); | 1974 av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%Ld, last=%Ld\n", pts, s->user_specified_pts); |
1971 return -1; | 1975 return -1; |
1972 } | 1976 } |
1973 } | 1977 } |
1974 s->user_specified_pts= pic_arg->pts; | 1978 s->user_specified_pts= pts; |
1975 }else{ | 1979 }else{ |
1976 if(s->user_specified_pts != AV_NOPTS_VALUE){ | 1980 if(s->user_specified_pts != AV_NOPTS_VALUE){ |
1977 s->user_specified_pts= | 1981 s->user_specified_pts= |
1978 pic_arg->pts= s->user_specified_pts + AV_TIME_BASE*(int64_t)s->avctx->frame_rate_base / s->avctx->frame_rate; | 1982 pts= s->user_specified_pts + AV_TIME_BASE*(int64_t)s->avctx->frame_rate_base / s->avctx->frame_rate; |
1979 av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%Ld)\n", pic_arg->pts); | 1983 av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%Ld)\n", pts); |
1980 }else{ | 1984 }else{ |
1981 pic_arg->pts= av_rescale(pic_arg->display_picture_number*(int64_t)s->avctx->frame_rate_base, AV_TIME_BASE, s->avctx->frame_rate); | 1985 pts= av_rescale(pic_arg->display_picture_number*(int64_t)s->avctx->frame_rate_base, AV_TIME_BASE, s->avctx->frame_rate); |
1982 } | 1986 } |
1983 } | 1987 } |
1984 } | 1988 } |
1985 | 1989 |
1986 if(pic_arg){ | 1990 if(pic_arg){ |
2040 } | 2044 } |
2041 } | 2045 } |
2042 } | 2046 } |
2043 } | 2047 } |
2044 copy_picture_attributes(s, pic, pic_arg); | 2048 copy_picture_attributes(s, pic, pic_arg); |
2045 | 2049 pic->pts= pts; //we set this here to avoid modifiying pic_arg |
2046 pic->display_picture_number= s->input_picture_number++; | |
2047 | |
2048 } | 2050 } |
2049 | 2051 |
2050 /* shift buffer entries */ | 2052 /* shift buffer entries */ |
2051 for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++) | 2053 for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++) |
2052 s->input_picture[i-1]= s->input_picture[i]; | 2054 s->input_picture[i-1]= s->input_picture[i]; |