<commit_before>#include "rawmedia.h"
#include "decoder.h"

int main(int argc, const char *argv[]) {
    rawmedia_init();
    RawMediaDecoderConfig config = { .framerate = (AVRational){30,1},
                                     .start_frame = 15 };
    RawMediaDecoder* rmd = rawmedia_create_decoder(argv[1], &config);
    if (!rmd)
        return -1;
    RawMediaDecoderInfo info;
    rawmedia_get_decoder_info(rmd, &info);

    uint8_t video_buffer[info.video_framebuffer_size];
    uint8_t audio_buffer[info.audio_framebuffer_size];
    rawmedia_decode_video(rmd, video_buffer);
    rawmedia_decode_audio(rmd, audio_buffer);

    rawmedia_destroy_decoder(rmd);
    return 0;
}<commit_msg>Decode into raw output files.<commit_after>#include "rawmedia.h"
#include "decoder.h"
#include <stdio.h>

#define FRAME_RATE ((AVRational){30,1})
#define START_FRAME 15
#define OUTPUT_FRAMES 300

int main(int argc, const char *argv[]) {
    if (argc != 4) {
        fprintf(stderr, "Usage: %s <input-file> <audio-out-file> <video-out-file>\n", argv[0]);
        return -1;
    }
    const char* filename = argv[1];
    const char* audio_filename = argv[2];
    const char* video_filename = argv[3];

    rawmedia_init();
    RawMediaDecoderConfig config = { .framerate = FRAME_RATE,
                                     .start_frame = START_FRAME };
    RawMediaDecoder* rmd = rawmedia_create_decoder(filename, &config);
    if (!rmd)
        return -1;

    FILE* audio_fp = fopen(audio_filename, "w");
    FILE* video_fp = fopen(video_filename, "w");
    if (!audio_fp || !video_fp) {
        fprintf(stderr, "Failed to open output files.\n");
        return -1;
    }

    RawMediaDecoderInfo info;
    if (rawmedia_get_decoder_info(rmd, &info) < 0) {
        fprintf(stderr, "Failed to get decoder info.\n");
        return -1;
    }

    uint8_t video_buffer[info.video_framebuffer_size];
    uint8_t audio_buffer[info.audio_framebuffer_size];
    for (int frame = 0; frame < OUTPUT_FRAMES; frame++) {
        if (rawmedia_decode_video(rmd, video_buffer) < 0) {
            fprintf(stderr, "Failed to decode video.\n");
            return -1;
        }
        if (rawmedia_decode_audio(rmd, audio_buffer) < 0) {
            fprintf(stderr, "Failed to decode audio.\n");
            return -1;
        }
        if (fwrite(video_buffer, sizeof(video_buffer), 1, video_fp) < 1) {
            fprintf(stderr, "Failed to write video.\n");
            return -1;
        }
        if (fwrite(audio_buffer, sizeof(audio_buffer), 1, audio_fp) < 1) {
            fprintf(stderr, "Failed to write audio.\n");
            return -1;
        }
    }

    rawmedia_destroy_decoder(rmd);
    fclose(video_fp);
    fclose(audio_fp);
    return 0;
}
{'fraction_non_alphanumeric': 0.12522885389967045, 'fraction_numerical': 0.015378982057854266, 'mean_word_length': 2.6968876860622464, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6895882', 'n_tokens_mistral': 935, 'n_tokens_neox': 898, 'n_words': 201}