* Read the next element as binary data. * 0 is success, < 0 or NEEDS_CHECKING is failure. */
| 1084 | * 0 is success, < 0 or NEEDS_CHECKING is failure. |
| 1085 | */ |
| 1086 | static int ebml_read_binary(AVIOContext *pb, int length, |
| 1087 | int64_t pos, EbmlBin *bin) |
| 1088 | { |
| 1089 | int ret; |
| 1090 | |
| 1091 | ret = av_buffer_realloc(&bin->buf, length + AV_INPUT_BUFFER_PADDING_SIZE); |
| 1092 | if (ret < 0) |
| 1093 | return ret; |
| 1094 | memset(bin->buf->data + length, 0, AV_INPUT_BUFFER_PADDING_SIZE); |
| 1095 | |
| 1096 | bin->data = bin->buf->data; |
| 1097 | bin->size = length; |
| 1098 | bin->pos = pos; |
| 1099 | if ((ret = avio_read(pb, bin->data, length)) != length) { |
| 1100 | av_buffer_unref(&bin->buf); |
| 1101 | bin->data = NULL; |
| 1102 | bin->size = 0; |
| 1103 | return ret < 0 ? ret : NEEDS_CHECKING; |
| 1104 | } |
| 1105 | |
| 1106 | return 0; |
| 1107 | } |
| 1108 | |
| 1109 | /* |
| 1110 | * Read the next element, but only the header. The contents |
no test coverage detected