Lines Matching refs:frame
39 static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
44 /* send the frame to the encoder */
45 if (frame)
46 printf("Send frame %3"PRId64"\n", frame->pts);
48 ret = avcodec_send_frame(enc_ctx, frame);
50 fprintf(stderr, "Error sending a frame for encoding\n");
76 AVFrame *frame;
113 /* emit one intra frame every ten frames
114 * check frame pict_type before passing frame
115 * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
117 * will always be I frame irrespective to gop_size
139 frame = av_frame_alloc();
140 if (!frame) {
141 fprintf(stderr, "Could not allocate video frame\n");
144 frame->format = c->pix_fmt;
145 frame->width = c->width;
146 frame->height = c->height;
148 ret = av_frame_get_buffer(frame, 0);
150 fprintf(stderr, "Could not allocate the video frame data\n");
158 /* Make sure the frame data is writable.
159 On the first round, the frame is fresh from av_frame_get_buffer()
163 the frame in its internal structures, that makes the frame
166 for the frame only if necessary.
168 ret = av_frame_make_writable(frame);
174 filling the frame. FFmpeg does not care what you put in the
175 frame.
180 frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
187 frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
188 frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
192 frame->pts = i;
195 encode(c, frame, pkt, f);
212 av_frame_free(&frame);