CVS: main/libmp1e Makefile,1.1,1.2 b_mp1e.c,1.1,1.2 global_data.c,1.2,1.3 libmp1e.h,1.2,1.3 main.h,1.1,1.2 options.h,1.1,1.2 rte.c,1.2,1.3 rtepriv.h,1.2,1.3
Update of /cvsroot/mplayer/main/libmp1e In directory mplayer:/var/tmp.root/cvs-serv32532/libmp1e Modified Files: Makefile b_mp1e.c global_data.c libmp1e.h main.h options.h rte.c rtepriv.h Log Message: Quickly removed all audio stuff, audio subdir should be removed from cvs Index: Makefile =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 4 Dec 2001 23:53:53 -0000 1.1 +++ Makefile 10 Jan 2002 21:01:08 -0000 1.2 @@ -3,8 +3,7 @@ LIBNAME = libmp1e.a -SRCS = audio/fft.c audio/filter.c audio/mp2.c audio/psycho.c audio/tables.c \ - common/alloc.c common/bstream.c common/fifo.c common/mmx.c common/profile.c common/sync.c common/errstr.c \ +SRCS = common/alloc.c common/bstream.c common/fifo.c common/mmx.c common/profile.c common/sync.c common/errstr.c \ systems/mpeg1.c systems/mpeg2.c systems/rte_output.c systems/systems.c systems/vcd.c \ video/dct.c video/dct_ref.c video/filter.c video/mblock.c video/motion.c video/mpeg1.c video/tables.c video/vlc.c \ global_data.c b_mp1e.c rte.c @@ -18,8 +17,7 @@ # i386 specific stuff ifeq ($(TARGET_MMX),yes) -ASM_SRCS += audio/filter_mmx.s \ - common/bstream_mmx.s \ +ASM_SRCS += common/bstream_mmx.s \ video/dct_mmx.s video/filter_mmx.s video/motion_mmx.s video/vlc_mmx.s endif Index: b_mp1e.c =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/b_mp1e.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- b_mp1e.c 4 Dec 2001 23:53:53 -0000 1.1 +++ b_mp1e.c 10 Jan 2002 21:01:08 -0000 1.2 @@ -35,8 +35,6 @@ #include "common/mmx.h" #include "common/math.h" #include "video/video.h" -#include "audio/libaudio.h" -#include "audio/mpeg.h" #include "video/mpeg.h" #include "systems/systems.h" #include "common/profile.h" @@ -56,13 +54,11 @@ pthread_t mux_thread; /* mp1e multiplexer thread */ pthread_t video_thread_id; /* video encoder thread */ - pthread_t audio_thread_id; /* audio encoder thread */ /* Experimental */ unsigned int codec_set; rte_codec *video_codec; - rte_codec *audio_codec; } backend_private; @@ -70,9 +66,7 @@ static int rte_fake_options(rte_context * context); /* prototypes for main initialization (mp1e startup) */ /* These routines are called in this order, they come from mp1e's main.c */ -static void rte_audio_startup(void); /* Startup video parameters */ /* init routines */ -static void rte_audio_init(rte_context *context, backend_private *priv); /* init audio capture */ static void rte_video_init(rte_context *context, backend_private *priv); /* init video capture */ /* @@ -123,21 +117,6 @@ if (context->mode == 0) return 0; - if (context->mode & RTE_AUDIO) - { - context->audio_bytes = 4096 * sizeof(short); - - switch (context->audio_mode) - { - case RTE_AUDIO_MODE_STEREO: - context->audio_bytes *= 2; - break; - - default: - break; - } - } - if (!rte_fake_options(context)) return 0; @@ -148,9 +127,6 @@ return 0; } - rte_audio_startup(); - - rte_audio_init(context, priv); rte_video_init(context, priv); if (!output_init()) @@ -170,11 +146,6 @@ { backend_private *priv = (backend_private*)context->private; - if (modules & MOD_AUDIO) { - mp1e_mp2_init(priv->audio_codec, MOD_AUDIO, &priv->priv.aud, - priv->mux); - } - if (modules & MOD_VIDEO) { video_init(priv->video_codec, cpu_type, width, height, motion_min, motion_max, /* preliminary */ @@ -202,20 +173,6 @@ if (modules & MOD_VIDEO) /* Use video as time base (broadcast and v4l2 assumed) */ mp1e_sync_init(modules, MOD_VIDEO); - else if (modules & MOD_SUBTITLES) - mp1e_sync_init(modules, MOD_SUBTITLES); - else - mp1e_sync_init(modules, MOD_AUDIO); - /* else mp1e_sync_init(modules, 0); use TOD */ - - if (modules & MOD_AUDIO) { - ASSERT("create audio compression thread", - !pthread_create(&priv->audio_thread_id, NULL, - priv->audio_codec->class->mainloop, - priv->audio_codec)); - - printv(2, "Audio compression thread launched\n"); - } if (modules & MOD_VIDEO) { ASSERT("create video compression thread", @@ -229,7 +186,6 @@ switch (modules) { case MOD_VIDEO: - case MOD_AUDIO: ASSERT("create elementary stream thread", !pthread_create(&priv->mux_thread, NULL, elementary_stream_bypass, priv->mux)); @@ -262,12 +218,6 @@ printv(2, "video joined\n"); } - if (context->mode & RTE_AUDIO) { - printv(2, "joining audio\n"); - pthread_join(priv->audio_thread_id, NULL); - printv(2, "audio joined\n"); - } - /* Join the mux thread */ printv(2, "joining mux\n"); pthread_join(priv->mux_thread, NULL); @@ -283,7 +233,7 @@ return 0; if (mux_mode) - *mux_mode = RTE_AUDIO_AND_VIDEO; + *mux_mode = RTE_VIDEO; return "mpeg1"; } @@ -300,18 +250,8 @@ status->bytes_out = priv->priv.bytes_out; - if (context->mode == RTE_AUDIO) { - rte_codec *codec = priv->audio_codec; - - pthread_mutex_lock(&codec->mutex); - status->processed_frames = codec->frame_output_count; - pthread_mutex_unlock(&codec->mutex); - - status->dropped_frames = 0; - } else { - status->processed_frames = video_frame_count; - status->dropped_frames = video_frames_dropped; - } + status->processed_frames = video_frame_count; + status->dropped_frames = video_frames_dropped; } static int rte_fake_options(rte_context * context) @@ -388,86 +328,12 @@ grab_width, grab_height, width, height); video_bit_rate = context->output_video_bits; - audio_bit_rate = context->output_audio_bits; - audio_bit_rate_stereo = audio_bit_rate * 2; - - sampling_rate = context->audio_rate; - - switch (context->audio_mode) { - case RTE_AUDIO_MODE_MONO: - audio_mode = AUDIO_MODE_MONO; - break; - case RTE_AUDIO_MODE_STEREO: - audio_mode = AUDIO_MODE_STEREO; - break; - default: - rte_error(context, "unknown audio mode %d", - context->audio_mode); - return 0; - } motion_min = context->motion_min; motion_max = context->motion_max; return 1; } - -/* Startup audio parameters */ -static void rte_audio_startup(void) -{ - if (modules & MOD_AUDIO) { - int psy_level = audio_mode / 10; - - audio_mode %= 10; - - stereo = (audio_mode != AUDIO_MODE_MONO); - audio_parameters(&sampling_rate, &audio_bit_rate); - - if ((audio_bit_rate >> stereo) < 80000 || psy_level >= 1) { - psycho_loops = MAX(psycho_loops, 1); - - if (sampling_rate < 32000 || psy_level >= 2) - psycho_loops = 2; - - psycho_loops = MAX(psycho_loops, 2); - } - } -} - -/* FIXME: Subtitles support */ - -static void rte_audio_init(rte_context *context, backend_private *priv) -/* init audio capture */ -{ - if (modules & MOD_AUDIO) { - if (modules & MOD_VIDEO) - audio_num_frames = llroundn(((double) video_num_frames / - frame_rate_value[context->video_rate]) - / (1152.0 / sampling_rate)); - /* preliminary */ - - if (!priv->audio_codec) { - rte_stream_parameters rsp; - - if (sampling_rate < 32000) - priv->audio_codec = mp1e_mpeg2_layer2_codec.new(); - else - priv->audio_codec = mp1e_mpeg1_layer2_codec.new(); - - assert(priv->audio_codec); - - rte_helper_set_option_va(priv->audio_codec, "sampling_rate", sampling_rate); - rte_helper_set_option_va(priv->audio_codec, "bit_rate", audio_bit_rate); - rte_helper_set_option_va(priv->audio_codec, "audio_mode", - (int) "\1\3\2\0"[audio_mode]); - rte_helper_set_option_va(priv->audio_codec, "psycho", (int) psycho_loops); - - memset(&rsp, 0, sizeof(rsp)); - priv->audio_codec->class->parameters(priv->audio_codec, &rsp); - } - } -} - static void rte_video_init(rte_context *context, backend_private *priv) /* init video capture */ { @@ -500,26 +366,9 @@ } /* Experimental */ - -static rte_codec_class -mp1e_vbi_codec = { - .public = { - .stream_type = RTE_STREAM_SLICED_VBI, - .keyword = "dvb_vbi", - .label = "DVB VBI Stream (Subtitles)", - .tooltip = "Note the recording of Teletext and Closed Caption " - "services in *MPEG-1* Program Streams is not covered " - "by the DVB standard. Unaware players should ignore " - "VBI data.", - }, -}; - static rte_codec_class * codec_table[] = { &mp1e_mpeg1_video_codec, - &mp1e_mpeg1_layer2_codec, - &mp1e_mpeg2_layer2_codec, - &mp1e_vbi_codec, }; #define NUM_CODECS (sizeof(codec_table) / sizeof(codec_table[0])) @@ -552,22 +401,6 @@ goto bad; break; - case RTE_STREAM_AUDIO: - /* find in stream table */ - if ((codec = priv->audio_codec)) - info = priv->audio_codec->class; - else - goto bad; - break; - - case RTE_STREAM_SLICED_VBI: - codec = (rte_codec *) 4; - if (priv->codec_set & 0x08) - info = &mp1e_vbi_codec; - else - goto bad; - break; - default: bad: return NULL; @@ -615,26 +448,6 @@ } break; - - case RTE_STREAM_AUDIO: - if (priv->audio_codec) { - priv->audio_codec->class->delete(priv->audio_codec); - priv->audio_codec = NULL; - /* preliminary */ priv->codec_set &= ~(1 << 1); - } - - if (codec_keyword) { - codec = codec_table[i]->new(); - - if ((priv->audio_codec = codec)) { - codec->context = context; - priv->codec_set |= 1 << 1; - } - } - - break; - - case RTE_STREAM_SLICED_VBI: default: return NULL; /* todo */ } @@ -646,14 +459,6 @@ case 1: context->mode = RTE_VIDEO; break; - case 2: - case 4: - context->mode = RTE_AUDIO; - break; - case 3: - case 5: - context->mode = RTE_AUDIO_AND_VIDEO; - break; default: assert(!"reached"); } @@ -736,9 +541,6 @@ /* Preliminary */ - if (codec != priv->audio_codec) - return 0; - return codec->class->parameters(codec, rsp); } @@ -786,20 +588,6 @@ }, }; -static rte_context_class -mp1e_mpeg1_audio_context = { - .public = { - .keyword = "mp1e-mpeg-audio", - .backend = "mp1e 1.9.2", - .label = N_("MPEG Audio Elementary Stream"), - - .mime_type = "audio/mpeg", - .extension = "mp2,mpga", /* note */ - - .elementary = { 0, 0, 1 }, - }, -}; - static rte_context_class * context_table[] = { &mp1e_mpeg1_ps_context, @@ -878,8 +666,6 @@ context_table[i]->option_print = b_mp1e_info.option_print; context_table[i]->parameters = b_mp1e_info.parameters; } - - mp1e_mp2_module_init(0); return 1; } Index: global_data.c =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/global_data.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- global_data.c 8 Dec 2001 15:35:24 -0000 1.2 +++ global_data.c 10 Jan 2002 21:01:08 -0000 1.3 @@ -36,7 +36,6 @@ #include "common/log.h" #include "common/fifo.h" #include "video/video.h" -#include "audio/mpeg.h" #include "options.h" /* @@ -49,20 +48,6 @@ char * cap_dev = "/dev/video"; -#if defined(HAVE_LIBASOUND) -/* alsa 0.5: card #0, device #0; 0.9: "default" */ -char * pcm_dev = "alsa"; -#elif defined(HAVE_OSS) -char * pcm_dev = "/dev/dsp"; -#elif defined(USE_ESD) -char * pcm_dev = "esd"; -#else -char * pcm_dev = ""; -#endif - -char * mix_dev = "/dev/mixer"; -char * vbi_dev = "/dev/vbi"; - int width = 352; int height = 288; int grab_width = 352; @@ -81,26 +66,7 @@ int motion_max = 0; int skip_method = 0; // compatible -int audio_bit_rate = 80000; -int audio_bit_rate_stereo = 160000; -long long audio_num_frames = INT_MAX; -int sampling_rate = 44100; -int mix_line = 0; -int mix_volume = 80; // 0 <= n <= 100 -int audio_mode = 0; -int psycho_loops = 0; // 0 = static psy, low, hi quality -int mute = 0; // bttv specific, boolean - -char * subtitle_pages = NULL; - -#if LARGE_MEM // XXX make this an option int cap_buffers = 4*12; // capture -> video compression int vid_buffers = 4*8; // video compression -> mux int aud_buffers = 4*32; // audio compression -> mux -#else -int cap_buffers = 12; // capture -> video compression -int vid_buffers = 8; // video compression -> mux -int aud_buffers = 32; // audio compression -> mux -#endif - int cpu_type = 0; // detect Index: libmp1e.h =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/libmp1e.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- libmp1e.h 7 Dec 2001 12:38:41 -0000 1.2 +++ libmp1e.h 10 Jan 2002 21:01:08 -0000 1.3 @@ -33,8 +33,6 @@ */ enum rte_mux_mode { RTE_VIDEO = 1, - RTE_AUDIO = 2, - RTE_AUDIO_AND_VIDEO = 3 /* AUDIO | VIDEO */ }; /* @@ -89,18 +87,6 @@ }; /* - Available audio modes - * to be removed, is a codec option -*/ -enum rte_audio_mode { - RTE_AUDIO_MODE_MONO, - RTE_AUDIO_MODE_STEREO - /* mhs: see man page */ - /* fixme: implement */ -// RTE_AUDIO_MODE_DUAL_CHANNEL -}; - -/* * Some numbers about the running encoding process. * * 2**31 frames = 828 days at 30 fps @@ -149,16 +135,6 @@ chars max, defaults to IBBPBBPBBPBB */ char gop_sequence[1024]; - /******* audio parameters **********/ - /* audio sampling rate in Hz, 44100 by default */ - int audio_rate; - /* Audio mode, defaults to Mono */ - enum rte_audio_mode audio_mode; - /* output audio bits per second, defaults to 80Kbit/s */ - ssize_t output_audio_bits; - /* size in bytes of an audio frame */ - int audio_bytes; - /* last error */ char * error; @@ -352,13 +328,6 @@ ssize_t output_video_bits, const char *gop_sequence); -/* Sets the audio parameters, 0 on error - will be replaced by codec parameters */ -int rte_set_audio_parameters (rte_context * context, - int audio_rate, - enum rte_audio_mode audio_mode, - ssize_t output_audio_bits); - /* Specifies whether to encode audio only, video only or both will be removed, replaced by rte_codec_set */ void rte_set_mode (rte_context * context, enum rte_mux_mode mode); @@ -430,32 +399,6 @@ rte_buffer * buffer ); /* - Pushes an audio sample into the given encoding context. The usage is - similar to push_video_data. - When you push one sample, it is assumed that it contains - context->audio_bytes of audio data with the current context audio - parameters. - The expected audio format is signed 16-bit Little Endian. - A sample is structured as follows: - 2 * (stereo ? 1:2) * 1632 bytes of audio, where the first 1152 - audio atoms (2* (stereo ? 1:2) bytes of audio are considered an - atom) are data, and the remaining 480 atoms belong to the next frame - (so the last atoms will be pushed in the beginning of the next frame). - data: pointer to the data to encode. - time: Timestamp given to the frame, in seconds. - Returns: A pointer to the buffer where you should write the next sample -*/ -void * rte_push_audio_data ( rte_context * context, void * data, - double time ); - -/* - * This is the same as push_audio_data but it uses buffers, thus saving a - * memcpy. You should fill in the fields of buffer as needed. - */ -void rte_push_audio_buffer ( rte_context * context, - rte_buffer * buffer ); - -/* * Sets the verbosity value. */ void rte_set_verbosity ( rte_context * context, int level ); @@ -496,10 +439,7 @@ typedef enum rte_stream_type { RTE_STREAM_VIDEO = 1, /* XXX STREAM :-( need a better term */ - RTE_STREAM_AUDIO, /* input/output distinction? */ - RTE_STREAM_SLICED_VBI, - /* ... */ - RTE_STREAM_MAX = 15 + RTE_STREAM_MAX = 1, } rte_stream_type; typedef struct rte_context_info { @@ -704,12 +644,6 @@ int uv_stride; /* bytes or ignored */ /* scaling? */ } video; - struct rte_audio_stream_parameters { - rte_sndfmt sndfmt; - int sampling_freq; /* Hz */ - int channels; /* mono: 1, stereo: 2 */ - int fragment_size; /* bytes */ - } audio; char pad[128]; } rte_stream_parameters; Index: main.h =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/main.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.h 4 Dec 2001 23:53:53 -0000 1.1 +++ main.h 10 Jan 2002 21:01:08 -0000 1.2 @@ -23,10 +23,6 @@ /* fixme: leave only neccessary prototypes */ extern double video_stop_time; -extern double audio_stop_time; - -extern pthread_t audio_thread_id; -extern int stereo; extern pthread_t video_thread_id; extern void (* video_start)(void); Index: options.h =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/options.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- options.h 4 Dec 2001 23:53:53 -0000 1.1 +++ options.h 10 Jan 2002 21:01:08 -0000 1.2 @@ -45,34 +45,15 @@ extern int motion_max; extern int skip_method; -/* Audio */ - -extern int audio_bit_rate; -extern int audio_bit_rate_stereo; -extern long long audio_num_frames; -extern int sampling_rate; -extern int mix_line; -extern int mix_volume; -extern int audio_mode; -extern int psycho_loops; -extern int mute; // bttv specific - -/* VBI */ - -extern char * subtitle_pages; - /* Multiplexer */ #define MOD_VIDEO 0x01 -#define MOD_AUDIO 0x02 -#define MOD_SUBTITLES 0x04 extern int modules; extern int mux_syn; extern int cap_buffers; extern int vid_buffers; -extern int aud_buffers; extern int cpu_type; Index: rte.c =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/rte.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- rte.c 7 Dec 2001 12:38:41 -0000 1.2 +++ rte.c 10 Jan 2002 21:01:08 -0000 1.3 @@ -39,8 +39,6 @@ #include "video/video.h" /* video_look_ahead, MAX_WIDTH, MAX_HEIGHT */ #include "rtepriv.h" -#define NUM_AUDIO_BUFFERS 4 /* audio buffers in the audio fifo */ - extern rte_backend_info b_mp1e_info; /* Just produces a blank buffer */ @@ -50,9 +48,6 @@ { *time = current_time(); - /* set to 0's (avoid ugly noise on stop) */ - if (stream == RTE_AUDIO) - memset(data, 0, context->audio_bytes); } /* @@ -69,7 +64,7 @@ rteDataCallback *data_callback; rteBufferCallback *buffer_callback; rte_buffer rbuf; - enum rte_mux_mode stream = video ? RTE_VIDEO : RTE_AUDIO; + enum rte_mux_mode stream = video ? RTE_VIDEO : 0; int bytes; nullcheck(context, assert(0)); @@ -80,12 +75,6 @@ data_callback = &(context->private->video_data_callback); buffer_callback = &(context->private->video_buffer_callback); } - else { - p = &context->private->aud_prod; - bytes = context->audio_bytes; - data_callback = &(context->private->audio_data_callback); - buffer_callback = &(context->private->audio_buffer_callback); - } if (*data_callback) { b = wait_empty_buffer(p); @@ -144,12 +133,6 @@ } static void -audio_wait_full(fifo *f) -{ - wait_data((rte_context *) f->user_data, 0); -} - -static void video_send_empty(consumer *c, buffer *b) { rte_buffer rbuf; @@ -169,26 +152,6 @@ send_empty_buffered(c, b); } -static void -audio_send_empty(consumer *c, buffer *b) -{ - rte_buffer rbuf; - fifo *f = c->fifo; - rteUnrefCallback unref_callback = - ((rte_context*)f->user_data)->private->audio_unref_callback; - - if (unref_callback && !(b->rte_flags & BLANK_BUFFER)) { - rbuf.data = b->data; - rbuf.time = b->time; - rbuf.user_data = b->user_data; - - unref_callback((rte_context*)f->user_data, &rbuf); - } - - /* XXX temporary hack */ - send_empty_buffered(c, b); -} - /* The default write data callback */ static void default_write_callback ( rte_context * context, void * data, ssize_t size, @@ -229,7 +192,7 @@ b_mp1e_info.context_new( context ); context->file_name = NULL; - context->mode = RTE_AUDIO_AND_VIDEO; + context->mode = RTE_VIDEO; if (!rte_set_video_parameters(context, RTE_YUV420, width, height, RTE_RATE_3, 2.3e6, @@ -241,15 +204,6 @@ return NULL; } - if (!rte_set_audio_parameters(context, 44100, - RTE_AUDIO_MODE_MONO, 8e4)) { - rte_error(NULL, "invalid audio format: %s", - context->error); - - rte_context_destroy(context); - return NULL; - } - context->private->user_data = user_data; context->private->fd64 = -1; @@ -265,14 +219,6 @@ { nullcheck(context, return); - if (stream & RTE_AUDIO) { - context->private->audio_interface = interface; - context->private->audio_buffered = buffered; - context->private->audio_data_callback = data_callback; - context->private->audio_buffer_callback = - buffer_callback; - context->private->audio_unref_callback = unref_callback; - } if (stream & RTE_VIDEO) { context->private->video_interface = interface; context->private->video_buffered = buffered; @@ -424,33 +370,6 @@ } /* will be removed, replacement codec parameters */ - -/* Sets the audio parameters */ -int rte_set_audio_parameters (rte_context * context, - int audio_rate, - enum rte_audio_mode audio_mode, - ssize_t output_audio_bits) -{ - nullcheck(context, return 0); - - if (context->private->inited) - { - rte_error(context, "context already inited"); - return 0; - } - - if (!(context->mode & RTE_AUDIO)) { - rte_error(context, "current muxmode is without audio"); - return 0; - } - - context->audio_rate = audio_rate; - context->audio_mode = audio_mode; - context->output_audio_bits = output_audio_bits; - - return 1; -} - /* will be removed, replacement codec_get|set */ void rte_set_mode (rte_context * context, enum rte_mux_mode mode) @@ -570,28 +489,6 @@ context->private->vid.user_data = context; } - - if (context->mode & RTE_AUDIO) { - if (!context->private->audio_buffered) - alloc_bytes = context->audio_bytes; - else - alloc_bytes = 0; - - if (4 > init_callback_fifo( - &(context->private->aud), "rte-audio", - NULL, NULL, audio_wait_full, audio_send_empty, - NUM_AUDIO_BUFFERS, alloc_bytes)) { - if (context->mode & RTE_VIDEO) - destroy_fifo(&(context->private->vid)); - rte_error(context, "not enough mem"); - return 0; - } - - assert(add_producer(&(context->private->aud), - &(context->private->aud_prod))); - - context->private->aud.user_data = context; - } if (context->file_name) { context->private->fd64 = creat64(context->file_name, 00644); @@ -601,8 +498,6 @@ context->file_name, strerror(errno), errno); if (context->mode & RTE_VIDEO) destroy_fifo(&(context->private->vid)); - if (context->mode & RTE_AUDIO) - destroy_fifo(&(context->private->aud)); return 0; } @@ -620,8 +515,7 @@ return 0; /* Set up some fields */ - context->private->last_video_buffer = - context->private->last_audio_buffer = NULL; + context->private->last_video_buffer = NULL; /* allow pushing from now */ context->private->inited = 1; @@ -639,8 +533,7 @@ } /* Set up some fields */ - context->private->last_video_buffer = - context->private->last_audio_buffer = NULL; + context->private->last_video_buffer = NULL; if (!b_mp1e_info.start(context)) return 0; @@ -653,7 +546,6 @@ void rte_stop ( rte_context * context ) { - rteDataCallback audio_callback; rteDataCallback video_callback; nullcheck(context, return); @@ -670,23 +562,8 @@ context->private->encoding = 0; /* save for future use */ - audio_callback = context->private->audio_data_callback; video_callback = context->private->video_data_callback; - if ((context->mode & RTE_AUDIO) && - (context->private->audio_interface == RTE_PUSH)) { - buffer *b = context->private->last_audio_buffer; - - /* set to dead end */ - context->private->audio_data_callback = blank_callback; - - if (b) { - context->private->last_audio_buffer = NULL; - b->used = 0; /* EOF */ - send_full_buffer(&(context->private->aud_prod), b); - } - } - if ((context->mode & RTE_VIDEO) && (context->private->video_interface == RTE_PUSH)) { buffer *b = context->private->last_video_buffer; @@ -709,11 +586,7 @@ if (context->mode & RTE_VIDEO) { destroy_fifo(&context->private->vid); } - if (context->mode & RTE_AUDIO) { - destroy_fifo(&context->private->aud); - } - context->private->audio_data_callback = audio_callback; context->private->video_data_callback = video_callback; if (context->private->fd64 > 0) { @@ -806,89 +679,6 @@ send_full_buffer(&(context->private->vid_prod), b); } - -void * rte_push_audio_data ( rte_context * context, void * data, - double time ) -{ - nullcheck(context, return NULL); - - if (!context->private->inited) { - rte_error(NULL, "context not inited\n" - "The context must be encoding for push to work"); - rte_error(context, "context not inited"); - return NULL; - } - if (!(context->mode & RTE_AUDIO)) { - rte_error(context, "Mux isn't prepared to encode audio!"); - return NULL; - } - if (context->private->audio_buffered) { - rte_error(NULL, "use push_buffer, not push_data"); - return NULL; - } - if (!context->private->encoding) { - rte_error(context, "context not encoding, push_audio_data" - " not allowed"); - return NULL; - } - - ASSERT("Arrr... stick to the usage, please\n", - (context->private->last_audio_buffer && data) - || (!context->private->last_audio_buffer && !data)); - - if (data) { - ASSERT("you haven't written to the provided buffer!\n", - data == context->private->last_audio_buffer->data); - - context->private->last_audio_buffer->time = time; - context->private->last_audio_buffer->used = context->audio_bytes; - - send_full_buffer(&(context->private->aud_prod), - context->private->last_audio_buffer); - } - - context->private->last_audio_buffer = - wait_empty_buffer(&(context->private->aud_prod)); - - return context->private->last_audio_buffer->data; -} - -void rte_push_audio_buffer ( rte_context * context, - rte_buffer * rbuf ) -{ - buffer * b; - nullcheck(context, return); - - if (!context->private->inited) { - rte_error(NULL, "context not inited\n" - "The context must be encoding for push to work."); - rte_error(context, "context not inited"); - return; - } - if (!(context->mode & RTE_AUDIO)) { - rte_error(context, "Mux isn't prepared to encode video!"); - return; - } - if (!context->private->audio_buffered) { - rte_error(NULL, "use push_data, not push_buffer"); - return; - } - if (!context->private->encoding) { - rte_error(context, "context not encoding, push_audio_buffer" - " not allowed"); - return; - } - - b = wait_empty_buffer(&(context->private->aud_prod)); - - b->time = rbuf->time; - b->data = rbuf->data; - b->used = context->audio_bytes; - b->user_data = rbuf->user_data; - - send_full_buffer(&(context->private->aud_prod), b); -} - void rte_set_verbosity ( rte_context * context, int level ) { verbose = level; @@ -1025,9 +815,6 @@ if (context->mode & RTE_VIDEO) { destroy_fifo(&context->private->vid); - } - if (context->mode & RTE_AUDIO) { - destroy_fifo(&context->private->aud); } } Index: rtepriv.h =================================================================== RCS file: /cvsroot/mplayer/main/libmp1e/rtepriv.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- rtepriv.h 7 Dec 2001 12:38:41 -0000 1.2 +++ rtepriv.h 10 Jan 2002 21:01:08 -0000 1.3 @@ -215,15 +215,10 @@ int backend; /* backend to be used */ rteEncodeCallback encode_callback; /* save-data Callback */ rteSeekCallback seek_callback; /* seek in file callback */ - rteDataCallback audio_data_callback; /* need audio data */ rteDataCallback video_data_callback; /* need video data */ - rteBufferCallback audio_buffer_callback; /* need audio buffer */ rteBufferCallback video_buffer_callback; /* need video buffer */ - rteUnrefCallback audio_unref_callback; /* audio release */ rteUnrefCallback video_unref_callback; /* video release */ - enum rte_interface audio_interface; /* audio interface */ enum rte_interface video_interface; /* video interface */ - int audio_buffered; /* whether the audio uses buffers or memcpy */ int video_buffered; /* whether the video uses buffers or memcpy */ int fd64; /* file descriptor of the file we are saving */ void * user_data; /* user data given to the callback */ @@ -233,7 +228,6 @@ packing) */ buffer * last_video_buffer; /* video buffer the app should be encoding to */ - buffer * last_audio_buffer; /* audio buffer */ unsigned long long bytes_out; /* sent bytes */ rte_context_class * class;
participants (1)
-
David Holm