comparison x264.c @ 3054:d640e46c69ea libavcodec

place SPS/PPS in extradata if GLOBAL_HEADER flag is set
author mru
date Fri, 20 Jan 2006 21:20:46 +0000
parents 0b546eab515d
children f02d0b59279c
comparison
equal deleted inserted replaced
3053:2991dc513726 3054:d640e46c69ea
245 245
246 x4->params.b_aud = (avctx->flags2 & CODEC_FLAG2_AUD); 246 x4->params.b_aud = (avctx->flags2 & CODEC_FLAG2_AUD);
247 247
248 x4->params.i_threads = avctx->thread_count; 248 x4->params.i_threads = avctx->thread_count;
249 249
250 if(avctx->flags & CODEC_FLAG_GLOBAL_HEADER){
251 x4->params.b_repeat_headers = 0;
252 }
253
250 x4->enc = x264_encoder_open(&x4->params); 254 x4->enc = x264_encoder_open(&x4->params);
251 if(!x4->enc) 255 if(!x4->enc)
252 return -1; 256 return -1;
253 257
254 avctx->coded_frame = &x4->out_pic; 258 avctx->coded_frame = &x4->out_pic;
259
260 if(avctx->flags & CODEC_FLAG_GLOBAL_HEADER){
261 x264_nal_t *nal;
262 int nnal, i, s = 0;
263
264 x264_encoder_headers(x4->enc, &nal, &nnal);
265
266 /* 5 bytes NAL header + worst case escaping */
267 for(i = 0; i < nnal; i++)
268 s += 5 + nal[i].i_payload * 4 / 3;
269
270 avctx->extradata = av_malloc(s);
271 avctx->extradata_size = encode_nals(avctx->extradata, s, nal, nnal);
272 }
255 273
256 return 0; 274 return 0;
257 } 275 }
258 276
259 AVCodec x264_encoder = { 277 AVCodec x264_encoder = {