]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avcodec.c
h264: (trivial) make ff_h264_lps_state static
[ffmpeg] / libavfilter / avcodec.c
index 2850c4daa5709c45991bac82791f6dd8e0ad42d0..3581aef83a07741796332e0ca3b5e64e9ccb4b0a 100644 (file)
@@ -56,6 +56,21 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
     return picref;
 }
 
+int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
+                                              const AVFilterBufferRef *samplesref)
+{
+    if (!samplesref || !samplesref->audio || !frame)
+        return AVERROR(EINVAL);
+
+    memcpy(frame->data, samplesref->data, sizeof(frame->data));
+    frame->pkt_pos    = samplesref->pos;
+    frame->format     = samplesref->format;
+    frame->nb_samples = samplesref->audio->nb_samples;
+    frame->pts        = samplesref->pts;
+
+    return 0;
+}
+
 int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
                                               const AVFilterBufferRef *picref)
 {
@@ -70,6 +85,19 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
     frame->key_frame        = picref->video->key_frame;
     frame->pict_type        = picref->video->pict_type;
     frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
+    frame->width            = picref->video->w;
+    frame->height           = picref->video->h;
+    frame->format           = picref->format;
+    frame->pts              = picref->pts;
 
     return 0;
 }
+
+int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
+                                        const AVFilterBufferRef *ref)
+{
+    if (!ref)
+        return AVERROR(EINVAL);
+    return ref->video ? avfilter_fill_frame_from_video_buffer_ref(frame, ref)
+                      : avfilter_fill_frame_from_audio_buffer_ref(frame, ref);
+}