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

Function pad_last_frame

libavcodec/encode.c:156–188  ·  view source on GitHub ↗

* Pad last frame with silence. */

Source from the content-addressed store, hash-verified

154 * Pad last frame with silence.
155 */
156static int pad_last_frame(AVCodecContext *s, AVFrame *frame, const AVFrame *src, int out_samples)
157{
158 int ret;
159
160 frame->format = src->format;
161 frame->nb_samples = out_samples;
162 ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout);
163 if (ret < 0)
164 goto fail;
165 ret = av_frame_get_buffer(frame, 0);
166 if (ret < 0)
167 goto fail;
168
169 ret = av_frame_copy_props(frame, src);
170 if (ret < 0)
171 goto fail;
172
173 if ((ret = av_samples_copy(frame->extended_data, src->extended_data, 0, 0,
174 src->nb_samples, s->ch_layout.nb_channels,
175 s->sample_fmt)) < 0)
176 goto fail;
177 if ((ret = av_samples_set_silence(frame->extended_data, src->nb_samples,
178 frame->nb_samples - src->nb_samples,
179 s->ch_layout.nb_channels, s->sample_fmt)) < 0)
180 goto fail;
181
182 return 0;
183
184fail:
185 av_frame_unref(frame);
186 encode_ctx(s->internal)->last_audio_frame = 0;
187 return ret;
188}
189
190int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
191 const AVSubtitle *sub)

Callers 1

Calls 7

av_channel_layout_copyFunction · 0.85
av_frame_get_bufferFunction · 0.85
av_frame_copy_propsFunction · 0.85
av_samples_copyFunction · 0.85
av_samples_set_silenceFunction · 0.85
av_frame_unrefFunction · 0.85
encode_ctxFunction · 0.85

Tested by

no test coverage detected