summaryrefslogtreecommitdiff
path: root/libavcodec/dca_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-04 19:24:12 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-04 19:28:53 +0100
commit87db7e777262a7800cc6c76e07870f7a8f6301ed (patch)
treea9ddb30c4f4408ba8a136f13c84d322ba9ea79b6 /libavcodec/dca_parser.c
parent634ce8ddad6b2c03d24bce12ba69f9217729d3f5 (diff)
parent25f613f8be3b51e4396b93cda131e4631ba54302 (diff)
Merge commit '25f613f8be3b51e4396b93cda131e4631ba54302'
* commit '25f613f8be3b51e4396b93cda131e4631ba54302': dca: Move syncword definitions to a separate header Conflicts: libavcodec/dca_parser.c libavformat/dtsdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dca_parser.c')
-rw-r--r--libavcodec/dca_parser.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index 9fa6d0df3e..979776077f 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -23,6 +23,7 @@
*/
#include "dca.h"
+#include "dca_syncwords.h"
#include "get_bits.h"
#include "parser.h"
@@ -35,9 +36,9 @@ typedef struct DCAParseContext {
} DCAParseContext;
#define IS_MARKER(state, i, buf, buf_size) \
- ((state == DCA_MARKER_14B_LE && (i < buf_size - 2) && (buf[i + 1] & 0xF0) == 0xF0 && buf[i + 2] == 0x07) || \
- (state == DCA_MARKER_14B_BE && (i < buf_size - 2) && buf[i + 1] == 0x07 && (buf[i + 2] & 0xF0) == 0xF0) || \
- state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE || state == DCA_HD_MARKER)
+ ((state == DCA_SYNCWORD_CORE_14B_LE && (i < buf_size - 2) && (buf[i + 1] & 0xF0) == 0xF0 && buf[i + 2] == 0x07) || \
+ (state == DCA_SYNCWORD_CORE_14B_BE && (i < buf_size - 2) && buf[i + 1] == 0x07 && (buf[i + 2] & 0xF0) == 0xF0) || \
+ state == DCA_SYNCWORD_CORE_LE || state == DCA_SYNCWORD_CORE_BE || state == DCA_SYNCWORD_SUBSTREAM)
/**
* Find the end of the current frame in the bitstream.
@@ -58,7 +59,7 @@ static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf,
for (i = 0; i < buf_size; i++) {
state = (state << 8) | buf[i];
if (IS_MARKER(state, i, buf, buf_size)) {
- if (!pc1->lastmarker || state == pc1->lastmarker || pc1->lastmarker == DCA_HD_MARKER) {
+ if (!pc1->lastmarker || state == pc1->lastmarker || pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM) {
start_found = 1;
pc1->lastmarker = state;
i++;
@@ -71,9 +72,9 @@ static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf,
for (; i < buf_size; i++) {
pc1->size++;
state = (state << 8) | buf[i];
- if (state == DCA_HD_MARKER && !pc1->hd_pos)
+ if (state == DCA_SYNCWORD_SUBSTREAM && !pc1->hd_pos)
pc1->hd_pos = pc1->size;
- if (IS_MARKER(state, i, buf, buf_size) && (state == pc1->lastmarker || pc1->lastmarker == DCA_HD_MARKER)) {
+ if (IS_MARKER(state, i, buf, buf_size) && (state == pc1->lastmarker || pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM)) {
if (pc1->framesize > pc1->size)
continue;
pc->frame_start_found = 0;