Lines Matching defs:frame
58 /* pts of the next frame that will be generated */
62 AVFrame *frame;
85 AVStream *st, AVFrame *frame, AVPacket *pkt)
89 // send the frame to the encoder
90 ret = avcodec_send_frame(c, frame);
92 fprintf(stderr, "Error sending a frame to the encoder: %s\n",
102 fprintf(stderr, "Error encoding a frame: %s\n", av_err2str(ret));
110 /* Write the compressed frame to the media file. */
185 * of which frame timestamps are represented. For fixed-fps content,
191 c->gop_size = 12; /* emit one intra frame every twelve frames at most */
221 AVFrame *frame = av_frame_alloc();
224 if (!frame) {
225 fprintf(stderr, "Error allocating an audio frame\n");
229 frame->format = sample_fmt;
230 av_channel_layout_copy(&frame->ch_layout, channel_layout);
231 frame->sample_rate = sample_rate;
232 frame->nb_samples = nb_samples;
235 ret = av_frame_get_buffer(frame, 0);
242 return frame;
275 ost->frame = alloc_audio_frame(c->sample_fmt, &c->ch_layout,
309 /* Prepare a 16 bit dummy audio frame of 'frame_size' samples and
313 AVFrame *frame = ost->tmp_frame;
315 int16_t *q = (int16_t*)frame->data[0];
322 for (j = 0; j <frame->nb_samples; j++) {
330 frame->pts = ost->next_pts;
331 ost->next_pts += frame->nb_samples;
333 return frame;
337 * encode one audio frame and send it to the muxer
343 AVFrame *frame;
349 frame = get_audio_frame(ost);
351 if (frame) {
354 dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples,
356 av_assert0(dst_nb_samples == frame->nb_samples);
358 /* when we pass a frame to the encoder, it may keep a reference to it
362 ret = av_frame_make_writable(ost->frame);
368 ost->frame->data, dst_nb_samples,
369 (const uint8_t **)frame->data, frame->nb_samples);
374 frame = ost->frame;
376 frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, c->sample_rate}, c->time_base);
380 return write_frame(oc, c, ost->st, frame, ost->tmp_pkt);
399 /* allocate the buffers for the frame data */
402 fprintf(stderr, "Could not allocate frame data.\n");
426 /* allocate and init a re-usable frame */
427 ost->frame = alloc_picture(c->pix_fmt, c->width, c->height);
428 if (!ost->frame) {
429 fprintf(stderr, "Could not allocate video frame\n");
484 /* when we pass a frame to the encoder, it may keep a reference to it
486 if (av_frame_make_writable(ost->frame) < 0)
506 ost->tmp_frame->linesize, 0, c->height, ost->frame->data,
507 ost->frame->linesize);
509 fill_yuv_image(ost->frame, ost->next_pts, c->width, c->height);
512 ost->frame->pts = ost->next_pts++;
514 return ost->frame;
518 * encode one video frame and send it to the muxer
529 av_frame_free(&ost->frame);