# HG changeset patch # User michael # Date 1266798867 0 # Node ID a84525174bcf903b59a69ebdfc6118ae13541718 # Parent e8614dbd9b7b4a4f20290e8874c8f7482d94fd49 Attempt to fix the completely random values returned by ff_avc_find_startcode(). diff -r e8614dbd9b7b -r a84525174bcf avc.c --- a/avc.c Sun Feb 21 14:41:39 2010 +0000 +++ b/avc.c Mon Feb 22 00:34:27 2010 +0000 @@ -23,7 +23,7 @@ #include "avformat.h" #include "avio.h" -const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end) +static const uint8_t *ff_avc_find_startcode_internal(const uint8_t *p, const uint8_t *end) { const uint8_t *a = p + 4 - ((intptr_t)p & 3); @@ -39,15 +39,15 @@ if ((x - 0x01010101) & (~x) & 0x80808080) { // generic if (p[1] == 0) { if (p[0] == 0 && p[2] == 1) - return p-1; + return p; if (p[2] == 0 && p[3] == 1) - return p; + return p+1; } if (p[3] == 0) { if (p[2] == 0 && p[4] == 1) - return p+1; + return p+2; if (p[4] == 0 && p[5] == 1) - return p+2; + return p+3; } } } @@ -60,6 +60,12 @@ return end + 3; } +const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){ + const uint8_t *out= ff_avc_find_startcode_internal(p, end); + if(p