[NUT] (ods15): r118 - in /trunk: libnut/demuxer.c libnut/muxer.c libnut/priv.h nututils/nutmerge.c

Author: ods15 Date: Fri Mar 31 22:36:52 2006 New Revision: 118 Log: sync to spec for flags cleanup Modified: trunk/libnut/demuxer.c trunk/libnut/muxer.c trunk/libnut/priv.h trunk/nututils/nutmerge.c Modified: trunk/libnut/demuxer.c ============================================================================== --- trunk/libnut/demuxer.c (original) +++ trunk/libnut/demuxer.c Fri Mar 31 22:36:52 2006 @@ -268,7 +268,7 @@ continue; } nut->ft[i].flags = flag; - nut->ft[i].stream_plus1 = stream; + nut->ft[i].stream = stream; nut->ft[i].mul = mul; nut->ft[i].lsb = size + j; nut->ft[i].pts_delta = timestamp; @@ -519,12 +519,19 @@ flags = nut->ft[tmp].flags; ERROR(flags & FLAG_INVALID, -ERR_NOT_FRAME_NOT_N); - if (!nut->ft[tmp].stream_plus1) GET_V(nut->i, pd->stream); - else pd->stream = nut->ft[tmp].stream_plus1 - 1; + if (flags & FLAG_CODED) { + int coded_flags; + GET_V(nut->i, coded_flags); + flags ^= coded_flags; + } + pd->flags = flags & NUT_API_FLAGS; + + if (flags & FLAG_STREAM_ID) GET_V(nut->i, pd->stream); + else pd->stream = nut->ft[tmp].stream; ERROR(pd->stream >= nut->stream_count, -ERR_NOT_FRAME_NOT_N); - if (!nut->ft[tmp].pts_delta) { + if (flags & FLAG_CODED_PTS) { uint64_t coded_pts; GET_V(nut->i, coded_pts); if (coded_pts >= (1 << nut->sc[pd->stream].msb_pts_shift)) @@ -539,20 +546,15 @@ pd->pts = nut->sc[pd->stream].last_pts + nut->ft[tmp].pts_delta; } - if (flags & FLAG_CODED) { - int coded_flags; - GET_V(nut->i, coded_flags); - flags ^= coded_flags; - } - pd->flags = flags & NUT_API_FLAGS; - if (flags & FLAG_SIZE_MSB) { int size_msb; GET_V(nut->i, size_msb); pd->len = size_msb * nut->ft[tmp].mul + nut->ft[tmp].lsb; } else pd->len = nut->ft[tmp].lsb; - for (i = 0; i < nut->ft[tmp].reserved; i++) { int scrap; GET_V(nut->i, scrap); } + i = nut->ft[tmp].reserved; + if (flags & FLAG_RESERVED) GET_V(nut->i, i); + while (i--) { int scrap; GET_V(nut->i, scrap); } if (flags & FLAG_CHECKSUM) { CHECK(skip_buffer(nut->i, 4)); // header_checksum Modified: trunk/libnut/muxer.c ============================================================================== --- trunk/libnut/muxer.c (original) +++ trunk/libnut/muxer.c Fri Mar 31 22:36:52 2006 @@ -152,15 +152,15 @@ timestamp = nut->ft[i].pts_delta; if (nut->ft[i].mul != mul) fields = 2; mul = nut->ft[i].mul; - if (nut->ft[i].stream_plus1 != stream) fields = 3; - stream = nut->ft[i].stream_plus1; + if (nut->ft[i].stream != stream) fields = 3; + stream = nut->ft[i].stream; if (nut->ft[i].lsb != 0) fields = 4; size = nut->ft[i].lsb; for (count = 0; i < 256; count++, i++) { if (i == 'N') { count--; continue; } if (nut->ft[i].flags != flag) break; - if (nut->ft[i].stream_plus1 != stream) break; + if (nut->ft[i].stream != stream) break; if (nut->ft[i].mul != mul) break; if (nut->ft[i].lsb != size + count) break; if (nut->ft[i].pts_delta != timestamp) break; @@ -404,22 +404,24 @@ int len = 1; // frame code int flags = nut->ft[i].flags; if (flags & FLAG_INVALID) continue; - if (nut->ft[i].stream_plus1 && nut->ft[i].stream_plus1 - 1 != fd->stream) continue; - if (nut->ft[i].pts_delta && nut->ft[i].pts_delta != pts_delta) continue; if (flags & FLAG_CODED) { flags = fd->flags & NUT_API_FLAGS; + if (nut->ft[i].stream != fd->stream) flags |= FLAG_STREAM_ID; + if (nut->ft[i].pts_delta != pts_delta) flags |= FLAG_CODED_PTS; if (nut->ft[i].lsb != fd->len) flags |= FLAG_SIZE_MSB; if (checksum) flags |= FLAG_CHECKSUM; flags |= FLAG_CODED; } + if ((flags ^ fd->flags) & NUT_API_FLAGS) continue; + if (!(flags & FLAG_STREAM_ID) && nut->ft[i].stream != fd->stream) continue; + if (!(flags & FLAG_CODED_PTS) && nut->ft[i].pts_delta != pts_delta) continue; if (flags & FLAG_SIZE_MSB) { if ((fd->len - nut->ft[i].lsb) % nut->ft[i].mul) continue; } else { if (nut->ft[i].lsb != fd->len) continue; } - if ((flags ^ fd->flags) & NUT_API_FLAGS) continue; - if (checksum && !(flags & FLAG_CHECKSUM)) continue; - - len += nut->ft[i].stream_plus1 ? 0 : v_len(fd->stream); - len += nut->ft[i].pts_delta ? 0 : v_len(coded_pts); + if (!(flags & FLAG_CHECKSUM) && checksum) continue; + len += !(flags & FLAG_CODED) ? 0 : v_len(flags ^ nut->ft[i].flags); + len += !(flags & FLAG_STREAM_ID)? 0 : v_len(fd->stream); + len += !(flags & FLAG_CODED_PTS)? 0 : v_len(coded_pts); len += !(flags & FLAG_SIZE_MSB) ? 0 : v_len((fd->len - nut->ft[i].lsb) / nut->ft[i].mul); len += !(flags & FLAG_CHECKSUM) ? 0 : 4; if (!size || len < size) { ftnum = i; coded_flags = flags; size = len; } @@ -427,9 +429,9 @@ assert(ftnum != -1); if (tmp) { put_bytes(tmp, 1, ftnum); // frame_code - if (!nut->ft[ftnum].stream_plus1) put_v(tmp, fd->stream); - if (!nut->ft[ftnum].pts_delta) put_v(tmp, coded_pts); if (coded_flags & FLAG_CODED) put_v(tmp, coded_flags ^ nut->ft[ftnum].flags); + if (coded_flags & FLAG_STREAM_ID) put_v(tmp, fd->stream); + if (coded_flags & FLAG_CODED_PTS) put_v(tmp, coded_pts); if (coded_flags & FLAG_SIZE_MSB) put_v(tmp, (fd->len - nut->ft[ftnum].lsb) / nut->ft[ftnum].mul); if (coded_flags & FLAG_CHECKSUM) put_bytes(tmp, 4, crc32(tmp->buf, bctello(tmp))); } @@ -517,7 +519,7 @@ continue; } nut->ft[i].flags = flag; - nut->ft[i].stream_plus1 = stream; + nut->ft[i].stream = stream; nut->ft[i].mul = mul; nut->ft[i].lsb = size + j; nut->ft[i].pts_delta = timestamp; Modified: trunk/libnut/priv.h ============================================================================== --- trunk/libnut/priv.h (original) +++ trunk/libnut/priv.h Fri Mar 31 22:36:52 2006 @@ -19,8 +19,11 @@ #define NUT_API_FLAGS 3 +#define FLAG_CODED_PTS 8 +#define FLAG_STREAM_ID 16 #define FLAG_SIZE_MSB 32 #define FLAG_CHECKSUM 64 +#define FLAG_RESERVED 128 #define FLAG_CODED 4096 #define FLAG_INVALID 8192 @@ -73,7 +76,7 @@ uint16_t lsb; int16_t pts_delta; uint8_t reserved; - uint8_t stream_plus1; + uint8_t stream; } frame_table_t; typedef struct { Modified: trunk/nututils/nutmerge.c ============================================================================== --- trunk/nututils/nutmerge.c (original) +++ trunk/nututils/nutmerge.c Fri Mar 31 22:36:52 2006 @@ -31,25 +31,25 @@ //{ 4128, 3, 0, 1, 0, 0, 0 }, //{ flag, fields, pts, mul, stream, size, count } { 8192, 0, 0, 1, 0, 0, 0 }, // invalid 0x00 - { 32, 0, 0, 1, 0, 0, 0 }, // safety net non key frame - { 33, 0, 0, 1, 0, 0, 0 }, // safety net key frame + { 56, 0, 0, 1, 0, 0, 0 }, // safety net non key frame + { 56, 0, 0, 1, 0, 0, 0 }, // safety net key frame { 4128, 0, 0, 1, 0, 0, 0 }, // one more safety net - { 3, 0, 0, 1, 0, 0, 0 }, // EOR frame - { 1, 4, 1, 337, 2, 336, 0 }, // used 82427 times - { 1, 4, 1, 385, 2, 384, 0 }, // used 56044 times - { 0, 4, 2, 7, 1, 6, 0 }, // used 20993 times - { 0, 4, 1, 7, 1, 6, 0 }, // used 10398 times - { 1, 4, 1, 481, 2, 480, 0 }, // used 3527 times - { 1, 4, 1, 289, 2, 288, 0 }, // used 2042 times - { 1, 4, 1, 577, 2, 576, 0 }, // used 1480 times - { 1, 4, 1, 673, 2, 672, 0 }, // used 862 times - { 1, 4, 1, 769, 2, 768, 0 }, // used 433 times - { 1, 4, 1, 961, 2, 960, 0 }, // used 191 times - { 32, 3, 2, 101, 1, 0, 0 }, // "1.2.0" => 14187 - { 32, 3, -1, 40, 1, 0, 0 }, // "1.-1.0" => 5707 - { 32, 3, 1, 81, 1, 0, 0 }, // "1.1.0" => 11159 - { 33, 3, 1, 11, 1, 0, 0 }, // "1.1.1" => 1409 - { 97, 3, 0, 6, 1, 0, 0 }, // checksum for video + { 27, 0, 0, 1, 0, 0, 0 }, // EOR frame + { 1, 4, 1, 337, 1, 336, 0 }, // used 82427 times + { 1, 4, 1, 385, 1, 384, 0 }, // used 56044 times + { 0, 4, 2, 7, 0, 6, 0 }, // used 20993 times + { 0, 4, 1, 7, 0, 6, 0 }, // used 10398 times + { 1, 4, 1, 481, 1, 480, 0 }, // used 3527 times + { 1, 4, 1, 289, 1, 288, 0 }, // used 2042 times + { 1, 4, 1, 577, 1, 576, 0 }, // used 1480 times + { 1, 4, 1, 673, 1, 672, 0 }, // used 862 times + { 1, 4, 1, 769, 1, 768, 0 }, // used 433 times + { 1, 4, 1, 961, 1, 960, 0 }, // used 191 times + { 32, 3, 2, 101, 0, 0, 0 }, // "1.2.0" => 14187 + { 32, 3, -1, 40, 0, 0, 0 }, // "1.-1.0" => 5707 + { 32, 3, 1, 81, 0, 0, 0 }, // "1.1.0" => 11159 + { 33, 3, 1, 11, 0, 0, 0 }, // "1.1.1" => 1409 + { 105, 3, 0, 6, 0, 0, 0 }, // checksum for video { 8192, 2, 0, 1, 0, 0, 0 }, // invalid 0xFF { -1, 0, 0, 0, 0, 0, 0 }, // end };
participants (1)
-
syncmail@mplayerhq.hu