diff options
| -rw-r--r-- | src/av_format_identify.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/av_format_identify.c b/src/av_format_identify.c index 6222713..5652621 100644 --- a/src/av_format_identify.c +++ b/src/av_format_identify.c @@ -41,6 +41,14 @@ int is_mpeg_ts_each(const char *buff, size_t size) uint32_t pid_pre, pid_aft; pid_pre = ((htonl(*(uint32_t *)buff) & 0x000fff00) >> 8) + ((((htonl(*(uint32_t *)buff) & 0x00f00000) >> 20) % 2) << 12); + const char *pack_tail; + const char *pack_half; + const char *pack_quarter; + + size_t whole_pack_cout; + size_t half_pack_cout; + size_t quarter_pack_cout; + while (p < (buff + size)) { if (*p == TS_SYNC_BYTE) @@ -67,20 +75,20 @@ int is_mpeg_ts_each(const char *buff, size_t size) } if (fit_times >= FIT_TIMES) { - size_t whole_pack_cout = size / TS_PKT_SIZE; + whole_pack_cout = size / TS_PKT_SIZE; if (size % TS_PKT_SIZE == 0) { whole_pack_cout--; } - size_t half_pack_cout = whole_pack_cout/2; - size_t quarter_pack_cout = whole_pack_cout/4; + half_pack_cout = whole_pack_cout/2; + quarter_pack_cout = whole_pack_cout/4; if (whole_pack_cout < 3 || half_pack_cout < 2 || quarter_pack_cout < 1) { break; } - const char *pack_tail = buff + whole_pack_cout * TS_PKT_SIZE; - const char *pack_half = buff + half_pack_cout * TS_PKT_SIZE; - const char *pack_quarter = buff + quarter_pack_cout * TS_PKT_SIZE; + pack_tail = buff + whole_pack_cout * TS_PKT_SIZE; + pack_half = buff + half_pack_cout * TS_PKT_SIZE; + pack_quarter = buff + quarter_pack_cout * TS_PKT_SIZE; //if (*pack_tail == TS_SYNC_BYTE && *(pack_tail - TS_PKT_SIZE) == TS_SYNC_BYTE) if (*pack_tail == TS_SYNC_BYTE && *pack_half == TS_SYNC_BYTE && *pack_quarter == TS_SYNC_BYTE) { |
