cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

raw_encoder.h (1998B)


      1/*
      2 * Licensed to the Apache Software Foundation (ASF) under one
      3 * or more contributor license agreements.  See the NOTICE file
      4 * distributed with this work for additional information
      5 * regarding copyright ownership.  The ASF licenses this file
      6 * to you under the Apache License, Version 2.0 (the
      7 * "License"); you may not use this file except in compliance
      8 * with the License.  You may obtain a copy of the License at
      9 *
     10 *   http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing,
     13 * software distributed under the License is distributed on an
     14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     15 * KIND, either express or implied.  See the License for the
     16 * specific language governing permissions and limitations
     17 * under the License.
     18 */
     19
     20
     21#ifndef GUAC_RAW_ENCODER_H
     22#define GUAC_RAW_ENCODER_H
     23
     24#include "config.h"
     25
     26#include "guacamole/audio.h"
     27
     28/**
     29 * The number of bytes to send in each audio blob.
     30 */
     31#define GUAC_RAW_ENCODER_BLOB_SIZE 6048
     32
     33/**
     34 * The size of the raw encoder output PCM buffer, in milliseconds. The
     35 * equivalent size in bytes will vary by PCM rate, number of channels, and bits
     36 * per sample.
     37 */
     38#define GUAC_RAW_ENCODER_BUFFER_SIZE 250
     39
     40/**
     41 * The current state of the raw encoder. The raw encoder performs very minimal
     42 * processing, buffering provided PCM data only as necessary to ensure audio
     43 * packet sizes are reasonable.
     44 */
     45typedef struct raw_encoder_state {
     46
     47    /**
     48     * Buffer of not-yet-written raw PCM data.
     49     */
     50    unsigned char* buffer;
     51
     52    /**
     53     * Size of the PCM buffer, in bytes.
     54     */
     55    size_t length;
     56
     57    /**
     58     * The current number of bytes stored within the PCM buffer.
     59     */
     60    int written;
     61
     62} raw_encoder_state;
     63
     64/**
     65 * Audio encoder which writes 8-bit raw PCM (one byte per sample).
     66 */
     67extern guac_audio_encoder* raw8_encoder;
     68
     69/**
     70 * Audio encoder which writes 16-bit raw PCM (two bytes per sample).
     71 */
     72extern guac_audio_encoder* raw16_encoder;
     73
     74#endif
     75