<commit_before>#include "silence_generator.h"
#include "frames_source_memory.h"
#include "../media_set_parser.h"
#include "../mp4/mp4_defs.h"
#include "../media_set.h"

#define AAC_FRAME_SAMPLES (1024)
#define AAC_SILENCE_FRAME ("\x21\x00\x49\x90\x02\x19\x00\x23\x80")
#define AAC_SILENCE_FRAME_SIZE (sizeof(AAC_SILENCE_FRAME) - 1)

vod_status_t
silence_generator_parse(
	void* ctx,
	vod_json_object_t* element,
	void** result)
{
	media_filter_parse_context_t* context = ctx;
	media_clip_source_t* source;

	source = vod_alloc(context->request_context->pool, sizeof(*source));
	if (source == NULL)
	{
		vod_log_debug0(VOD_LOG_DEBUG_LEVEL, context->request_context->log, 0,
			"media_set_parse_silence_generator: vod_alloc failed");
		return VOD_ALLOC_FAILED;
	}

	vod_memzero(source, sizeof(*source));

	source->base.type = MEDIA_CLIP_SILENCE_GENERATOR;

	source->sequence = context->sequence;
	source->range = context->range;
	source->clip_time = context->clip_time;
	source->tracks_mask[MEDIA_TYPE_AUDIO] = 1;

	if (context->duration == UINT_MAX)
	{
		source->clip_to = ULLONG_MAX;
	}
	else
	{
		source->clip_to = context->duration;
	}

	source->next = context->generators_head;
	context->generators_head = source;

	vod_log_debug0(VOD_LOG_DEBUG_LEVEL, context->request_context->log, 0,
		"media_set_parse_silence_generator: parsed silence source");

	*result = &source->base;

	return VOD_OK;
}

static vod_status_t
silence_generator_generate(<commit_msg>fix log lines<commit_after>#include "silence_generator.h"
#include "frames_source_memory.h"
#include "../media_set_parser.h"
#include "../mp4/mp4_defs.h"
#include "../media_set.h"

#define AAC_FRAME_SAMPLES (1024)
#define AAC_SILENCE_FRAME ("\x21\x00\x49\x90\x02\x19\x00\x23\x80")
#define AAC_SILENCE_FRAME_SIZE (sizeof(AAC_SILENCE_FRAME) - 1)

vod_status_t
silence_generator_parse(
	void* ctx,
	vod_json_object_t* element,
	void** result)
{
	media_filter_parse_context_t* context = ctx;
	media_clip_source_t* source;

	source = vod_alloc(context->request_context->pool, sizeof(*source));
	if (source == NULL)
	{
		vod_log_debug0(VOD_LOG_DEBUG_LEVEL, context->request_context->log, 0,
			"silence_generator_parse: vod_alloc failed");
		return VOD_ALLOC_FAILED;
	}

	vod_memzero(source, sizeof(*source));

	source->base.type = MEDIA_CLIP_SILENCE_GENERATOR;

	source->sequence = context->sequence;
	source->range = context->range;
	source->clip_time = context->clip_time;
	source->tracks_mask[MEDIA_TYPE_AUDIO] = 1;

	if (context->duration == UINT_MAX)
	{
		source->clip_to = ULLONG_MAX;
	}
	else
	{
		source->clip_to = context->duration;
	}

	source->next = context->generators_head;
	context->generators_head = source;

	vod_log_debug0(VOD_LOG_DEBUG_LEVEL, context->request_context->log, 0,
		"silence_generator_parse: parsed silence source");

	*result = &source->base;

	return VOD_OK;
}

static vod_status_t
silence_generator_generate(
{'fraction_non_alphanumeric': 0.13121546961325967, 'fraction_numerical': 0.020718232044198894, 'mean_word_length': 5.980722891566265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6862159', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1123, 'n_words': 171}