mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
fate-api-h264-slice: use the heap for nal buffer
nal buffer is 512 kilobytes Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
7cda7d217c
commit
3fc7b69496
@ -117,9 +117,9 @@ int main(int argc, char **argv)
|
|||||||
unsigned int threads;
|
unsigned int threads;
|
||||||
AVPacket *pkt;
|
AVPacket *pkt;
|
||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
char nal[MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE];
|
char * nal = NULL;
|
||||||
int nals = 0, ret = 0;
|
int nals = 0, ret = 0;
|
||||||
char *p = nal;
|
char *p;
|
||||||
|
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
fprintf(stderr, "Usage: %s <threads> <input file> <output file>\n", argv[0]);
|
fprintf(stderr, "Usage: %s <threads> <input file> <output file>\n", argv[0]);
|
||||||
@ -139,6 +139,11 @@ int main(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nal = av_malloc(MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
if (!nal)
|
||||||
|
goto err;
|
||||||
|
p = nal;
|
||||||
|
|
||||||
if (!(codec = avcodec_find_decoder(AV_CODEC_ID_H264))) {
|
if (!(codec = avcodec_find_decoder(AV_CODEC_ID_H264))) {
|
||||||
fprintf(stderr, "Codec not found\n");
|
fprintf(stderr, "Codec not found\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -223,6 +228,8 @@ int main(int argc, char **argv)
|
|||||||
ret = decode(c, frame, NULL);
|
ret = decode(c, frame, NULL);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
if (nal)
|
||||||
|
av_free(nal);
|
||||||
if (file)
|
if (file)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user