# HG changeset patch # User michael # Date 1216943024 0 # Node ID f9e70983fc3566047bc755065011a683e7db36fa # Parent 16a60b2f7a7dc005e9ea62504264ff018f41bb72 Set field_poc (it was half uninitialized before) and use it instead of the fragile first_field check to determine if we have 2 fields at the end. diff -r 16a60b2f7a7d -r f9e70983fc35 h264.c --- a/h264.c Thu Jul 24 22:29:38 2008 +0000 +++ b/h264.c Thu Jul 24 23:43:44 2008 +0000 @@ -2264,6 +2264,10 @@ // mark frames as reference later "naturally". if(s->codec_id != CODEC_ID_SVQ3) s->current_picture_ptr->reference= 0; + + s->current_picture_ptr->field_poc[0]= + s->current_picture_ptr->field_poc[1]= INT_MAX; + return 0; } @@ -3698,6 +3702,7 @@ MpegEncContext * const s = &h->s; const int max_frame_num= 1<sps.log2_max_frame_num; int field_poc[2]; + Picture *cur = s->current_picture_ptr; h->frame_num_offset= h->prev_frame_num_offset; if(h->frame_num < h->prev_frame_num) @@ -3761,18 +3766,11 @@ field_poc[1]= poc; } - if(s->picture_structure != PICT_BOTTOM_FIELD) { + if(s->picture_structure != PICT_BOTTOM_FIELD) s->current_picture_ptr->field_poc[0]= field_poc[0]; - s->current_picture_ptr->poc = field_poc[0]; - } - if(s->picture_structure != PICT_TOP_FIELD) { + if(s->picture_structure != PICT_TOP_FIELD) s->current_picture_ptr->field_poc[1]= field_poc[1]; - s->current_picture_ptr->poc = field_poc[1]; - } - if(!FIELD_PICTURE || !s->first_field) { - Picture *cur = s->current_picture_ptr; - cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]); - } + cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]); return 0; } @@ -7877,7 +7875,7 @@ MPV_frame_end(s); - if (s->first_field) { + if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) { /* Wait for second field. */ *data_size = 0;