Revision 0a63a676 libavformat/avc.c

View differences:

libavformat/avc.c
60 60
    return end + 3;
61 61
}
62 62

  
63
int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size)
63
void ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
64 64
{
65
    ByteIOContext *pb;
66 65
    const uint8_t *p = buf_in;
67
    const uint8_t *end = p + *size;
66
    const uint8_t *end = p + size;
68 67
    const uint8_t *nal_start, *nal_end;
69
    int ret = url_open_dyn_buf(&pb);
70
    if(ret < 0)
71
        return ret;
72 68

  
73 69
    nal_start = ff_avc_find_startcode(p, end);
74 70
    while (nal_start < end) {
......
78 74
        put_buffer(pb, nal_start, nal_end - nal_start);
79 75
        nal_start = nal_end;
80 76
    }
77
}
78

  
79
static int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
80
{
81
    ByteIOContext *pb;
82
    int ret = url_open_dyn_buf(&pb);
83
    if(ret < 0)
84
        return ret;
85

  
86
    ff_avc_parse_nal_units(pb, buf_in, *size);
87

  
81 88
    av_freep(buf);
82 89
    *size = url_close_dyn_buf(pb, buf);
83 90
    return 0;
......
92 99
            uint32_t sps_size=0, pps_size=0;
93 100
            uint8_t *sps=0, *pps=0;
94 101

  
95
            int ret = ff_avc_parse_nal_units(data, &buf, &len);
102
            int ret = ff_avc_parse_nal_units_buf(data, &buf, &len);
96 103
            if (ret < 0)
97 104
                return ret;
98 105
            start = buf;

Also available in: Unified diff