Mercurial > libavformat.hg
changeset 2348:b995891375b2 libavformat
fix forw_ptr crc check
not really beautiful but i did not find a nice solution
note, untested
author | michael |
---|---|
date | Thu, 09 Aug 2007 21:35:13 +0000 |
parents | 5c32dd0eafc6 |
children | a9dc7596498a |
files | nutdec.c |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/nutdec.c Thu Aug 09 21:20:17 2007 +0000 +++ b/nutdec.c Thu Aug 09 21:35:13 2007 +0000 @@ -98,12 +98,15 @@ #define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #endif -static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum) +static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode) { int64_t size; // start= url_ftell(bc) - 8; - init_checksum(bc, av_crc04C11DB7_update, 0); + startcode= be2me_64(startcode); + startcode= av_crc04C11DB7_update(0, &startcode, 8); + + init_checksum(bc, av_crc04C11DB7_update, startcode); size= get_v(bc); if(size > 4096) get_be32(bc); @@ -194,7 +197,7 @@ unsigned int stream_count; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res; - end= get_packetheader(nut, bc, 1); + end= get_packetheader(nut, bc, 1, MAIN_STARTCODE); end += url_ftell(bc); GET_V(tmp , tmp >=2 && tmp <= 3) @@ -282,7 +285,7 @@ uint64_t tmp, end; AVStream *st; - end= get_packetheader(nut, bc, 1); + end= get_packetheader(nut, bc, 1, STREAM_STARTCODE); end += url_ftell(bc); GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base); @@ -369,7 +372,7 @@ int64_t value, end; char name[256], str_value[1024], type_str[256], *type= type_str; - end= get_packetheader(nut, bc, 1); + end= get_packetheader(nut, bc, 1, INFO_STARTCODE); end += url_ftell(bc); GET_V(stream_id_plus1, tmp <= s->nb_streams) @@ -445,7 +448,7 @@ nut->last_syncpoint_pos= url_ftell(bc)-8; - end= get_packetheader(nut, bc, 1); + end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE); end += url_ftell(bc); tmp= get_v(bc); @@ -482,7 +485,7 @@ return -1; } - end= get_packetheader(nut, bc, 1); + end= get_packetheader(nut, bc, 1, INDEX_STARTCODE); end += url_ftell(bc); get_v(bc); //max_pts @@ -737,7 +740,7 @@ case MAIN_STARTCODE: case STREAM_STARTCODE: case INDEX_STARTCODE: - skip= get_packetheader(nut, bc, 0); + skip= get_packetheader(nut, bc, 0, tmp); url_fseek(bc, skip, SEEK_CUR); break; case INFO_STARTCODE: