[Mplayer-cvslog] CVS: main/libao2 ao_pcm.c,NONE,1.1 audio_out.c,1.8,1.9 Makefile,1.5,1.6

Felix Buenemann atmosfear at users.sourceforge.net
Tue Jun 12 13:00:17 CEST 2001


Update of /cvsroot/mplayer/main/libao2
In directory usw-pr-cvs1:/tmp/cvs-serv28700

Modified Files:
	audio_out.c Makefile 
Added Files:
	ao_pcm.c 
Log Message:
Added raw PCM writer ao driver.


--- NEW FILE ---
#include <stdio.h>
#include <stdlib.h>

#include "audio_out.h"
#include "audio_out_internal.h"

static ao_info_t info = 
{
	"PCM writer audio output",
	"pcm",
	"Atmosfear",
	""
};

LIBAO_EXTERN(pcm)

// there are some globals:
// ao_samplerate
// ao_channels
// ao_format
// ao_bps
// ao_outburst
// ao_buffersize

static FILE *fp = NULL;

// to set/get/query special features/parameters
static int control(int cmd,int arg){
    return -1;
}

// open & setup audio device
// return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags){
	
	printf("PCM: File: audiodump.pcm Samplerate: %iHz Channels: %s Format %s\n", rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format));
	printf("PCM: Info - fastest dumping is achieved with -vo null -hardframedrop.\n");
	fp = fopen("audiodump.pcm", "wb");

	ao_outburst = 4096;


	if(fp) return 1;
	printf("PCM: Failed to open audiodump.pcm for writing!\n");
	return 0;
}

// close audio device
static void uninit(){
	fclose(fp);
}

// stop playing and empty buffers (for seeking/pause)
static void reset(){

}

// stop playing, keep buffers (for pause)
static void audio_pause()
{
    // for now, just call reset();
    reset();
}

// resume playing, after audio_pause()
static void audio_resume()
{
}

// return: how many bytes can be played without blocking
static int get_space(){

    return ao_outburst;
}

// plays 'len' bytes of 'data'
// it should round it down to outburst*n
// return: number of bytes played
static int play(void* data,int len,int flags){

	//printf("PCM: Writing chunk!\n");
	fwrite(data,len,1,fp);
	
	return len;
}

// return: how many unplayed bytes are in the buffer
static int get_delay(){

    return 0;
}







Index: audio_out.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/audio_out.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** audio_out.c	2001/06/08 23:31:06	1.8
--- audio_out.c	2001/06/12 11:00:15	1.9
***************
*** 34,37 ****
--- 34,38 ----
  extern ao_functions_t audio_out_sun;
  #endif
+ extern ao_functions_t audio_out_pcm;
  
  ao_functions_t* audio_out_drivers[] =
***************
*** 56,59 ****
--- 57,61 ----
          &audio_out_sun,
  #endif
+ 	&audio_out_pcm,
  	NULL
  };

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Makefile	2001/06/05 18:40:44	1.5
--- Makefile	2001/06/12 11:00:15	1.6
***************
*** 5,9 ****
  
  # TODO: moveout ao_sdl.c so it's only used when SDL is detected
! SRCS=audio_out.c ao_null.c $(OPTIONAL_SRCS)
  OBJS=$(SRCS:.c=.o)
  
--- 5,9 ----
  
  # TODO: moveout ao_sdl.c so it's only used when SDL is detected
! SRCS=audio_out.c ao_null.c ao_pcm.c $(OPTIONAL_SRCS)
  OBJS=$(SRCS:.c=.o)
  


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list