Lines Matching refs:pb
89 static void mov_cenc_write_encrypted(MOVMuxCencContext* ctx, AVIOContext *pb, in mov_cenc_write_encrypted() argument
100 avio_write(pb, chunk, cur_size); in mov_cenc_write_encrypted()
167 int ff_mov_cenc_write_packet(MOVMuxCencContext* ctx, AVIOContext *pb, in ff_mov_cenc_write_packet() argument
182 mov_cenc_write_encrypted(ctx, pb, buf_in, size); in ff_mov_cenc_write_packet()
192 int ff_mov_cenc_avc_parse_nal_units(MOVMuxCencContext* ctx, AVIOContext *pb, in ff_mov_cenc_avc_parse_nal_units() argument
214 avio_wb32(pb, nal_end - nal_start); in ff_mov_cenc_avc_parse_nal_units()
215 avio_w8(pb, *nal_start); in ff_mov_cenc_avc_parse_nal_units()
216 mov_cenc_write_encrypted(ctx, pb, nal_start + 1, nal_end - nal_start - 1); in ff_mov_cenc_avc_parse_nal_units()
233 int nal_length_size, AVIOContext *pb, const uint8_t *buf_in, int size) in ff_mov_cenc_avc_write_nal_units() argument
252 avio_write(pb, buf_in, nal_length_size + 1); in ff_mov_cenc_avc_write_nal_units()
266 mov_cenc_write_encrypted(ctx, pb, buf_in + 1, nalsize - 1); in ff_mov_cenc_avc_write_nal_units()
282 static int64_t update_size(AVIOContext *pb, int64_t pos) in update_size() argument
284 int64_t curpos = avio_tell(pb); in update_size()
285 avio_seek(pb, pos, SEEK_SET); in update_size()
286 avio_wb32(pb, curpos - pos); /* rewrite size */ in update_size()
287 avio_seek(pb, curpos, SEEK_SET); in update_size()
292 static int mov_cenc_write_senc_tag(MOVMuxCencContext* ctx, AVIOContext *pb, in mov_cenc_write_senc_tag() argument
295 int64_t pos = avio_tell(pb); in mov_cenc_write_senc_tag()
297 avio_wb32(pb, 0); /* size */ in mov_cenc_write_senc_tag()
298 ffio_wfourcc(pb, "senc"); in mov_cenc_write_senc_tag()
299 avio_wb32(pb, ctx->use_subsamples ? 0x02 : 0); /* version & flags */ in mov_cenc_write_senc_tag()
300 avio_wb32(pb, ctx->auxiliary_info_entries); /* entry count */ in mov_cenc_write_senc_tag()
301 *auxiliary_info_offset = avio_tell(pb); in mov_cenc_write_senc_tag()
302 avio_write(pb, ctx->auxiliary_info, ctx->auxiliary_info_size); in mov_cenc_write_senc_tag()
303 return update_size(pb, pos); in mov_cenc_write_senc_tag()
306 static int mov_cenc_write_saio_tag(AVIOContext *pb, int64_t auxiliary_info_offset) in mov_cenc_write_saio_tag() argument
308 int64_t pos = avio_tell(pb); in mov_cenc_write_saio_tag()
311 avio_wb32(pb, 0); /* size */ in mov_cenc_write_saio_tag()
312 ffio_wfourcc(pb, "saio"); in mov_cenc_write_saio_tag()
314 avio_w8(pb, version); in mov_cenc_write_saio_tag()
315 avio_wb24(pb, 0); /* flags */ in mov_cenc_write_saio_tag()
316 avio_wb32(pb, 1); /* entry count */ in mov_cenc_write_saio_tag()
318 avio_wb64(pb, auxiliary_info_offset); in mov_cenc_write_saio_tag()
320 avio_wb32(pb, auxiliary_info_offset); in mov_cenc_write_saio_tag()
322 return update_size(pb, pos); in mov_cenc_write_saio_tag()
325 static int mov_cenc_write_saiz_tag(MOVMuxCencContext* ctx, AVIOContext *pb) in mov_cenc_write_saiz_tag() argument
327 int64_t pos = avio_tell(pb); in mov_cenc_write_saiz_tag()
328 avio_wb32(pb, 0); /* size */ in mov_cenc_write_saiz_tag()
329 ffio_wfourcc(pb, "saiz"); in mov_cenc_write_saiz_tag()
330 avio_wb32(pb, 0); /* version & flags */ in mov_cenc_write_saiz_tag()
331 avio_w8(pb, ctx->use_subsamples ? 0 : AES_CTR_IV_SIZE); /* default size*/ in mov_cenc_write_saiz_tag()
332 avio_wb32(pb, ctx->auxiliary_info_entries); /* entry count */ in mov_cenc_write_saiz_tag()
334 avio_write(pb, ctx->auxiliary_info_sizes, ctx->auxiliary_info_entries); in mov_cenc_write_saiz_tag()
336 return update_size(pb, pos); in mov_cenc_write_saiz_tag()
339 void ff_mov_cenc_write_stbl_atoms(MOVMuxCencContext* ctx, AVIOContext *pb) in ff_mov_cenc_write_stbl_atoms() argument
343 mov_cenc_write_senc_tag(ctx, pb, &auxiliary_info_offset); in ff_mov_cenc_write_stbl_atoms()
344 mov_cenc_write_saio_tag(pb, auxiliary_info_offset); in ff_mov_cenc_write_stbl_atoms()
345 mov_cenc_write_saiz_tag(ctx, pb); in ff_mov_cenc_write_stbl_atoms()
348 static int mov_cenc_write_schi_tag(AVIOContext *pb, uint8_t* kid) in mov_cenc_write_schi_tag() argument
350 int64_t pos = avio_tell(pb); in mov_cenc_write_schi_tag()
351 avio_wb32(pb, 0); /* size */ in mov_cenc_write_schi_tag()
352 ffio_wfourcc(pb, "schi"); in mov_cenc_write_schi_tag()
354 avio_wb32(pb, 32); /* size */ in mov_cenc_write_schi_tag()
355 ffio_wfourcc(pb, "tenc"); in mov_cenc_write_schi_tag()
356 avio_wb32(pb, 0); /* version & flags */ in mov_cenc_write_schi_tag()
357 avio_wb24(pb, 1); /* is encrypted */ in mov_cenc_write_schi_tag()
358 avio_w8(pb, AES_CTR_IV_SIZE); /* iv size */ in mov_cenc_write_schi_tag()
359 avio_write(pb, kid, CENC_KID_SIZE); in mov_cenc_write_schi_tag()
361 return update_size(pb, pos); in mov_cenc_write_schi_tag()
364 int ff_mov_cenc_write_sinf_tag(MOVTrack* track, AVIOContext *pb, uint8_t* kid) in ff_mov_cenc_write_sinf_tag() argument
366 int64_t pos = avio_tell(pb); in ff_mov_cenc_write_sinf_tag()
367 avio_wb32(pb, 0); /* size */ in ff_mov_cenc_write_sinf_tag()
368 ffio_wfourcc(pb, "sinf"); in ff_mov_cenc_write_sinf_tag()
371 avio_wb32(pb, 12); /* size */ in ff_mov_cenc_write_sinf_tag()
372 ffio_wfourcc(pb, "frma"); in ff_mov_cenc_write_sinf_tag()
373 avio_wl32(pb, track->tag); in ff_mov_cenc_write_sinf_tag()
376 avio_wb32(pb, 20); /* size */ in ff_mov_cenc_write_sinf_tag()
377 ffio_wfourcc(pb, "schm"); in ff_mov_cenc_write_sinf_tag()
378 avio_wb32(pb, 0); /* version & flags */ in ff_mov_cenc_write_sinf_tag()
379 ffio_wfourcc(pb, "cenc"); /* scheme type*/ in ff_mov_cenc_write_sinf_tag()
380 avio_wb32(pb, 0x10000); /* scheme version */ in ff_mov_cenc_write_sinf_tag()
383 mov_cenc_write_schi_tag(pb, kid); in ff_mov_cenc_write_sinf_tag()
385 return update_size(pb, pos); in ff_mov_cenc_write_sinf_tag()