History

dca: K&R formatting cosmetics

Gabriel Dume committed 12 years ago

Commit 45ff7c91 parent 9030c586 files · +7953 −7981Browse files

Showing the changes to libavcodec/dca_parser.c (1 of 6 files). Show all

Unified · Split

libavcodec/dca_parser.c+19−20
@@ -22,9 +22,9 @@ · 21 unmodified lines
2222 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2323 */
2424
25−#include "parser.h"
2625 #include "dca.h"
2726 #include "get_bits.h"
27+#include "parser.h"
2828
2929 typedef struct DCAParseContext {
3030 ParseContext pc;
@@ -35,15 +35,15 @@ typedef struct DCAParseContext { · 4 unmodified lines
3535 } DCAParseContext;
3636
3737 #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) \
39− || (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \
40− || state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE)
38+ ((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) || \
40+ state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE)
4141
4242 /**
4343 * Find the end of the current frame in the bitstream.
4444 * @return the position of the first byte of the next frame, or -1
4545 */
46−static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
46+static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf,
4747 int buf_size)
4848 {
4949 int start_found, i;
@@ -51,7 +51,7 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, · 1 unmodified line
5151 ParseContext *pc = &pc1->pc;
5252
5353 start_found = pc->frame_start_found;
54− state = pc->state;
54+ state = pc->state;
5555
5656 i = 0;
5757 if (!start_found) {
@@ -63,7 +63,7 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, · 5 unmodified lines
6363 i++;
6464 break;
6565 } else if (!pc1->lastmarker) {
66− start_found = 1;
66+ start_found = 1;
6767 pc1->lastmarker = state;
6868 i++;
6969 break;
@@ -78,21 +78,21 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, · 8 unmodified lines
7878 if (state == DCA_HD_MARKER && !pc1->hd_pos)
7979 pc1->hd_pos = pc1->size;
8080 if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) {
81− if(pc1->framesize > pc1->size)
81+ if (pc1->framesize > pc1->size)
8282 continue;
8383 pc->frame_start_found = 0;
84− pc->state = -1;
85− pc1->size = 0;
84+ pc->state = -1;
85+ pc1->size = 0;
8686 return i - 3;
8787 }
8888 }
8989 }
9090 pc->frame_start_found = start_found;
91− pc->state = state;
91+ pc->state = state;
9292 return END_NOT_FOUND;
9393 }
9494
95−static av_cold int dca_parse_init(AVCodecParserContext * s)
95+static av_cold int dca_parse_init(AVCodecParserContext *s)
9696 {
9797 DCAParseContext *pc1 = s->priv_data;
9898
@@ -126,7 +126,7 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, · 27 unmodified lines
126126 return AVERROR_INVALIDDATA;
127127
128128 skip_bits(&gb, 6);
129− sr_code = get_bits(&gb, 4);
129+ sr_code = get_bits(&gb, 4);
130130 *sample_rate = avpriv_dca_sample_rates[sr_code];
131131 if (*sample_rate == 0)
132132 return AVERROR_INVALIDDATA;
@@ -134,10 +134,9 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, · 1 unmodified line
134134 return 0;
135135 }
136136
137−static int dca_parse(AVCodecParserContext * s,
138− AVCodecContext * avctx,
139− const uint8_t ** poutbuf, int *poutbuf_size,
140− const uint8_t * buf, int buf_size)
137+static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
138+ const uint8_t **poutbuf, int *poutbuf_size,
139+ const uint8_t *buf, int buf_size)
141140 {
142141 DCAParseContext *pc1 = s->priv_data;
143142 ParseContext *pc = &pc1->pc;
@@ -149,7 +148,7 @@ static int dca_parse(AVCodecParserContext * s, · 5 unmodified lines
149148 next = dca_find_frame_end(pc1, buf, buf_size);
150149
151150 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
152− *poutbuf = NULL;
151+ *poutbuf = NULL;
153152 *poutbuf_size = 0;
154153 return buf_size;
155154 }
@@ -157,12 +156,12 @@ static int dca_parse(AVCodecParserContext * s, · 1 unmodified line
157156
158157 /* read the duration and sample rate from the frame header */
159158 if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) {
160− s->duration = duration;
159+ s->duration = duration;
161160 avctx->sample_rate = sample_rate;
162161 } else
163162 s->duration = 0;
164163
165− *poutbuf = buf;
164+ *poutbuf = buf;
166165 *poutbuf_size = buf_size;
167166 return next;
168167 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t