Revision 66e9e302

View differences:

libavformat/mpeg.c
120 120

  
121 121
static int64_t get_pts(ByteIOContext *pb, int c)
122 122
{
123
    int64_t pts;
124
    int val;
125

  
126
    if (c < 0)
127
        c = get_byte(pb);
128
    pts = (int64_t)(c & 0x0e) << 29;
129
    val = get_be16(pb);
130
    pts |= (int64_t)(val >> 1) << 15;
131
    val = get_be16(pb);
132
    pts |= (int64_t)(val >> 1);
133
    return pts;
123
    uint8_t buf[5];
124

  
125
    buf[0] = c<0 ? get_byte(pb) : c;
126
    get_buffer(pb, buf+1, 4);
127

  
128
    return ff_parse_pes_pts(buf);
134 129
}
135 130

  
136 131
static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
libavformat/mpeg.h
57 57

  
58 58
static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
59 59

  
60
/**
61
 * Parse MPEG-PES five-byte timestamp
62
 */
63
static inline int64_t ff_parse_pes_pts(uint8_t *buf) {
64
    return (int64_t)(*buf & 0x0e) << 29 |
65
            (AV_RB16(buf+1) >> 1) << 15 |
66
             AV_RB16(buf+3) >> 1;
67
}
68

  
60 69
#endif /* FFMPEG_MPEG_H */

Also available in: Unified diff