MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / update_context_from_thread

Function update_context_from_thread

libavcodec/pthread_frame.c:346–460  ·  view source on GitHub ↗

* Update the next thread's AVCodecContext with values from the reference thread's context. * * @param dst The destination context. * @param src The source context. * @param for_user 0 if the destination is a codec thread, 1 if the destination is the user's thread * @return 0 on success, negative error code on failure */

Source from the content-addressed store, hash-verified

344 * @return 0 on success, negative error code on failure
345 */
346static int update_context_from_thread(AVCodecContext *dst, const AVCodecContext *src, int for_user)
347{
348 const FFCodec *const codec = ffcodec(dst->codec);
349 int err = 0;
350
351 if (dst != src && (for_user || codec->update_thread_context)) {
352 dst->time_base = src->time_base;
353 dst->framerate = src->framerate;
354 dst->width = src->width;
355 dst->height = src->height;
356 dst->pix_fmt = src->pix_fmt;
357 dst->sw_pix_fmt = src->sw_pix_fmt;
358
359 dst->coded_width = src->coded_width;
360 dst->coded_height = src->coded_height;
361
362 dst->has_b_frames = src->has_b_frames;
363 dst->idct_algo = src->idct_algo;
364#if FF_API_CODEC_PROPS
365FF_DISABLE_DEPRECATION_WARNINGS
366 dst->properties = src->properties;
367FF_ENABLE_DEPRECATION_WARNINGS
368#endif
369
370 dst->bits_per_coded_sample = src->bits_per_coded_sample;
371 dst->sample_aspect_ratio = src->sample_aspect_ratio;
372
373 dst->profile = src->profile;
374 dst->level = src->level;
375
376 dst->bits_per_raw_sample = src->bits_per_raw_sample;
377 dst->color_primaries = src->color_primaries;
378
379 dst->alpha_mode = src->alpha_mode;
380
381 dst->color_trc = src->color_trc;
382 dst->colorspace = src->colorspace;
383 dst->color_range = src->color_range;
384 dst->chroma_sample_location = src->chroma_sample_location;
385
386 dst->sample_rate = src->sample_rate;
387 dst->sample_fmt = src->sample_fmt;
388 err = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
389 if (err < 0)
390 return err;
391
392 if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx ||
393 (dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) {
394 av_buffer_unref(&dst->hw_frames_ctx);
395
396 if (src->hw_frames_ctx) {
397 dst->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);
398 if (!dst->hw_frames_ctx)
399 return AVERROR(ENOMEM);
400 }
401 }
402
403 dst->hwaccel_flags = src->hwaccel_flags;

Callers 4

submit_packetFunction · 0.85
ff_thread_receive_frameFunction · 0.85
init_threadFunction · 0.85
ff_thread_flushFunction · 0.85

Calls 10

ffcodecFunction · 0.85
av_channel_layout_copyFunction · 0.85
av_buffer_unrefFunction · 0.85
av_buffer_refFunction · 0.85
av_refstruct_replaceFunction · 0.85
ff_decode_internal_syncFunction · 0.85
ff_hwaccel_uninitFunction · 0.85
ffhwaccelFunction · 0.85
av_logFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected