comparison h264_mp4toannexb_bsf.c @ 11860:b39ced9e4fc3 libavcodec

Cosmetics: alignment and long line break.
author benoit
date Thu, 10 Jun 2010 06:00:37 +0000
parents f533ea0b236f
children
comparison
equal deleted inserted replaced
11859:f533ea0b236f 11860:b39ced9e4fc3
27 uint8_t first_idr; 27 uint8_t first_idr;
28 int extradata_parsed; 28 int extradata_parsed;
29 } H264BSFContext; 29 } H264BSFContext;
30 30
31 static int alloc_and_copy(uint8_t **poutbuf, int *poutbuf_size, 31 static int alloc_and_copy(uint8_t **poutbuf, int *poutbuf_size,
32 const uint8_t *sps_pps, uint32_t sps_pps_size, 32 const uint8_t *sps_pps, uint32_t sps_pps_size,
33 const uint8_t *in, uint32_t in_size) { 33 const uint8_t *in, uint32_t in_size) {
34 uint32_t offset = *poutbuf_size; 34 uint32_t offset = *poutbuf_size;
35 uint8_t nal_header_size = offset ? 3 : 4; 35 uint8_t nal_header_size = offset ? 3 : 4;
36 void *tmp; 36 void *tmp;
37 37
38 *poutbuf_size += sps_pps_size+in_size+nal_header_size; 38 *poutbuf_size += sps_pps_size+in_size+nal_header_size;
93 while (unit_nb--) { 93 while (unit_nb--) {
94 void *tmp; 94 void *tmp;
95 95
96 unit_size = AV_RB16(extradata); 96 unit_size = AV_RB16(extradata);
97 total_size += unit_size+4; 97 total_size += unit_size+4;
98 if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE || extradata+2+unit_size > avctx->extradata+avctx->extradata_size) { 98 if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
99 extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
99 av_free(out); 100 av_free(out);
100 return AVERROR(EINVAL); 101 return AVERROR(EINVAL);
101 } 102 }
102 tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE); 103 tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
103 if (!tmp) { 104 if (!tmp) {
141 goto fail; 142 goto fail;
142 143
143 /* prepend only to the first type 5 NAL unit of an IDR picture */ 144 /* prepend only to the first type 5 NAL unit of an IDR picture */
144 if (ctx->first_idr && unit_type == 5) { 145 if (ctx->first_idr && unit_type == 5) {
145 if (alloc_and_copy(poutbuf, poutbuf_size, 146 if (alloc_and_copy(poutbuf, poutbuf_size,
146 avctx->extradata, avctx->extradata_size, 147 avctx->extradata, avctx->extradata_size,
147 buf, nal_size) < 0) 148 buf, nal_size) < 0)
148 goto fail; 149 goto fail;
149 ctx->first_idr = 0; 150 ctx->first_idr = 0;
150 } else { 151 } else {
151 if (alloc_and_copy(poutbuf, poutbuf_size, 152 if (alloc_and_copy(poutbuf, poutbuf_size,
152 NULL, 0, 153 NULL, 0,
153 buf, nal_size) < 0) 154 buf, nal_size) < 0)
154 goto fail; 155 goto fail;
155 if (!ctx->first_idr && unit_type == 1) 156 if (!ctx->first_idr && unit_type == 1)
156 ctx->first_idr = 1; 157 ctx->first_idr = 1;
157 } 158 }