Showing the changes to libavcodec/tests (1 of 1 file). Show all
Unified · Split
| @@ -63,9 +63,6 @@ static int initializations(AVPacket* avpkt) · 62 unmodified lines | ||
| 63 | 63 | const static uint8_t* data = "selftest for av_packet_clone(...)"; |
| 64 | 64 | int ret = 0; |
| 65 | 65 | |
| 66 | − /* initialize avpkt */ | |
| 67 | − av_init_packet(avpkt); | |
| 68 | − | |
| 69 | 66 | /* set values for avpkt */ |
| 70 | 67 | avpkt->pts = 17; |
| 71 | 68 | avpkt->dts = 2; |
| @@ -82,16 +79,24 @@ static int initializations(AVPacket* avpkt) · 10 unmodified lines | ||
| 82 | 79 | |
| 83 | 80 | int main(void) |
| 84 | 81 | { |
| 85 | − AVPacket avpkt; | |
| 82 | + AVPacket *avpkt = NULL; | |
| 86 | 83 | AVPacket *avpkt_clone = NULL; |
| 87 | 84 | int ret = 0; |
| 88 | 85 | |
| 89 | − if(initializations(&avpkt) < 0){ | |
| 86 | + /* test av_packet_alloc */ | |
| 87 | + avpkt = av_packet_alloc(); | |
| 88 | + if(!avpkt) { | |
| 89 | + av_log(NULL, AV_LOG_ERROR, "av_packet_alloc failed to allcoate AVPacket\n"); | |
| 90 | + return 1; | |
| 91 | + } | |
| 92 | + | |
| 93 | + if (initializations(avpkt) < 0) { | |
| 90 | 94 | printf("failed to initialize variables\n"); |
| 95 | + av_packet_free(&avpkt); | |
| 91 | 96 | return 1; |
| 92 | 97 | } |
| 93 | 98 | /* test av_packet_clone*/ |
| 94 | − avpkt_clone = av_packet_clone(&avpkt); | |
| 99 | + avpkt_clone = av_packet_clone(avpkt); | |
| 95 | 100 | |
| 96 | 101 | if(!avpkt_clone) { |
| 97 | 102 | av_log(NULL, AV_LOG_ERROR,"av_packet_clone failed to clone AVPacket\n"); |
| @@ -121,7 +126,7 @@ int main(void) · 23 unmodified lines | ||
| 121 | 126 | } |
| 122 | 127 | /*clean up*/ |
| 123 | 128 | av_packet_free(&avpkt_clone); |
| 124 | − av_packet_unref(&avpkt); | |
| 129 | + av_packet_free(&avpkt); | |
| 125 | 130 | |
| 126 | 131 | |
| 127 | 132 | return ret; |