[gegl] Replace avcodec_decode_* with avcodec_send_packet/avcodec_receive_frame
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Replace avcodec_decode_* with avcodec_send_packet/avcodec_receive_frame
- Date: Sat, 26 Mar 2022 18:36:37 +0000 (UTC)
commit 8be339ebb67c9c3fd0177ded85491a3a5f6bea0a
Author: Behnam Momeni <sbmomeni gmail com>
Date: Fri Mar 4 20:25:50 2022 +0330
Replace avcodec_decode_* with avcodec_send_packet/avcodec_receive_frame
operations/external/ff-load.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index 8327ad41d..c8889f342 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -223,14 +223,23 @@ decode_audio (GeglOperation *operation,
static AVFrame frame;
int got_frame;
- decoded_bytes = avcodec_decode_audio4(p->audio_ctx,
- &frame, &got_frame, &pkt);
-
+ decoded_bytes = avcodec_send_packet (p->audio_ctx, &pkt);
if (decoded_bytes < 0)
{
- fprintf (stderr, "avcodec_decode_audio4 failed for %s\n",
+ fprintf (stderr, "avcodec_send_packet failed for %s\n",
o->path);
}
+ else
+ {
+ decoded_bytes = avcodec_receive_frame (p->audio_ctx, &frame);
+ if (decoded_bytes < 0)
+ {
+ fprintf (stderr, "avcodec_receive_frame failed for %s\n",
+ o->path);
+ }
+ else
+ got_frame = 1;
+ }
if (got_frame) {
int samples_left = frame.nb_samples;
@@ -356,15 +365,24 @@ decode_frame (GeglOperation *operation,
}
while (pkt.stream_index != p->video_index);
- decoded_bytes = avcodec_decode_video2 (
- p->video_ctx, p->lavc_frame,
- &got_picture, &pkt);
+ decoded_bytes = avcodec_send_packet (p->video_ctx, &pkt);
if (decoded_bytes < 0)
{
- fprintf (stderr, "avcodec_decode_video failed for %s\n",
+ fprintf (stderr, "avcodec_send_packet failed for %s\n",
o->path);
return -1;
}
+ else
+ {
+ decoded_bytes = avcodec_receive_frame (p->video_ctx, p->lavc_frame);
+ if (decoded_bytes < 0)
+ {
+ fprintf (stderr, "avcodec_receive_frame failed for %s\n",
+ o->path);
+ }
+ else
+ got_picture = 1;
+ }
if(got_picture)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]