[FFmpeg-cvslog] tests: do not use AVFrame accessor

Muhammad Faiz git at videolan.org
Sun Apr 23 11:13:55 EEST 2017


ffmpeg | branch: master | Muhammad Faiz <mfcc64 at gmail.com> | Sat Apr 22 15:59:09 2017 +0700| [cdd3048134b8b032b69d3c076d73d24e329dc9ba] | committer: Muhammad Faiz

tests: do not use AVFrame accessor

Reviewed-by: wm4 <nfxjfg at googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdd3048134b8b032b69d3c076d73d24e329dc9ba
---

 tests/api/api-flac-test.c          | 4 ++--
 tests/api/api-h264-test.c          | 2 +-
 tests/api/api-seek-test.c          | 2 +-
 tests/api/api-threadmessage-test.c | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c
index 7b480594b7..c5a37f03e1 100644
--- a/tests/api/api-flac-test.c
+++ b/tests/api/api-flac-test.c
@@ -156,7 +156,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
 
         generate_raw_frame((uint16_t*)(in_frame->data[0]), i, enc_ctx->sample_rate,
                            enc_ctx->channels, enc_ctx->frame_size);
-        in_frame_bytes = in_frame->nb_samples * av_frame_get_channels(in_frame) * sizeof(uint16_t);
+        in_frame_bytes = in_frame->nb_samples * in_frame->channels * sizeof(uint16_t);
         if (in_frame_bytes > in_frame->linesize[0]) {
             av_log(NULL, AV_LOG_ERROR, "Incorrect value of input frame linesize\n");
             return 1;
@@ -197,7 +197,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
                     av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different sample format\n");
                     return AVERROR_UNKNOWN;
                 }
-                out_frame_bytes = out_frame->nb_samples * av_frame_get_channels(out_frame) * sizeof(uint16_t);
+                out_frame_bytes = out_frame->nb_samples * out_frame->channels * sizeof(uint16_t);
                 if (out_frame_bytes > out_frame->linesize[0]) {
                     av_log(NULL, AV_LOG_ERROR, "Incorrect value of output frame linesize\n");
                     return 1;
diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c
index 7bdf92bb89..52282e0007 100644
--- a/tests/api/api-h264-test.c
+++ b/tests/api/api-h264-test.c
@@ -132,7 +132,7 @@ static int video_decode_example(const char *input_filename)
                     return number_of_written_bytes;
                 }
                 printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08lx\n", video_stream,
-                        fr->pts, fr->pkt_dts, av_frame_get_pkt_duration(fr),
+                        fr->pts, fr->pkt_dts, fr->pkt_duration,
                         number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes));
             }
             av_packet_unref(&pkt);
diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
index 4fd1e6ea04..2b32cb9e4f 100644
--- a/tests/api/api-seek-test.c
+++ b/tests/api/api-seek-test.c
@@ -145,7 +145,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream,
         }
         av_packet_unref(&pkt);
         av_init_packet(&pkt);
-    } while ((!end_of_stream || got_frame) && (no_seeking || (fr->pts + av_frame_get_pkt_duration(fr) <= ts_end)));
+    } while ((!end_of_stream || got_frame) && (no_seeking || (fr->pts + fr->pkt_duration <= ts_end)));
 
     av_packet_unref(&pkt);
     av_freep(&byte_buffer);
diff --git a/tests/api/api-threadmessage-test.c b/tests/api/api-threadmessage-test.c
index 3e0ac5cf19..05a8062b8c 100644
--- a/tests/api/api-threadmessage-test.c
+++ b/tests/api/api-threadmessage-test.c
@@ -95,7 +95,7 @@ static void *sender_thread(void *arg)
                 av_frame_free(&msg.frame);
                 break;
             }
-            av_frame_set_metadata(msg.frame, meta);
+            msg.frame->metadata = meta;
 
             /* allocate a real frame in order to simulate "real" work */
             msg.frame->format = AV_PIX_FMT_RGBA;
@@ -141,7 +141,7 @@ static void *receiver_thread(void *arg)
             if (ret < 0)
                 break;
             av_assert0(msg.magic == MAGIC);
-            meta = av_frame_get_metadata(msg.frame);
+            meta = msg.frame->metadata;
             e = av_dict_get(meta, "sig", NULL, 0);
             av_log(NULL, AV_LOG_INFO, "got \"%s\" (%p)\n", e->value, msg.frame);
             av_frame_free(&msg.frame);



More information about the ffmpeg-cvslog mailing list