Commit f1cb6ad6 authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'master' into dev_android_video

parents 1e320270 dcf3eba1
......@@ -17,6 +17,12 @@ rpm:
# <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206841>
TAR_OPTIONS=--wildcards rpmbuild -ta --clean --rmsource --rmspec $(PACKAGE)-$(VERSION).tar.gz
rpm-novideo:
$(MAKE) dist
# <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206841>
TAR_OPTIONS=--wildcards rpmbuild -ta --clean --rmsource --rmspec --without video $(PACKAGE)-$(VERSION).tar.gz
# `make package'
if WITH_EPM
......
......@@ -152,13 +152,16 @@ AC_DEFUN([MS_CHECK_VIDEO],[
esac],[enable_xv=true])
if test "$enable_xv" = "true"; then
AC_CHECK_HEADERS(X11/extensions/Xv.h,[] ,[enable_xv=false])
AC_CHECK_HEADERS(X11/extensions/Xv.h,[] ,[enable_xv=false])
AC_CHECK_HEADERS(X11/extensions/Xvlib.h,[] ,[enable_xv=false],[
#include <X11/Xlib.h>
])
AC_CHECK_LIB(Xv,XvCreateImage,[LIBS="$LIBS -lXv"])
fi
fi
if ! test "$mingw_found" = "yes" ; then
if test "$enable_xv$sdl_found" == "nono" ; then
if test "$enable_xv$sdl_found" == "falsefalse" ; then
AC_MSG_ERROR([No video output API found. Install either X11+Xv headers or SDL library.])
fi
fi
......
......@@ -118,6 +118,11 @@ LOCAL_CFLAGS += \
-D_POSIX_SOURCE
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS += -DUSE_HARDWARE_RATE=1
endif
#LOCAL_CFLAGS += -DDEBUG
LOCAL_C_INCLUDES += \
......
......@@ -488,9 +488,9 @@ AC_ARG_ENABLE(gsm,
yes) gsm=true ;;
no) gsm=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-gsm) ;;
esac],[gsm=true])
esac],[gsm=auto])
if test x$gsm = xtrue; then
if test x$gsm != xfalse; then
dnl check for gsm
build_gsm=no
......@@ -504,6 +504,8 @@ if test x"$gsmdir" != xno ; then
[${gsmdir}/lib],[gsm/gsm.h],[gsm],[gsm_create])
if test "$GSM_found" = "yes" ; then
build_gsm=yes
elif test "$gsm" = "true"; then
AC_MSG_ERROR([Could not locate gsm headers or library.])
fi
else
build_gsm=no
......@@ -571,13 +573,16 @@ else
package_prefix=${prefix}
fi
PACKAGE_PLUGINS_DIR="\$(libdir)/mediastreamer/plugins"
if test x$mingw_found = xyes ; then
package_prefix="."
PACKAGE_PLUGINS_DIR="./lib/mediastreamer/plugins"
fi
dnl define path of plugins:
AC_DEFINE_UNQUOTED(PACKAGE_PLUGINS_DIR, "${package_prefix}/lib/mediastreamer/plugins" ,[path of plugins])
PACKAGE_PLUGINS_DIR="${package_prefix}/lib/mediastreamer/plugins"
AC_SUBST(PACKAGE_PLUGINS_DIR)
PACKAGE_DATA_DIR="$prefix/share"
......
......@@ -80,6 +80,7 @@ struct _RingStream
MSTicker *ticker;
MSFilter *source;
MSFilter *gendtmf;
MSFilter *write_resampler;
MSFilter *sndwrite;
};
......
# -*- rpm-spec -*-
#
# mediastreamer2 -- A mediastreaming library for telephony applications
# mediastreamer2 -- A media streaming library for telephony applications
#
%ifarch %ix86
......@@ -10,7 +10,7 @@
Summary: Audio/Video real-time streaming
Name: mediastreamer
Version: @MEDIASTREAMER_VERSION@
Release: 1
Release: 2
License: LGPL
Group: Applications/Communications
URL: http://linphone.org/mediastreamer2/
......@@ -46,13 +46,25 @@ develop programs using the mediastreamer2 library.
%endif
%define mediastreamer2_cflags %mediastreamer2_arch_cflags -Wall -g -pipe -pthread -O3 -fomit-frame-pointer -fno-schedule-insns -fschedule-insns2 -fstrict-aliasing
%define opt_with() %{expand:%%global with_%{1} %%{?_with_%{1}:1}%%{?!_with_%{1}:0}}
%define opt_without() %{expand:%%global with_%{1} %%{!?_without_%{1}:1}%%{?_without_%{1}:0}}
%opt_with video - build with video features
%define have_video %{?_with_video:1}%{!?_with_video:0}
%prep
%setup -q
%build
%configure \
--enable-gtk-doc=no \
--enable-shared --enable-static
options="--enable-shared --enable-gsm --enable-static"
%if !%{have_video}
options="$options --disable-video"
%endif
%configure $options
make -j$RPM_BUILD_NCPUS CFLAGS="%mediastreamer2_cflags" CXXFLAGS="%mediastreamer2_cflags"
%install
......@@ -64,17 +76,19 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
%{_libdir}/*.so.*
/usr/share/images/nowebcamCIF.jpg
%{_libexecdir}
%files devel
%defattr(-,root,root,-)
%doc docs/html
%{_libdir}/*.la
%{_libdir}/*.a
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}
%{_docdir}
%changelog
* Tue Oct 25 2005 Francois-Xavier Kowalski <fix@hp.com>
......
......@@ -197,7 +197,8 @@ AM_CFLAGS= -I$(top_srcdir) \
$(SPEEX_CFLAGS) \
$(GSM_CFLAGS) \
$(STRICT_OPTIONS) \
$(LIBPULSE_CFLAGS)
$(LIBPULSE_CFLAGS) \
-DPACKAGE_PLUGINS_DIR=\"$(PACKAGE_PLUGINS_DIR)\"
AM_CXXFLAGS= -I$(top_srcdir) \
$(ORTP_CFLAGS) \
......
......@@ -891,7 +891,7 @@ void alsa_read_process(MSFilter *obj){
freemsg(om);
return;
}
size=err*2;
size=err*2*ad->nchannels;
om->b_wptr+=size;
/*ms_message("alsa_read_process: Outputing %i bytes",size);*/
ms_queue_put(obj->outputs[0],om);
......
......@@ -588,6 +588,9 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard
{
RingStream *stream;
int tmp;
int srcrate,dstrate;
MSConnectionHelper h;
stream=(RingStream *)ms_new0(RingStream,1);
stream->source=ms_filter_new(MS_FILE_PLAYER_ID);
if (file)
......@@ -601,16 +604,28 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard
stream->sndwrite=ms_snd_card_create_writer(sndcard);
ms_filter_call_method(stream->source,MS_FILTER_GET_SAMPLE_RATE,&tmp);
ms_filter_call_method(stream->gendtmf,MS_FILTER_SET_SAMPLE_RATE,&tmp);
ms_filter_call_method(stream->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&tmp);
ms_filter_call_method(stream->source,MS_FILTER_GET_SAMPLE_RATE,&srcrate);
ms_filter_call_method(stream->gendtmf,MS_FILTER_SET_SAMPLE_RATE,&srcrate);
ms_filter_call_method(stream->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&srcrate);
ms_filter_call_method(stream->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&dstrate);
if (srcrate!=dstrate){
stream->write_resampler=ms_filter_new(MS_RESAMPLE_ID);
ms_filter_call_method(stream->write_resampler,MS_FILTER_SET_SAMPLE_RATE,&srcrate);
ms_filter_call_method(stream->write_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&dstrate);
ms_message("configuring resampler from rate[%i] to rate [%i]", srcrate,dstrate);
}
ms_filter_call_method(stream->source,MS_FILTER_GET_NCHANNELS,&tmp);
ms_filter_call_method(stream->gendtmf,MS_FILTER_SET_NCHANNELS,&tmp);
ms_filter_call_method(stream->sndwrite,MS_FILTER_SET_NCHANNELS,&tmp);
stream->ticker=ms_ticker_new();
ms_ticker_set_name(stream->ticker,"Audio (ring) MSTicker");
ms_filter_link(stream->source,0,stream->gendtmf,0);
ms_filter_link(stream->gendtmf,0,stream->sndwrite,0);
ms_connection_helper_start(&h);
ms_connection_helper_link(&h,stream->source,-1,0);
ms_connection_helper_link(&h,stream->gendtmf,0,0);
if (stream->write_resampler)
ms_connection_helper_link(&h,stream->write_resampler,0,0);
ms_connection_helper_link(&h,stream->sndwrite,0,-1);
ms_ticker_attach(stream->ticker,stream->source);
return stream;
}
......@@ -626,9 +641,16 @@ void ring_stop_dtmf(RingStream *stream){
}
void ring_stop(RingStream *stream){
MSConnectionHelper h;
ms_ticker_detach(stream->ticker,stream->source);
ms_filter_unlink(stream->source,0,stream->gendtmf,0);
ms_filter_unlink(stream->gendtmf,0,stream->sndwrite,0);
ms_connection_helper_start(&h);
ms_connection_helper_unlink(&h,stream->source,-1,0);
ms_connection_helper_unlink(&h,stream->gendtmf,0,0);
if (stream->write_resampler)
ms_connection_helper_unlink(&h,stream->write_resampler,0,0);
ms_connection_helper_unlink(&h,stream->sndwrite,0,-1);
ms_ticker_destroy(stream->ticker);
ms_filter_destroy(stream->source);
ms_filter_destroy(stream->gendtmf);
......
......@@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern "C" {
#endif
#define MS_LAYOUT_MIN_SIZE 40
void ms_layout_compute(MSVideoSize wsize, MSVideoSize vsize, MSVideoSize orig_psize,
int localrect_pos, float scalefactor, MSRect *mainrect, MSRect *localrect);
......
......@@ -416,18 +416,17 @@ MS_FILTER_DESC_EXPORT(msandroid_sound_read_desc)
/***********************************write filter********************/
static int set_write_rate(MSFilter *f, void *arg){
msandroid_sound_data *d=(msandroid_sound_data*)f->data;
#ifndef USE_HARDWARE_RATE
int proposed_rate = *((int*)arg);
ms_debug("set_rate %d",proposed_rate);
msandroid_sound_data *d=(msandroid_sound_data*)f->data;
d->rate=proposed_rate;
return 0;
/*d->rate=44100; //to improve latency on msn 7k
if (proposed_rate == d->rate) {
return 0;
} else {
return d->rate;
}
*/
#else
/*audioflingler resampling is really bad
we prefer do resampling by ourselves if cpu allows it*/
return -1;
#endif
}
MSFilterMethod msandroid_sound_write_methods[]={
......@@ -441,15 +440,40 @@ MSFilterMethod msandroid_sound_write_methods[]={
class msandroid_sound_write_data : public msandroid_sound_data{
public:
msandroid_sound_write_data() :audio_track_class(0),audio_track(0),write_chunk_size(0),writtenBytes(0),last_sample_date(0){
JNIEnv *jni_env=NULL;
bufferizer = ms_bufferizer_new();
ms_cond_init(&cond,0);
if (jvm->AttachCurrentThread(&jni_env,NULL)!=0){
ms_error("msandroid_sound_write_data(): could not attach current thread.");
return;
}
audio_track_class = (jclass)jni_env->NewGlobalRef(jni_env->FindClass("android/media/AudioTrack"));
if (audio_track_class == 0) {
ms_error("cannot find android/media/AudioTrack\n");
return;
}
jmethodID hwrate_id = jni_env->GetStaticMethodID(audio_track_class,"getNativeOutputSampleRate", "(I)I");
if (hwrate_id == 0) {
ms_error("cannot find int AudioRecord.getNativeOutputSampleRate(int streamType)");
return;
}
rate = jni_env->CallStaticIntMethod(audio_track_class,hwrate_id,0 /*STREAM_VOICE_CALL*/);
ms_message("Hardware sample rate is %i",rate);
};
~msandroid_sound_write_data() {
JNIEnv *jni_env=NULL;
ms_mutex_lock(&mutex);
ms_bufferizer_flush(bufferizer);
ms_mutex_unlock(&mutex);
ms_bufferizer_destroy(bufferizer);
ms_cond_destroy(&cond);
if (audio_track_class!=0){
if (jvm->AttachCurrentThread(&jni_env,NULL)!=0){
ms_error("~msandroid_sound_write_data(): could not attach current thread.");
return;
}
jni_env->DeleteGlobalRef(audio_track_class);
}
}
jclass audio_track_class;
jobject audio_track;
......@@ -551,9 +575,8 @@ void msandroid_sound_write_preprocess(MSFilter *f){
ms_error("cannot attach VM\n");
goto end;
}
d->audio_track_class = (jclass)jni_env->NewGlobalRef(jni_env->FindClass("android/media/AudioTrack"));
if (d->audio_track_class == 0) {
ms_error("cannot find android/media/AudioTrack\n");
goto end;
}
......@@ -667,7 +690,6 @@ void msandroid_sound_write_postprocess(MSFilter *f){
goto end;
end: {
if (d->audio_track) jni_env->DeleteGlobalRef(d->audio_track);
jni_env->DeleteGlobalRef(d->audio_track_class);
//d->jvm->DetachCurrentThread();
return;
}
......
......@@ -304,7 +304,7 @@ static int enc_add_fmtp(MSFilter *f, void *arg){
s->mode=atoi(buf);
}
else {
s->mode = -1; /* deault mode */
s->mode = -1; /* default mode */
}
return 0;
}
......
......@@ -176,8 +176,10 @@ static void choose_display_name(VideoStream *stream){
stream->display_name=ms_strdup("MSDrawDibDisplay");
#elif defined(ANDROID)
stream->display_name=ms_strdup("MSAndroidDisplay");
#else
#elif defined (HAVE_X11_EXTENSIONS_XV_H)
stream->display_name=ms_strdup("MSX11Video");
#else
stream->display_name=ms_strdup("MSVideoOut");
#endif
}
......
......@@ -181,6 +181,10 @@ static void x11video_prepare(MSFilter *f){
}
XGetWindowAttributes(s->display,s->window_id,&wa);
ms_message("Window has size %i,%i",wa.width,wa.height);
if (wa.width<MS_LAYOUT_MIN_SIZE || wa.height<MS_LAYOUT_MIN_SIZE){
return;
}
s->fbuf.w=wa.width & ~0x1;
s->fbuf.h=wa.height & ~0x1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment