Revision 346db3ef

View differences:

libavcodec/avcodec.h
3005 3005
    int64_t next_frame_offset; /* offset of the next frame */
3006 3006
    /* video info */
3007 3007
    int pict_type; /* XXX: Put it back in AVCodecContext. */
3008
    /**
3009
     * This field is used for proper frame duration computation in lavf.
3010
     * It signals, how much longer the frame duration of the current frame
3011
     * is compared to normal frame duration.
3012
     *
3013
     * frame_duration = (2 + repeat_pict) / (2*fps)
3014
     *
3015
     * It is used by codecs like H.264 to display telecined material.
3016
     *
3017
     * @note This field can also be set to -1 for half-frame duration in case
3018
     *       of field pictures.
3019
     */
3008 3020
    int repeat_pict; /* XXX: Put it back in AVCodecContext. */
3009 3021
    int64_t pts;     /* pts of the current frame */
3010 3022
    int64_t dts;     /* dts of the current frame */
libavcodec/h264_parser.c
192 192
                }
193 193
            }
194 194

  
195
            if(h->sps.pic_struct_present_flag) {
196
                switch (h->sei_pic_struct) {
197
                    case SEI_PIC_STRUCT_TOP_FIELD:
198
                    case SEI_PIC_STRUCT_BOTTOM_FIELD:
199
                        s->repeat_pict = -1;
200
                        break;
201
                    case SEI_PIC_STRUCT_FRAME:
202
                    case SEI_PIC_STRUCT_TOP_BOTTOM:
203
                    case SEI_PIC_STRUCT_BOTTOM_TOP:
204
                        s->repeat_pict = 0;
205
                        break;
206
                    case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
207
                    case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
208
                        s->repeat_pict = 1;
209
                        break;
210
                    case SEI_PIC_STRUCT_FRAME_DOUBLING:
211
                        s->repeat_pict = 2;
212
                        break;
213
                    case SEI_PIC_STRUCT_FRAME_TRIPLING:
214
                        s->repeat_pict = 4;
215
                        break;
216
                    default:
217
                        s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 0 : -1;
218
                        break;
219
                }
220
            } else {
221
                s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 0 : -1;
222
            }
223

  
195 224
            return 0; /* no need to evaluate the rest */
196 225
        }
197 226
        buf += consumed;
libavformat/utils.c
680 680
            *pnum = st->codec->time_base.num;
681 681
            *pden = st->codec->time_base.den;
682 682
            if (pc && pc->repeat_pict) {
683
                // NOTE: repeat_pict can be also -1 for half-frame durations,
684
                // e.g., in H.264 interlaced field picture stream
683 685
                *pden *= 2;
684 686
                *pnum = (*pnum) * (2 + pc->repeat_pict);
685 687
            }

Also available in: Unified diff