MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / find_frame_end

Function find_frame_end

libavcodec/dirac_parser.c:52–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50} DiracParseContext;
51
52static int find_frame_end(DiracParseContext *pc,
53 const uint8_t *buf, int buf_size)
54{
55 uint32_t state = pc->state;
56 int i = 0;
57
58 if (!pc->is_synced) {
59 for (i = 0; i < buf_size; i++) {
60 state = (state << 8) | buf[i];
61 if (state == DIRAC_PARSE_INFO_PREFIX) {
62 state = -1;
63 pc->is_synced = 1;
64 pc->header_bytes_needed = 9;
65 pc->sync_offset = i;
66 break;
67 }
68 }
69 }
70
71 if (pc->is_synced) {
72 pc->sync_offset = 0;
73 for (; i < buf_size; i++) {
74 if (state == DIRAC_PARSE_INFO_PREFIX) {
75 if ((buf_size-i) >= pc->header_bytes_needed) {
76 pc->state = -1;
77 return i + pc->header_bytes_needed;
78 } else {
79 pc->header_bytes_needed = 9-(buf_size-i);
80 break;
81 }
82 } else
83 state = (state << 8) | buf[i];
84 }
85 }
86 pc->state = state;
87 return -1;
88}
89
90typedef struct DiracParseUnit
91{

Callers 1

dirac_parseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected