Lines Matching refs:pb
111 AVIOContext *pb = s->pb; in avi_add_ientry() local
136 idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list; in avi_add_ientry()
159 static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, in avi_start_new_riff() argument
173 avi->riff_start = ff_start_tag(pb, "RIFF"); in avi_start_new_riff()
174 ffio_wfourcc(pb, riff_tag); in avi_start_new_riff()
175 loff = ff_start_tag(pb, "LIST"); in avi_start_new_riff()
176 ffio_wfourcc(pb, list_tag); in avi_start_new_riff()
201 AVIOContext *pb = s->pb; in avi_write_counters() local
207 file_size = avio_tell(pb); in avi_write_counters()
213 avio_seek(pb, avist->frames_hdr_strm, SEEK_SET); in avi_write_counters()
216 avio_wl32(pb, avist->packet_count); in avi_write_counters()
218 avio_wl32(pb, avist->audio_strm_length / au_ssize); in avi_write_counters()
224 avio_seek(pb, avi->frames_hdr_all, SEEK_SET); in avi_write_counters()
225 avio_wl32(pb, nb_frames); in avi_write_counters()
227 avio_seek(pb, file_size, SEEK_SET); in avi_write_counters()
234 AVIOContext *pb = s->pb; in write_odml_master() local
246 avist->indexes.indx_start = ff_start_tag(pb, "JUNK"); in write_odml_master()
247 avio_wl16(pb, 4); /* wLongsPerEntry */ in write_odml_master()
248 avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ in write_odml_master()
249 avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ in write_odml_master()
250 avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */ in write_odml_master()
251 ffio_wfourcc(pb, avi_stream2fourcc(tag, stream_index, par->codec_type)); in write_odml_master()
253 avio_wl64(pb, 0); /* dwReserved[3] */ in write_odml_master()
254 avio_wl32(pb, 0); /* Must be 0. */ in write_odml_master()
256 avio_wl64(pb, 0); in write_odml_master()
257 ff_end_tag(pb, avist->indexes.indx_start); in write_odml_master()
263 AVIOContext *pb = s->pb; in avi_write_header() local
290 list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl"); in avi_write_header()
293 ffio_wfourcc(pb, "avih"); in avi_write_header()
294 avio_wl32(pb, 14 * 4); in avi_write_header()
332 avio_wl32(pb, (uint32_t) (INT64_C(1000000) * video_st->time_base.num / in avi_write_header()
335 avio_wl32(pb, 0); in avi_write_header()
336 avio_wl32(pb, bitrate / 8); /* XXX: not quite exact */ in avi_write_header()
337 avio_wl32(pb, 0); /* padding */ in avi_write_header()
338 if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) in avi_write_header()
339 avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ in avi_write_header()
341 avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ in avi_write_header()
342 avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */ in avi_write_header()
343 avio_wl32(pb, nb_frames); /* nb frames, filled later */ in avi_write_header()
344 avio_wl32(pb, 0); /* initial frame */ in avi_write_header()
345 avio_wl32(pb, s->nb_streams); /* nb streams */ in avi_write_header()
346 avio_wl32(pb, 1024 * 1024); /* suggested buffer size */ in avi_write_header()
348 avio_wl32(pb, video_par->width); in avi_write_header()
349 avio_wl32(pb, video_par->height); in avi_write_header()
351 avio_wl32(pb, 0); in avi_write_header()
352 avio_wl32(pb, 0); in avi_write_header()
354 avio_wl32(pb, 0); /* reserved */ in avi_write_header()
355 avio_wl32(pb, 0); /* reserved */ in avi_write_header()
356 avio_wl32(pb, 0); /* reserved */ in avi_write_header()
357 avio_wl32(pb, 0); /* reserved */ in avi_write_header()
364 list2 = ff_start_tag(pb, "LIST"); in avi_write_header()
365 ffio_wfourcc(pb, "strl"); in avi_write_header()
368 strh = ff_start_tag(pb, "strh"); in avi_write_header()
378 ffio_wfourcc(pb, "vids"); in avi_write_header()
381 ffio_wfourcc(pb, "auds"); in avi_write_header()
387 ffio_wfourcc(pb, "dats"); in avi_write_header()
392 avio_wl32(pb, par->codec_tag); in avi_write_header()
394 avio_wl32(pb, 1); in avi_write_header()
395 avist->strh_flags_offset = avio_tell(pb); in avi_write_header()
396 avio_wl32(pb, 0); /* flags */ in avi_write_header()
397 avio_wl16(pb, 0); /* priority */ in avi_write_header()
398 avio_wl16(pb, 0); /* language */ in avi_write_header()
399 avio_wl32(pb, 0); /* initial frame */ in avi_write_header()
413 avio_wl32(pb, au_scale); /* scale */ in avi_write_header()
414 avio_wl32(pb, au_byterate); /* rate */ in avi_write_header()
416 avio_wl32(pb, 0); /* start */ in avi_write_header()
418 avist->frames_hdr_strm = avio_tell(pb); in avi_write_header()
419 if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) in avi_write_header()
421 avio_wl32(pb, AVI_MAX_RIFF_SIZE); in avi_write_header()
423 avio_wl32(pb, 0); /* length, XXX: filled later */ in avi_write_header()
427 avio_wl32(pb, 1024 * 1024); in avi_write_header()
429 avio_wl32(pb, 12 * 1024); in avi_write_header()
431 avio_wl32(pb, 0); in avi_write_header()
432 avio_wl32(pb, -1); /* quality */ in avi_write_header()
433 avio_wl32(pb, au_ssize); /* sample size */ in avi_write_header()
434 avio_wl32(pb, 0); in avi_write_header()
435 avio_wl16(pb, par->width); in avi_write_header()
436 avio_wl16(pb, par->height); in avi_write_header()
437 ff_end_tag(pb, strh); in avi_write_header()
443 strf = ff_start_tag(pb, "strf"); in avi_write_header()
457 avist->pal_offset = avio_tell(pb) + 40; in avi_write_header()
458 ff_put_bmp_header(pb, par, 0, 0, avi->flipped_raw_rgb); in avi_write_header()
478 if ((ret = ff_put_wav_header(s, pb, par, flags)) < 0) in avi_write_header()
487 ff_end_tag(pb, strf); in avi_write_header()
489 ff_riff_write_info_tag(s->pb, "strn", t->value); in avi_write_header()
500 ff_riff_write_info_tag(s->pb, "strn", str); in avi_write_header()
506 if (pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_header()
513 int vprp = ff_start_tag(pb, "vprp"); in avi_write_header()
526 avio_wl32(pb, 0); // video format = unknown in avi_write_header()
527 avio_wl32(pb, 0); // video standard = unknown in avi_write_header()
529 … avio_wl32(pb, (2LL*st->time_base.den + st->time_base.num - 1) / (2LL * st->time_base.num)); in avi_write_header()
530 avio_wl32(pb, par->width); in avi_write_header()
531 avio_wl32(pb, par->height); in avi_write_header()
532 avio_wl16(pb, den); in avi_write_header()
533 avio_wl16(pb, num); in avi_write_header()
534 avio_wl32(pb, par->width); in avi_write_header()
535 avio_wl32(pb, par->height); in avi_write_header()
536 avio_wl32(pb, fields); // fields per frame in avi_write_header()
551 avio_wl32(pb, par->height / fields); // compressed bitmap height in avi_write_header()
552 avio_wl32(pb, par->width); // compressed bitmap width in avi_write_header()
553 avio_wl32(pb, par->height / fields); // valid bitmap height in avi_write_header()
554 avio_wl32(pb, par->width); // valid bitmap width in avi_write_header()
555 avio_wl32(pb, 0); // valid bitmap X offset in avi_write_header()
556 avio_wl32(pb, 0); // valid bitmap Y offset in avi_write_header()
557 avio_wl32(pb, 0); // valid X offset in T in avi_write_header()
558 avio_wl32(pb, start_line); // valid Y start line in avi_write_header()
560 ff_end_tag(pb, vprp); in avi_write_header()
563 ff_end_tag(pb, list2); in avi_write_header()
566 if (pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_header()
568 avi->odml_list = ff_start_tag(pb, "JUNK"); in avi_write_header()
569 ffio_wfourcc(pb, "odml"); in avi_write_header()
570 ffio_wfourcc(pb, "dmlh"); in avi_write_header()
571 avio_wl32(pb, 248); in avi_write_header()
573 avio_wl32(pb, 0); in avi_write_header()
574 ff_end_tag(pb, avi->odml_list); in avi_write_header()
577 ff_end_tag(pb, list1); in avi_write_header()
588 list2 = ff_start_tag(pb, "JUNK"); in avi_write_header()
590 avio_wl32(pb, 0); in avi_write_header()
591 ff_end_tag(pb, list2); in avi_write_header()
594 avi->movi_list = ff_start_tag(pb, "LIST"); in avi_write_header()
595 ffio_wfourcc(pb, "movi"); in avi_write_header()
602 AVIOContext *pb = s->pb; in update_odml_entry() local
608 pos = avio_tell(pb); in update_odml_entry()
611 avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); in update_odml_entry()
612 ffio_wfourcc(pb, "indx"); /* enabling this entry */ in update_odml_entry()
613 avio_skip(pb, 8); in update_odml_entry()
614 …avio_wl32(pb, avi->riff_id - avist->indexes.master_odml_riff_id_base); /* nEntriesInUse */ in update_odml_entry()
615 avio_skip(pb, 16 * (avi->riff_id - avist->indexes.master_odml_riff_id_base)); in update_odml_entry()
616 avio_wl64(pb, ix); /* qwOffset */ in update_odml_entry()
617 avio_wl32(pb, size); /* dwSize */ in update_odml_entry()
625 avio_wl32(pb, audio_segm_size / au_ssize); /* dwDuration (sample count) */ in update_odml_entry()
627 avio_wl32(pb, avist->indexes.entry); /* dwDuration (packet count) */ in update_odml_entry()
629 avio_seek(pb, pos, SEEK_SET); in update_odml_entry()
634 AVIOContext *pb = s->pb; in avi_write_ix() local
640 av_assert0(pb->seekable & AVIO_SEEKABLE_NORMAL); in avi_write_ix()
648 pos = avio_tell(pb); in avi_write_ix()
651 av_assert1(avio_tell(pb) - pos == size); in avi_write_ix()
665 ix = avio_tell(pb); in avi_write_ix()
666 ffio_wfourcc(pb, ix_tag); /* ix?? */ in avi_write_ix()
667 avio_wl32(pb, avist->indexes.entry * 8 + 24); in avi_write_ix()
669 avio_wl16(pb, 2); /* wLongsPerEntry */ in avi_write_ix()
670 avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ in avi_write_ix()
671 avio_w8(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ in avi_write_ix()
672 avio_wl32(pb, avist->indexes.entry); in avi_write_ix()
674 ffio_wfourcc(pb, tag); /* dwChunkId */ in avi_write_ix()
675 avio_wl64(pb, avi->movi_list); /* qwBaseOffset */ in avi_write_ix()
676 avio_wl32(pb, 0); /* dwReserved_3 (must be 0) */ in avi_write_ix()
680 avio_wl32(pb, ie->pos + 8); in avi_write_ix()
681 avio_wl32(pb, ((uint32_t) ie->len & ~0x80000000) | in avi_write_ix()
685 update_odml_entry(s, i, ix, avio_tell(pb) - ix); in avi_write_ix()
692 AVIOContext *pb = s->pb; in avi_write_idx1() local
698 if (pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_idx1()
703 idx_chunk = ff_start_tag(pb, "idx1"); in avi_write_idx1()
726 ffio_wfourcc(pb, ie->tag); in avi_write_idx1()
730 ffio_wfourcc(pb, tag); in avi_write_idx1()
732 avio_wl32(pb, ie->flags); in avi_write_idx1()
733 avio_wl32(pb, ie->pos); in avi_write_idx1()
734 avio_wl32(pb, ie->len); in avi_write_idx1()
738 ff_end_tag(pb, idx_chunk); in avi_write_idx1()
788 AVIOContext *pb = s->pb; in avi_write_packet() local
809 if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && avist->pal_offset) { in avi_write_packet()
810 int64_t cur_offset = avio_tell(pb); in avi_write_packet()
811 avio_seek(pb, avist->pal_offset, SEEK_SET); in avi_write_packet()
814 avio_wl32(pb, v & 0xffffff); in avi_write_packet()
816 avio_seek(pb, cur_offset, SEEK_SET); in avi_write_packet()
824 if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_packet()
826 int64_t cur_offset = avio_tell(pb); in avi_write_packet()
827 avio_seek(pb, avist->strh_flags_offset, SEEK_SET); in avi_write_packet()
828 avio_wl32(pb, AVISF_VIDEO_PALCHANGES); in avi_write_packet()
829 avio_seek(pb, cur_offset, SEEK_SET); in avi_write_packet()
837 pc_tag = ff_start_tag(pb, tag); in avi_write_packet()
838 avio_w8(pb, 0); in avi_write_packet()
839 avio_w8(pb, pal_size & 0xFF); in avi_write_packet()
840 avio_wl16(pb, 0); // reserved in avi_write_packet()
843 avio_wb32(pb, v<<8); in avi_write_packet()
845 ff_end_tag(pb, pc_tag); in avi_write_packet()
870 AVIOContext *pb = s->pb; in avi_write_packet_internal() local
880 if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && in avi_write_packet_internal()
881 (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { in avi_write_packet_internal()
883 ff_end_tag(pb, avi->movi_list); in avi_write_packet_internal()
888 ff_end_tag(pb, avi->riff_start); in avi_write_packet_internal()
889 avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi"); in avi_write_packet_internal()
898 if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_packet_internal()
905 avio_write(pb, tag, 4); in avi_write_packet_internal()
906 avio_wl32(pb, size); in avi_write_packet_internal()
907 avio_write(pb, pkt->data, size); in avi_write_packet_internal()
909 avio_w8(pb, 0); in avi_write_packet_internal()
917 AVIOContext *pb = s->pb; in avi_write_trailer() local
927 if (pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_trailer()
929 ff_end_tag(pb, avi->movi_list); in avi_write_trailer()
931 ff_end_tag(pb, avi->riff_start); in avi_write_trailer()
934 ff_end_tag(pb, avi->movi_list); in avi_write_trailer()
935 ff_end_tag(pb, avi->riff_start); in avi_write_trailer()
937 file_size = avio_tell(pb); in avi_write_trailer()
938 avio_seek(pb, avi->odml_list - 8, SEEK_SET); in avi_write_trailer()
939 ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ in avi_write_trailer()
940 avio_skip(pb, 16); in avi_write_trailer()
955 avio_wl32(pb, nb_frames); in avi_write_trailer()
956 avio_seek(pb, file_size, SEEK_SET); in avi_write_trailer()
972 if (pb->seekable & AVIO_SEEKABLE_NORMAL) { in avi_write_trailer()
973 avio_seek(pb, avist->frames_hdr_strm + 4, SEEK_SET); in avi_write_trailer()
974 avio_wl32(pb, avist->max_size); in avi_write_trailer()