view stream/audio_in.h @ 24787:02535b3216c5

Avoid text deformation and subtitles moving outside the screen in pan-and-scan mode. For this, crop amounts are passed from vo_gl as negative margins sizes. They are used to calculate aspect ratio. They are ignored when calculating subtitle positions, so subtitles will stay on screen most of the time. Based on a patch by Jindrich Makovicka [makovick gmail com].
author eugeni
date Fri, 19 Oct 2007 18:16:23 +0000
parents 3f0d00abc073
children 4129c8cfa742
line wrap: on
line source

#ifndef AUDIO_IN_H
#define AUDIO_IN_H

#define AUDIO_IN_ALSA 1
#define AUDIO_IN_OSS 2

#include "config.h"

#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
#include <alsa/asoundlib.h>

typedef struct {
    char *device;

    snd_pcm_t *handle;
    snd_output_t *log;
    int buffer_time, period_time, chunk_size;
    size_t bits_per_sample, bits_per_frame;
} ai_alsa_t;
#endif

#ifdef USE_OSS_AUDIO
typedef struct {
    char *device;

    int audio_fd;
} ai_oss_t;
#endif

typedef struct 
{
    int type;
    int setup;
    
    /* requested values */
    int req_channels;
    int req_samplerate;

    /* real values read-only */
    int channels;
    int samplerate;
    int blocksize;
    int bytes_per_sample;
    int samplesize;
    
#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
    ai_alsa_t alsa;
#endif
#ifdef USE_OSS_AUDIO
    ai_oss_t oss;
#endif
} audio_in_t;

int audio_in_init(audio_in_t *ai, int type);
int audio_in_setup(audio_in_t *ai);
int audio_in_set_device(audio_in_t *ai, char *device);
int audio_in_set_samplerate(audio_in_t *ai, int rate);
int audio_in_set_channels(audio_in_t *ai, int channels);
int audio_in_uninit(audio_in_t *ai);
int audio_in_start_capture(audio_in_t *ai);
int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer);

#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
int ai_alsa_setup(audio_in_t *ai);
int ai_alsa_init(audio_in_t *ai);
int ai_alsa_xrun(audio_in_t *ai);
#endif

#ifdef USE_OSS_AUDIO
int ai_oss_set_samplerate(audio_in_t *ai);
int ai_oss_set_channels(audio_in_t *ai);
int ai_oss_init(audio_in_t *ai);
#endif

#endif /* AUDIO_IN_H */