comparison dca_parser.c @ 6598:05987f234569 libavcodec

DCA frame size is constant
author kostya
date Tue, 15 Apr 2008 13:36:56 +0000
parents 48759bfbd073
children ee1b8c54a603
comparison
equal deleted inserted replaced
6597:25ed93c16c00 6598:05987f234569
30 #include "dca.h" 30 #include "dca.h"
31 31
32 typedef struct DCAParseContext { 32 typedef struct DCAParseContext {
33 ParseContext pc; 33 ParseContext pc;
34 uint32_t lastmarker; 34 uint32_t lastmarker;
35 int size;
36 int framesize;
35 } DCAParseContext; 37 } DCAParseContext;
36 38
37 #define IS_MARKER(state, i, buf, buf_size) \ 39 #define IS_MARKER(state, i, buf, buf_size) \
38 ((state == DCA_MARKER_14B_LE && (i < buf_size-2) && (buf[i+1] & 0xF0) == 0xF0 && buf[i+2] == 0x07) \ 40 ((state == DCA_MARKER_14B_LE && (i < buf_size-2) && (buf[i+1] & 0xF0) == 0xF0 && buf[i+2] == 0x07) \
39 || (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \ 41 || (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \
69 } 71 }
70 } 72 }
71 } 73 }
72 if (start_found) { 74 if (start_found) {
73 for (; i < buf_size; i++) { 75 for (; i < buf_size; i++) {
76 pc1->size++;
74 state = (state << 8) | buf[i]; 77 state = (state << 8) | buf[i];
75 if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) { 78 if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size) && (!pc1->framesize || pc1->framesize == pc1->size)) {
76 pc->frame_start_found = 0; 79 pc->frame_start_found = 0;
77 pc->state = -1; 80 pc->state = -1;
81 pc1->framesize = pc1->size;
82 pc1->size = 0;
78 return i - 3; 83 return i - 3;
79 } 84 }
80 } 85 }
81 } 86 }
82 pc->frame_start_found = start_found; 87 pc->frame_start_found = start_found;