Lines Matching refs:mux
26 static void MuxInit(WebPMux* const mux) { in MuxInit() argument
27 if (mux == NULL) return; in MuxInit()
28 memset(mux, 0, sizeof(*mux)); in MuxInit()
35 WebPMux* const mux = (WebPMux*)malloc(sizeof(WebPMux)); in WebPNewInternal() local
37 MuxInit(mux); in WebPNewInternal()
38 return mux; in WebPNewInternal()
48 static void MuxRelease(WebPMux* const mux) { in MuxRelease() argument
49 if (mux == NULL) return; in MuxRelease()
50 MuxImageDeleteAll(&mux->images_); in MuxRelease()
51 DeleteAllChunks(&mux->vp8x_); in MuxRelease()
52 DeleteAllChunks(&mux->iccp_); in MuxRelease()
53 DeleteAllChunks(&mux->anim_); in MuxRelease()
54 DeleteAllChunks(&mux->exif_); in MuxRelease()
55 DeleteAllChunks(&mux->xmp_); in MuxRelease()
56 DeleteAllChunks(&mux->unknown_); in MuxRelease()
59 void WebPMuxDelete(WebPMux* mux) { in WebPMuxDelete() argument
61 MuxRelease(mux); in WebPMuxDelete()
62 free(mux); in WebPMuxDelete()
78 static WebPMuxError MuxSet(WebPMux* const mux, CHUNK_INDEX idx, uint32_t nth, in MuxSet() argument
82 assert(mux != NULL); in MuxSet()
86 SWITCH_ID_LIST(IDX_VP8X, &mux->vp8x_); in MuxSet()
87 SWITCH_ID_LIST(IDX_ICCP, &mux->iccp_); in MuxSet()
88 SWITCH_ID_LIST(IDX_ANIM, &mux->anim_); in MuxSet()
89 SWITCH_ID_LIST(IDX_EXIF, &mux->exif_); in MuxSet()
90 SWITCH_ID_LIST(IDX_XMP, &mux->xmp_); in MuxSet()
97 err = ChunkSetNth(&chunk, &mux->unknown_, nth); in MuxSet()
103 static WebPMuxError MuxAddChunk(WebPMux* const mux, uint32_t nth, uint32_t tag, in MuxAddChunk() argument
108 assert(mux != NULL); in MuxAddChunk()
111 return MuxSet(mux, idx, nth, &chunk_data, copy_data); in MuxAddChunk()
165 WebPMux* const mux = WebPMuxCreate(bitstream, 0); in GetImageData() local
166 if (mux == NULL) return WEBP_MUX_BAD_DATA; in GetImageData()
167 wpi = mux->images_; in GetImageData()
173 WebPMuxDelete(mux); in GetImageData()
194 static WebPMuxError MuxDeleteAllNamedData(WebPMux* const mux, uint32_t tag) { in MuxDeleteAllNamedData() argument
198 assert(mux != NULL); in MuxDeleteAllNamedData()
201 chunk_list = MuxGetChunkListFromId(mux, id); in MuxDeleteAllNamedData()
210 WebPMuxError WebPMuxSetChunk(WebPMux* mux, const char fourcc[4], in WebPMuxSetChunk() argument
215 if (mux == NULL || fourcc == NULL || chunk_data == NULL || in WebPMuxSetChunk()
223 err = MuxDeleteAllNamedData(mux, tag); in WebPMuxSetChunk()
227 return MuxSet(mux, idx, 1, chunk_data, copy_data); in WebPMuxSetChunk()
265 WebPMuxError WebPMuxSetImage(WebPMux* mux, const WebPData* bitstream, in WebPMuxSetImage() argument
271 if (mux == NULL || bitstream == NULL || bitstream->bytes == NULL || in WebPMuxSetImage()
276 if (mux->images_ != NULL) { in WebPMuxSetImage()
278 MuxImageDeleteAll(&mux->images_); in WebPMuxSetImage()
286 err = MuxImagePush(&wpi, &mux->images_); in WebPMuxSetImage()
297 WebPMuxError WebPMuxPushFrame(WebPMux* mux, const WebPMuxFrameInfo* frame, in WebPMuxPushFrame() argument
305 if (mux == NULL || frame == NULL) return WEBP_MUX_INVALID_ARGUMENT; in WebPMuxPushFrame()
321 if (mux->images_ != NULL) { in WebPMuxPushFrame()
322 const WebPMuxImage* const image = mux->images_; in WebPMuxPushFrame()
362 err = MuxImagePush(&wpi, &mux->images_); in WebPMuxPushFrame()
373 WebPMuxError WebPMuxSetAnimationParams(WebPMux* mux, in WebPMuxSetAnimationParams() argument
378 if (mux == NULL || params == NULL) return WEBP_MUX_INVALID_ARGUMENT; in WebPMuxSetAnimationParams()
384 err = MuxDeleteAllNamedData(mux, kChunks[IDX_ANIM].tag); in WebPMuxSetAnimationParams()
390 return MuxAddChunk(mux, 1, kChunks[IDX_ANIM].tag, data, sizeof(data), 1); in WebPMuxSetAnimationParams()
396 WebPMuxError WebPMuxDeleteChunk(WebPMux* mux, const char fourcc[4]) { in WebPMuxDeleteChunk() argument
397 if (mux == NULL || fourcc == NULL) return WEBP_MUX_INVALID_ARGUMENT; in WebPMuxDeleteChunk()
398 return MuxDeleteAllNamedData(mux, ChunkGetTagFromFourCC(fourcc)); in WebPMuxDeleteChunk()
401 WebPMuxError WebPMuxDeleteFrame(WebPMux* mux, uint32_t nth) { in WebPMuxDeleteFrame() argument
402 if (mux == NULL) return WEBP_MUX_INVALID_ARGUMENT; in WebPMuxDeleteFrame()
403 return MuxImageDeleteNth(&mux->images_, nth); in WebPMuxDeleteFrame()
464 const WebPMux* const mux, uint32_t flags, in GetImageCanvasWidthHeight() argument
467 assert(mux != NULL); in GetImageCanvasWidthHeight()
470 wpi = mux->images_; in GetImageCanvasWidthHeight()
521 static WebPMuxError CreateVP8XChunk(WebPMux* const mux) { in CreateVP8XChunk() argument
530 assert(mux != NULL); in CreateVP8XChunk()
531 images = mux->images_; // First image. in CreateVP8XChunk()
539 err = MuxDeleteAllNamedData(mux, kChunks[IDX_VP8X].tag); in CreateVP8XChunk()
543 if (mux->iccp_ != NULL && mux->iccp_->data_.bytes != NULL) { in CreateVP8XChunk()
546 if (mux->exif_ != NULL && mux->exif_->data_.bytes != NULL) { in CreateVP8XChunk()
549 if (mux->xmp_ != NULL && mux->xmp_->data_.bytes != NULL) { in CreateVP8XChunk()
570 err = GetImageCanvasWidthHeight(mux, flags, &width, &height); in CreateVP8XChunk()
592 err = MuxAddChunk(mux, 1, kChunks[IDX_VP8X].tag, data, data_size, 1); in CreateVP8XChunk()
597 static WebPMuxError MuxCleanup(WebPMux* const mux) { in MuxCleanup() argument
605 WebPMuxError err = WebPMuxNumChunks(mux, kChunks[IDX_ANMF].id, &num_frames); in MuxCleanup()
607 err = WebPMuxNumChunks(mux, kChunks[IDX_FRGM].id, &num_fragments); in MuxCleanup()
611 err = MuxImageGetNth((const WebPMuxImage**)&mux->images_, 1, &frame_frag); in MuxCleanup()
623 err = WebPMuxNumChunks(mux, kChunks[IDX_ANIM].id, &num_anim_chunks); in MuxCleanup()
626 err = MuxDeleteAllNamedData(mux, kChunks[IDX_ANIM].tag); in MuxCleanup()
632 WebPMuxError WebPMuxAssemble(WebPMux* mux, WebPData* assembled_data) { in WebPMuxAssemble() argument
638 if (mux == NULL || assembled_data == NULL) { in WebPMuxAssemble()
643 err = MuxCleanup(mux); in WebPMuxAssemble()
645 err = CreateVP8XChunk(mux); in WebPMuxAssemble()
649 size = ChunksListDiskSize(mux->vp8x_) + ChunksListDiskSize(mux->iccp_) in WebPMuxAssemble()
650 + ChunksListDiskSize(mux->anim_) + MuxImageListDiskSize(mux->images_) in WebPMuxAssemble()
651 + ChunksListDiskSize(mux->exif_) + ChunksListDiskSize(mux->xmp_) in WebPMuxAssemble()
652 + ChunksListDiskSize(mux->unknown_) + RIFF_HEADER_SIZE; in WebPMuxAssemble()
659 dst = ChunkListEmit(mux->vp8x_, dst); in WebPMuxAssemble()
660 dst = ChunkListEmit(mux->iccp_, dst); in WebPMuxAssemble()
661 dst = ChunkListEmit(mux->anim_, dst); in WebPMuxAssemble()
662 dst = MuxImageListEmit(mux->images_, dst); in WebPMuxAssemble()
663 dst = ChunkListEmit(mux->exif_, dst); in WebPMuxAssemble()
664 dst = ChunkListEmit(mux->xmp_, dst); in WebPMuxAssemble()
665 dst = ChunkListEmit(mux->unknown_, dst); in WebPMuxAssemble()
669 err = MuxValidate(mux); in WebPMuxAssemble()