<commit_before>#include "avformat.h"
#include "riff.h"
#include <libnut.h>

#define ID_STRING "nut/multimedia container"
#define ID_LENGTH (strlen(ID_STRING) + 1)

typedef struct {
    nut_context_t * nut;
    nut_stream_header_t * s;
} NUTContext;

static const CodecTag nut_tags[] = {
    { CODEC_ID_MPEG4,  MKTAG('m', 'p', '4', 's') },
    { CODEC_ID_MP3,    MKTAG('m', 'p', '3', ' ') },
    { CODEC_ID_VORBIS, MKTAG('v', 'r', 'b', 's') },
    { 0, 0 },
};

#ifdef CONFIG_MUXERS
frame_table_input_t ft_default[] = {
    // There must be atleast this safety net:
    //{ 4128,      3,   0,   1,      0,    0,     0 },
    //{ flag, fields, pts, mul, stream, size, count }
      { 8192,      0,   0,   1,      0,    0,     0 }, // invalid 0x00
      {   56,      0,   0,   1,      0,    0,     0 }, // safety net non key frame
      {   56,      0,   0,   1,      0,    0,     0 }, // safety net key frame
      { 4128,      0,   0,   1,      0,    0,     0 }, // one more safety net
      {   27,      0,   0,   1,      0,    0,     0 }, // EOR frame
      {    1,      4,   1, 337,      1,  336,     0 }, // used 82427 times
      {    1,      4,   1, 385,      1,  384,     0 }, // used 56044 times
      {    0,      4,   2,   7,      0,    6,     0 }, // used 20993 times
      {    0,      4,   1,   7,      0,    6,     0 }, // used 10398 times
      {    1,      4,   1, 481,      1,  480,     0 }, // used 3527 times
      {    1,      4,   1, 289,      1,  288,     0 }, // used 2042 times
      {    1,      4,   1, 577,      1,  576,     0 }, // used 1480 times
      {    1,      4,   1, 673,      1,  672,     0 }, // used 862 times
      {    1,      4,   1, 769,      1,  768,     0 }, // used 433 times
      {    1,      4,   1, 961,      1,  960,     0 }, // used 191 times
      {   32,      3,   2, 101,      0,    0,     0 }, // "1.2.0" => 14187
      {   32,      3,  -1,  40,      0,    0,     0 }, // "1.-1.0" => 5707
      {   32,      3,   1,  81,      0,    0,     0 }, // "1.1.0" => 11159
      {   33,      3,   1,  11,      0,    0,     0 }, // "1.1.1" => 1409
      {  105,      3,   0,   6,      0,    0,     0 }, // checksum for video
      { 8192,      2,   0,   1,      0,    0,     0 }, // invalid 0xFF
      {   -1,      0,   0,   0,      0,    0,     0 }, // end
};

static int av_write(void * h, size_t len, const uint8_t * buf) {
    ByteIOContext * bc = h;
    put_buffer(bc, buf, len);
    //put_flush_packet(bc);
    return len;
}

static int nut_write_header(AVFormatContext * avf) {
    NUTContext * priv = avf->priv_data;
    ByteIOContext * bc = &avf->pb;
    nut_muxer_opts_t mopts = {
        .output = {
            .priv = bc,
            .write = av_write,
        },
        .alloc = { av_malloc, av_realloc, av_free },
        .write_index = 1,
        .realtime_stream = 0,
        .max_distance = 32768,
        .fti = ft_default
    };
    nut_stream_header_t * s;
    int i;

    priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s);
<commit_msg>update to libnut API, changes to frame_table_input<commit_after>#include "avformat.h"
#include "riff.h"
#include <libnut.h>

#define ID_STRING "nut/multimedia container"
#define ID_LENGTH (strlen(ID_STRING) + 1)

typedef struct {
    nut_context_t * nut;
    nut_stream_header_t * s;
} NUTContext;

static const CodecTag nut_tags[] = {
    { CODEC_ID_MPEG4,  MKTAG('m', 'p', '4', 's') },
    { CODEC_ID_MP3,    MKTAG('m', 'p', '3', ' ') },
    { CODEC_ID_VORBIS, MKTAG('v', 'r', 'b', 's') },
    { 0, 0 },
};

#ifdef CONFIG_MUXERS
nut_frame_table_input_t ft_default[] = {
        // There must be atleast this safety net:
        //{ 4128,    0,      0,   1,    0,     1 },
        //{ flag,  pts, stream, mul, size, count }
          { 8192,    0,      0,   1,    0,     1 }, // invalid 0x00
          {   56,    0,      0,   1,    0,     1 }, // safety net non key frame
          {   57,    0,      0,   1,    0,     1 }, // safety net key frame
          { 4128,    0,      0,   1,    0,     1 }, // one more safety net
          {   27,    0,      0,   1,    0,     1 }, // EOR frame
          {    1,    1,      1, 337,  336,     1 }, // used 82427 times
          {    1,    1,      1, 385,  384,     1 }, // used 56044 times
          {    0,    2,      0,   7,    6,     1 }, // used 20993 times
          {    0,    1,      0,   7,    6,     1 }, // used 10398 times
          {    1,    1,      1, 481,  480,     1 }, // used 3527 times
          {    1,    1,      1, 289,  288,     1 }, // used 2042 times
          {    1,    1,      1, 577,  576,     1 }, // used 1480 times
          {    1,    1,      1, 673,  672,     1 }, // used 862 times
          {    1,    1,      1, 769,  768,     1 }, // used 433 times
          {    1,    1,      1, 961,  960,     1 }, // used 191 times
          {   32,    2,      0, 101,    0,   101 }, // "1.2.0" => 14187
          {   32,   -1,      0,  40,    0,    40 }, // "1.-1.0" => 5707
          {   32,    1,      0,  81,    0,    81 }, // "1.1.0" => 11159
          {   33,    1,      0,  11,    0,    11 }, // "1.1.1" => 1409
          {  105,    0,      0,   6,    0,     6 }, // checksum for video
          { 8192,    0,      0,   1,    0,     1 }, // invalid 0xFF
          {   -1,    0,      0,   0,    0,     0 }, // end
};

static int av_write(void * h, size_t len, const uint8_t * buf) {
    ByteIOContext * bc = h;
    put_buffer(bc, buf, len);
    //put_flush_packet(bc);
    return len;
}

static int nut_write_header(AVFormatContext * avf) {
    NUTContext * priv = avf->priv_data;
    ByteIOContext * bc = &avf->pb;
    nut_muxer_opts_t mopts = {
        .output = {
            .priv = bc,
            .write = av_write,
        },
        .alloc = { av_malloc, av_realloc, av_free },
        .write_index = 1,
        .realtime_stream = 0,
        .max_distance = 32768,
        .fti = ft_default
    };
    nut_stream_header_t * s;
    int i;

    priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s);

{'fraction_non_alphanumeric': 0.15624478906119726, 'fraction_numerical': 0.10038352509588128, 'mean_word_length': 1.250656660412758, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1638028', 'n_tokens_mistral': 2596, 'n_tokens_neox': 2331, 'n_words': 656}