diff options
| author | Xiaoqing MA <[email protected]> | 2018-07-17 09:58:31 +0800 |
|---|---|---|
| committer | Xiaoqing MA <[email protected]> | 2018-07-17 09:58:31 +0800 |
| commit | 597f30352e0de77bf2e826fcbe9bc3b52e8ac7fb (patch) | |
| tree | b242d272a8591d91e1aa72426c1eb394e011db3f /src | |
| parent | cc9d9d1739240ca0c1205c7a4ae6a9c9644e933f (diff) | |
is_mpeg_ts_each内pack_tail,pack_half,pack_quarter,whole_pack_cout,half_pack_cout,quarter_pack_cout变量定义转到while语句前
Diffstat (limited to 'src')
| -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) { |
