Mercurial > libavcodec.hg
comparison mpeg12.c @ 9908:a37ffec2074c libavcodec
Revert r19317, "simplify slice_end, return size of output frame".
It returns non decodable B-frames.
| author | bcoudurier |
|---|---|
| date | Wed, 01 Jul 2009 20:35:28 +0000 |
| parents | efd0c5014ac7 |
| children | 981143737752 |
comparison
equal
deleted
inserted
replaced
| 9907:2fb2e212318b | 9908:a37ffec2074c |
|---|---|
| 1933 return 0; //not reached | 1933 return 0; //not reached |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 /** | 1936 /** |
| 1937 * Handles slice ends. | 1937 * Handles slice ends. |
| 1938 * @return sizeof(AVFrame) if a frame is output, 0 otherwise | 1938 * @return 1 if it seems to be the last slice |
| 1939 */ | 1939 */ |
| 1940 static int slice_end(AVCodecContext *avctx, AVFrame *pict) | 1940 static int slice_end(AVCodecContext *avctx, AVFrame *pict) |
| 1941 { | 1941 { |
| 1942 Mpeg1Context *s1 = avctx->priv_data; | 1942 Mpeg1Context *s1 = avctx->priv_data; |
| 1943 MpegEncContext *s = &s1->mpeg_enc_ctx; | 1943 MpegEncContext *s = &s1->mpeg_enc_ctx; |
| 1964 MPV_frame_end(s); | 1964 MPV_frame_end(s); |
| 1965 | 1965 |
| 1966 if (s->pict_type == FF_B_TYPE || s->low_delay) { | 1966 if (s->pict_type == FF_B_TYPE || s->low_delay) { |
| 1967 *pict= *(AVFrame*)s->current_picture_ptr; | 1967 *pict= *(AVFrame*)s->current_picture_ptr; |
| 1968 ff_print_debug_info(s, pict); | 1968 ff_print_debug_info(s, pict); |
| 1969 return sizeof(*pict); | |
| 1970 } else { | 1969 } else { |
| 1971 s->picture_number++; | 1970 s->picture_number++; |
| 1972 /* latency of 1 frame for I- and P-frames */ | 1971 /* latency of 1 frame for I- and P-frames */ |
| 1973 /* XXX: use another variable than picture_number */ | 1972 /* XXX: use another variable than picture_number */ |
| 1974 if (s->last_picture_ptr != NULL) { | 1973 if (s->last_picture_ptr != NULL) { |
| 1975 *pict= *(AVFrame*)s->last_picture_ptr; | 1974 *pict= *(AVFrame*)s->last_picture_ptr; |
| 1976 ff_print_debug_info(s, pict); | 1975 ff_print_debug_info(s, pict); |
| 1977 return sizeof(*pict); | 1976 } |
| 1978 } | 1977 } |
| 1979 } | 1978 |
| 1980 } | 1979 return 1; |
| 1981 return 0; | 1980 } else { |
| 1981 return 0; | |
| 1982 } | |
| 1982 } | 1983 } |
| 1983 | 1984 |
| 1984 static int mpeg1_decode_sequence(AVCodecContext *avctx, | 1985 static int mpeg1_decode_sequence(AVCodecContext *avctx, |
| 1985 const uint8_t *buf, int buf_size) | 1986 const uint8_t *buf, int buf_size) |
| 1986 { | 1987 { |
| 2314 } | 2315 } |
| 2315 | 2316 |
| 2316 if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) | 2317 if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) |
| 2317 ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); | 2318 ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); |
| 2318 | 2319 |
| 2319 *data_size = slice_end(avctx, picture); | 2320 if (slice_end(avctx, picture)) { |
| 2321 if(s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice | |
| 2322 *data_size = sizeof(AVPicture); | |
| 2323 } | |
| 2320 } | 2324 } |
| 2321 s2->pict_type= 0; | 2325 s2->pict_type= 0; |
| 2322 return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); | 2326 return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); |
| 2323 } | 2327 } |
| 2324 | 2328 |
