Lines Matching refs:frame

42 #include "libavutil/frame.h"
264 * Initialize one audio frame for reading from the input file.
265 * @param[out] frame Frame to be initialized
268 static int init_input_frame(AVFrame **frame)
270 if (!(*frame = av_frame_alloc())) {
271 fprintf(stderr, "Could not allocate input frame\n");
358 * Decode one audio frame from the input file.
359 * @param frame Audio frame to be decoded
370 static int decode_audio_frame(AVFrame *frame,
385 /* Read one audio frame from the input file into a temporary packet. */
391 fprintf(stderr, "Could not read frame (error '%s')\n",
397 /* Send the audio frame stored in the temporary packet to the decoder.
405 /* Receive one frame from the decoder. */
406 error = avcodec_receive_frame(input_codec_context, frame);
407 /* If the decoder asks for more data to be able to decode a frame,
418 fprintf(stderr, "Could not decode frame (error '%s')\n",
478 * The conversion happens on a per-frame basis, the size of which is
537 * Read one audio frame from the input file, decode, convert and store
559 /* Temporary storage of the input samples of the frame read from the file. */
566 /* Initialize temporary storage for one input frame. */
569 /* Decode one frame worth of audio samples. */
612 * Initialize one input frame for writing to the output file.
613 * The frame will be exactly frame_size samples large.
614 * @param[out] frame Frame to be initialized
616 * @param frame_size Size of the frame
619 static int init_output_frame(AVFrame **frame,
625 /* Create a new frame to store the audio samples. */
626 if (!(*frame = av_frame_alloc())) {
627 fprintf(stderr, "Could not allocate output frame\n");
631 /* Set the frame's parameters, especially its size and format.
633 * audio samples of the frame.
636 (*frame)->nb_samples = frame_size;
637 av_channel_layout_copy(&(*frame)->ch_layout, &output_codec_context->ch_layout);
638 (*frame)->format = output_codec_context->sample_fmt;
639 (*frame)->sample_rate = output_codec_context->sample_rate;
641 /* Allocate the samples of the created frame. This call will make
642 * sure that the audio frame can hold as many samples as specified. */
643 if ((error = av_frame_get_buffer(*frame, 0)) < 0) {
644 fprintf(stderr, "Could not allocate output frame samples (error '%s')\n",
646 av_frame_free(frame);
657 * Encode one frame worth of audio to the output file.
658 * @param frame Samples to be encoded
665 static int encode_audio_frame(AVFrame *frame,
679 if (frame) {
680 frame->pts = pts;
681 pts += frame->nb_samples;
685 /* Send the audio frame stored in the temporary packet to the encoder.
687 error = avcodec_send_frame(output_codec_context, frame);
696 /* Receive one encoded frame from the encoder. */
699 * encoded frame, return indicating that no data is present. */
703 /* If the last frame has been encoded, stop encoding. */
708 fprintf(stderr, "Could not encode frame (error '%s')\n",
716 /* Write one audio frame from the temporary packet to the output file. */
719 fprintf(stderr, "Could not write frame (error '%s')\n",
730 * Load one audio frame from the FIFO buffer, encode and write it to the
741 /* Temporary storage of the output samples of the frame written to the file. */
743 /* Use the maximum number of possible samples per frame.
744 * If there is less than the maximum possible frame size in the FIFO
745 * buffer use this number. Otherwise, use the maximum possible frame size. */
750 /* Initialize temporary storage for one output frame. */
754 /* Read as many samples from the FIFO buffer as required to fill the frame.
755 * The samples are stored in the frame temporarily. */
762 /* Encode one frame worth of audio samples. */
823 /* Use the encoder's desired frame size for processing. */
827 /* Make sure that there is one frame worth of samples in the FIFO
829 * Since the decoder's and the encoder's frame size may differ, we
831 * that they make up at least one frame worth of output samples. */
833 /* Decode one frame worth of audio samples, convert it to the
852 /* Take one frame worth of audio samples from the FIFO buffer,