tests: do not use AVFrame accessor
authorMuhammad Faiz <mfcc64@gmail.com>
Sat, 22 Apr 2017 08:59:09 +0000 (15:59 +0700)
committerMuhammad Faiz <mfcc64@gmail.com>
Sun, 23 Apr 2017 07:47:54 +0000 (14:47 +0700)
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
tests/api/api-flac-test.c
tests/api/api-h264-test.c
tests/api/api-seek-test.c
tests/api/api-threadmessage-test.c

index 7b48059..c5a37f0 100644 (file)
@@ -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;
index 7bdf92b..52282e0 100644 (file)
@@ -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);
index 4fd1e6e..2b32cb9 100644 (file)
@@ -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);
index 3e0ac5c..05a8062 100644 (file)
@@ -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);