support for large video formats

bugfixing in SDL video output



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@120 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
smorlat 2008-10-27 12:43:40 +00:00
parent 94f6bf426d
commit fb113617c3
14 changed files with 492 additions and 389 deletions

View file

@ -1460,7 +1460,7 @@ void linphone_core_stop_media_streams(LinphoneCore *lc){
}
if (linphone_core_video_preview_enabled(lc)){
if (lc->previewstream==NULL){
lc->previewstream=video_preview_start(lc->video_conf.device);
lc->previewstream=video_preview_start(lc->video_conf.device, lc->video_conf.vsize);
}
}
#endif
@ -1940,7 +1940,8 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){
if (lc->videostream==NULL){
if (val){
if (lc->previewstream==NULL){
lc->previewstream=video_preview_start(lc->video_conf.device);
lc->previewstream=video_preview_start(lc->video_conf.device,
lc->video_conf.vsize);
}
}else{
if (lc->previewstream!=NULL){
@ -2045,8 +2046,14 @@ static bool_t video_size_supported(MSVideoSize vsize){
void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize){
if (video_size_supported(vsize))
if (video_size_supported(vsize)){
MSVideoSize oldvsize=lc->video_conf.vsize;
lc->video_conf.vsize=vsize;
if (!ms_video_size_equal(oldvsize,vsize) && lc->previewstream!=NULL){
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
}
}
void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name){

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Tue Oct 21 21:25:07 2008 -->
<!--Generated with glade3 3.4.5 on Sat Oct 25 21:56:03 2008 -->
<glade-interface>
<widget class="GtkWindow" id="parameters">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -118,48 +118,18 @@
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">SIP (UDP):</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Audio RTP/UDP:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Video RTP/UDP:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="sip_port">
<widget class="GtkSpinButton" id="video_rtp_port">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">1 1 65535 1 10 10</property>
<signal name="value_changed" handler="linphone_gtk_sip_port_changed"/>
<signal name="value_changed" handler="linphone_gtk_video_port_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
@ -178,20 +148,50 @@
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="video_rtp_port">
<widget class="GtkSpinButton" id="sip_port">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">1 1 65535 1 10 10</property>
<signal name="value_changed" handler="linphone_gtk_video_port_changed"/>
<signal name="value_changed" handler="linphone_gtk_sip_port_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Video RTP/UDP:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Audio RTP/UDP:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">SIP (UDP):</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -397,145 +397,6 @@
<child>
<placeholder/>
</child>
<child>
<widget class="GtkCheckButton" id="echo_cancelation">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable echo cancellation</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="linphone_gtk_echo_cancelation_toggled"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="playback_device">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">a sound card
</property>
<signal name="changed" handler="linphone_gtk_playback_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label32">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Playback device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label34">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Ring device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label35">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Capture device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label36">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">ALSA special device (optional):</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="ring_device">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">default soundcard</property>
<signal name="changed" handler="linphone_gtk_ring_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="capture_device">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">default soundcard
</property>
<signal name="changed" handler="linphone_gtk_capture_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="alsa_dev">
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="editing_done" handler="linphone_gtk_alsa_special_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Ring sound:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox19">
<property name="visible">True</property>
@ -571,6 +432,145 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Ring sound:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="alsa_dev">
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="editing_done" handler="linphone_gtk_alsa_special_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="capture_device">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">default soundcard
</property>
<signal name="changed" handler="linphone_gtk_capture_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="ring_device">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">default soundcard</property>
<signal name="changed" handler="linphone_gtk_ring_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label36">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">ALSA special device (optional):</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label35">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Capture device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label34">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Ring device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label32">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Playback device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="playback_device">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">a sound card
</property>
<signal name="changed" handler="linphone_gtk_playback_device_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="echo_cancelation">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable echo cancellation</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="linphone_gtk_echo_cancelation_toggled"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
</widget>
</child>
</widget>
@ -602,25 +602,13 @@
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkComboBox" id="video_size">
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<signal name="changed" handler="linphone_gtk_video_size_changed"/>
<property name="label" translatable="yes">Video input device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">Prefered video resolution:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
@ -636,13 +624,27 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label9">
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">Video input device:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="label" translatable="yes">Prefered video resolution:</property>
</widget>
<packing>
<property name="y_options">GTK_EXPAND</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="video_size">
<property name="visible">True</property>
<property name="active">0</property>
<property name="items" translatable="yes">CIF</property>
<signal name="changed" handler="linphone_gtk_video_size_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</widget>
@ -720,15 +722,42 @@
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkEntry" id="sip_address">
<widget class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your display name (eg: John Doe):</property>
</widget>
</child>
<child>
<widget class="GtkEntry" id="displayname">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="editable">False</property>
<signal name="changed" handler="linphone_gtk_update_my_contact"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your username:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your resulting SIP address:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
@ -748,46 +777,19 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your resulting SIP address:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your username:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="displayname">
<widget class="GtkEntry" id="sip_address">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="changed" handler="linphone_gtk_update_my_contact"/>
<property name="editable">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your display name (eg: John Doe):</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -1306,21 +1308,17 @@ Video codecs</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label22">
<widget class="GtkSpinButton" id="upload_bw">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Download speed limit in Kbit/sec:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Upload speed limit in Kbit/sec:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="tooltip" translatable="yes">0 stands for "unlimited"</property>
<property name="adjustment">0 -1 100000 1 10 10</property>
<signal name="value_changed" handler="linphone_gtk_upload_bw_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
@ -1340,21 +1338,25 @@ Video codecs</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="upload_bw">
<widget class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">0 stands for "unlimited"</property>
<property name="adjustment">0 -1 100000 1 10 10</property>
<signal name="value_changed" handler="linphone_gtk_upload_bw_changed"/>
<property name="label" translatable="yes">Upload speed limit in Kbit/sec:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Download speed limit in Kbit/sec:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
</child>
</widget>
</child>
</widget>

View file

@ -33,6 +33,23 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices,
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
}
void linphone_gtk_fill_video_sizes(GtkWidget *combo){
const MSVideoSizeDef *def=linphone_core_get_supported_video_sizes(linphone_gtk_get_core());;
int i,active=0;
char vsize_def[256];
MSVideoSize cur=linphone_core_get_preferred_video_size(linphone_gtk_get_core());
/* glade creates a combo box without list model and text renderer,
unless we fill it with a dummy text.
This dummy text needs to be removed first*/
gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0);
for(i=0;def->name!=NULL;++def,++i){
snprintf(vsize_def,sizeof(vsize_def),"%s (%ix%i)",def->name,def->vsize.width,def->vsize.height);
gtk_combo_box_append_text(GTK_COMBO_BOX(combo),vsize_def);
if (cur.width==def->vsize.width && cur.height==def->vsize.height) active=i;
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
}
void linphone_gtk_parameters_closed(GtkWidget *button){
GtkWidget *pb=gtk_widget_get_toplevel(button);
gtk_widget_destroy(pb);
@ -153,6 +170,14 @@ void linphone_gtk_cam_changed(GtkWidget *w){
g_free(sel);
}
void linphone_gtk_video_size_changed(GtkWidget *w){
int sel=gtk_combo_box_get_active(GTK_COMBO_BOX(w));
const MSVideoSizeDef *defs=linphone_core_get_supported_video_sizes(linphone_gtk_get_core());
if (defs<0) return;
linphone_core_set_preferred_video_size(linphone_gtk_get_core(),
defs[sel].vsize);
}
void linphone_gtk_ring_file_set(GtkWidget *w){
gchar *file=gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(w));
linphone_core_set_ring(linphone_gtk_get_core(),file);
@ -623,6 +648,7 @@ void linphone_gtk_show_parameters(void){
linphone_core_get_capture_device(lc));
linphone_gtk_fill_combo_box(linphone_gtk_get_widget(pb,"webcams"),linphone_core_get_video_devices(lc),
linphone_core_get_video_device(lc));
linphone_gtk_fill_video_sizes(linphone_gtk_get_widget(pb,"video_size"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"echo_cancelation")),
linphone_core_echo_cancelation_enabled(lc));

View file

@ -101,17 +101,24 @@ AC_DEFUN([MS_CHECK_VIDEO],[
PKG_CHECK_MODULES(SWSCALE, [libswscale >= 0.5.0 ], [echo "We have libswscale"],
[echo "We don't have libswscale, let's hope its symbols are in libavcodec"] )
MS_CHECK_DEP([SDL],[SDL],[${libsdldir}/include],[${libsdldir}/lib],[SDL/SDL.h],[SDL],[SDL_Init])
if test "$SDL_found" = "no" ; then
AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
if test "$libsdldir" != "none" ; then
MS_CHECK_DEP([SDL],[SDL],[${libsdldir}/include],[${libsdldir}/lib],[SDL/SDL.h],[SDL],[SDL_Init])
if test "$SDL_found" = "no" ; then
AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
fi
fi
PKG_CHECK_MODULES(THEORA, [theora >= 1.0alpha7 ], [have_theora=yes],
[have_theora=no])
AC_CHECK_HEADERS(X11/Xlib.h)
VIDEO_CFLAGS=" $FFMPEG_CFLAGS $SDL_CFLAGS -DVIDEO_ENABLED "
VIDEO_LIBS=" $FFMPEG_LIBS $SWSCALE_LIBS $SDL_LIBS"
VIDEO_CFLAGS=" $FFMPEG_CFLAGS -DVIDEO_ENABLED"
VIDEO_LIBS=" $FFMPEG_LIBS $SWSCALE_LIBS"
if test "$SDL_found" = "yes" ; then
VIDEO_CFLAGS="$VIDEO_CFLAGS $SDL_CFLAGS -DHAVE_SDL"
VIDEO_LIBS="$VIDEO_LIBS $SDL_LIBS"
fi
if test "${ac_cv_header_X11_Xlib_h}" = "yes" ; then
VIDEO_LIBS="$VIDEO_LIBS -lX11"

View file

@ -21,10 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef MEDIASTREAM_H
#define MEDIASTREAM_H
#include "msfilter.h"
#include "msticker.h"
#include "mssndcard.h"
#include "mswebcam.h"
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msticker.h"
#include "mediastreamer2/mssndcard.h"
#include "mediastreamer2/mswebcam.h"
#include "mediastreamer2/msvideo.h"
#include "ortp/ortp.h"
#include "ortp/event.h"
@ -119,11 +120,12 @@ struct _VideoStream
MSFilter *rtprecv;
MSFilter *rtpsend;
OrtpEvQueue *evq;
MSVideoSize sent_vsize;
bool_t adapt_bitrate;
};
typedef struct _VideoStream VideoStream;
VideoStream *video_stream_new(int locport, bool_t use_ipv6);
void video_stream_enable_adaptive_bitrate_control(VideoStream *s, bool_t yesno);
int video_stream_start(VideoStream * stream, RtpProfile *profile, const char *remip, int remport, int rem_rtcp_port,
@ -133,9 +135,10 @@ void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const
/*function to call periodically to handle various events */
void video_stream_iterate(VideoStream *stream);
void video_stream_send_vfu(VideoStream *stream);
void video_stream_stop (VideoStream * stream);
void video_stream_stop(VideoStream * stream);
void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize);
VideoStream * video_preview_start(MSWebCam *device);
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize vsize);
void video_preview_stop(VideoStream *stream);
int video_stream_recv_only_start(VideoStream * stream, RtpProfile *profile, const char *remip, int remport, int payload, int jitt_comp);

View file

@ -48,11 +48,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_VIDEO_SIZE_1024_W 1024
#define MS_VIDEO_SIZE_1024_H 768
#define MS_VIDEO_SIZE_800X600_W 800
#define MS_VIDEO_SIZE_800X600_H 600
#define MS_VIDEO_SIZE_MAX_W MS_VIDEO_SIZE_1024_W
#define MS_VIDEO_SIZE_MAX_H MS_VIDEO_SIZE_1024_H
typedef struct MSVideoSize{
int width,height;
int16_t width,height;
} MSVideoSize;
typedef struct MSRect{
@ -73,6 +76,24 @@ typedef struct MSRect{
#define MS_VIDEO_SIZE_1024 (MSVideoSize){MS_VIDEO_SIZE_1024_W, MS_VIDEO_SIZE_1024_H}
#define MS_VIDEO_SIZE_800X600 (MSVideoSize){MS_VIDEO_SIZE_800X600_W, MS_VIDEO_SIZE_800X600_H}
static inline bool_t ms_video_size_greater_than(MSVideoSize vs1, MSVideoSize vs2){
return (vs1.width>=vs2.width) && (vs1.height>=vs2.height);
}
static inline MSVideoSize ms_video_size_max(MSVideoSize vs1, MSVideoSize vs2){
return ms_video_size_greater_than(vs1,vs2) ? vs1 : vs2;
}
static inline MSVideoSize ms_video_size_min(MSVideoSize vs1, MSVideoSize vs2){
return ms_video_size_greater_than(vs1,vs2) ? vs2 : vs1;
}
static inline bool_t ms_video_size_equal(MSVideoSize vs1, MSVideoSize vs2){
return vs1.width==vs2.width && vs1.height==vs2.height;
}
typedef enum{
MS_YUV420P,
MS_YUYV,

View file

@ -45,6 +45,7 @@ typedef struct _MSDisplayDesc{
void (*update)(struct _MSDisplay *); /*display the picture to the screen*/
void (*uninit)(struct _MSDisplay *);
bool_t (*pollevent)(struct _MSDisplay *, MSDisplayEvent *ev);
long default_window_id;
}MSDisplayDesc;
typedef struct _MSDisplay{
@ -76,6 +77,12 @@ extern MSDisplayDesc ms_sdl_display_desc;
extern "C"{
#endif
/*plugins can set their own display using this method:*/
void ms_display_desc_set_default(MSDisplayDesc *desc);
MSDisplayDesc * ms_display_desc_get_default(void);
void ms_display_desc_set_default_window_id(MSDisplayDesc *desc, long id);
MSVAR_DECLSPEC MSDisplayDesc ms_win_display_desc;
MSDisplay *ms_display_new(MSDisplayDesc *desc);
@ -85,6 +92,7 @@ void ms_display_destroy(MSDisplay *d);
#define MS_VIDEO_OUT_SET_DISPLAY MS_FILTER_METHOD(MS_VIDEO_OUT_ID,0,MSDisplay*)
#define MS_VIDEO_OUT_HANDLE_RESIZING MS_FILTER_METHOD_NO_ARG(MS_VIDEO_OUT_ID,1)
#define MS_VIDEO_OUT_SET_CORNER MS_FILTER_METHOD(MS_VIDEO_OUT_ID,2,int*)
#define MS_VIDEO_OUT_AUTO_FIT MS_FILTER_METHOD(MS_VIDEO_OUT_ID,3,int)
#ifdef __cplusplus
}

View file

@ -177,7 +177,10 @@ static int enc_set_br(MSFilter *f, void *arg){
EncData *d=(EncData*)f->data;
d->bitrate=*(int*)arg;
if (d->bitrate>=1024000){
if (d->bitrate>=1024000){
d->vsize=MS_VIDEO_SIZE_VGA;
d->fps=25;
}else if (d->bitrate>=512000){
d->vsize=MS_VIDEO_SIZE_VGA;
d->fps=15;
}else if (d->bitrate>=384000){

View file

@ -63,6 +63,9 @@ int yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){
}else if (size==(MS_VIDEO_SIZE_1024_W*MS_VIDEO_SIZE_1024_H*3)/2){
w=MS_VIDEO_SIZE_1024_W;
h=MS_VIDEO_SIZE_1024_H;
}else if (size==(MS_VIDEO_SIZE_800X600_W*MS_VIDEO_SIZE_800X600_H*3)/2){
w=MS_VIDEO_SIZE_800X600_W;
h=MS_VIDEO_SIZE_800X600_H;
}else if (size==(160*112*3)/2){/*format used by econf*/
w=160;
h=112;

View file

@ -153,7 +153,7 @@ static void enc_init(MSFilter *f, enum CodecID codec)
f->data=s;
ms_ffmpeg_check_init();
s->profile=0;/*always default to profile 0*/
s->comp_buf=allocb(32000,0);
s->comp_buf=NULL;
s->fps=15;
s->mtu=ms_get_payload_max_size()-2;/*-2 for the H263 payload header*/
s->maxbr=500000;
@ -202,7 +202,7 @@ static void prepare(EncState *s){
c->time_base.den = (int)s->fps;
c->gop_size=(int)s->fps*5; /*emit I frame every 5 seconds*/
c->pix_fmt=PIX_FMT_YUV420P;
s->comp_buf=allocb(c->bit_rate*2,0);
if (s->codec==CODEC_ID_SNOW){
c->strict_std_compliance=-2;
}
@ -245,7 +245,6 @@ static void prepare_mpeg4(EncState *s){
static void enc_uninit(MSFilter *f){
EncState *s=(EncState*)f->data;
if (s->comp_buf!=NULL) freemsg(s->comp_buf);
ms_free(s);
}
#if 0
@ -292,6 +291,10 @@ static void enc_postprocess(MSFilter *f){
avcodec_close(&s->av_context);
s->av_context.codec=NULL;
}
if (s->comp_buf!=NULL) {
freemsg(s->comp_buf);
s->comp_buf=NULL;
}
}
static void add_rfc2190_header(mblk_t **packet, AVCodecContext *context){

View file

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ffmpeg-priv.h"
static int video_out_handle_resize(MSFilter *f, void *arg);
static int video_out_set_vsize(MSFilter *f,void *arg);
bool_t ms_display_poll_event(MSDisplay *d, MSDisplayEvent *ev){
if (d->desc->pollevent)
@ -35,7 +35,7 @@ bool_t ms_display_poll_event(MSDisplay *d, MSDisplayEvent *ev){
else return FALSE;
}
#ifndef WIN32
#ifdef HAVE_SDL
#include <SDL/SDL.h>
#include <SDL/SDL_video.h>
@ -78,6 +78,8 @@ static void sdl_show_window(bool_t show){
#endif
static void sdl_display_uninit(MSDisplay *obj);
static SDL_Overlay * sdl_create_window(int w, int h){
SDL_Overlay *lay;
sdl_screen = SDL_SetVideoMode(w,h, 0,SDL_SWSURFACE|SDL_RESIZABLE);
@ -89,13 +91,16 @@ static SDL_Overlay * sdl_create_window(int w, int h){
if (sdl_screen->flags & SDL_HWSURFACE) ms_message("SDL surface created in hardware");
SDL_WM_SetCaption("Linphone Video", NULL);
ms_message("Using yuv overlay.");
lay=SDL_CreateYUVOverlay(w,h,SDL_YV12_OVERLAY,sdl_screen);
lay=SDL_CreateYUVOverlay(w , h ,SDL_YV12_OVERLAY,sdl_screen);
if (lay==NULL){
ms_warning("Couldn't create yuv overlay: %s\n",
SDL_GetError());
return NULL;
}else{
if (lay->hw_overlay) ms_message("YUV overlay using hardware acceleration.");
ms_message("%i x %i YUV overlay created: hw_accel=%i, pitches=%i,%i,%i",lay->w,lay->h,lay->hw_overlay,
lay->pitches[0],lay->pitches[1],lay->pitches[2]);
ms_message("planes= %p %p %p %i %i",lay->pixels[0],lay->pixels[1],lay->pixels[2],
lay->pixels[1]-lay->pixels[0],lay->pixels[2]-lay->pixels[1]);
}
return lay;
}
@ -113,8 +118,9 @@ static bool_t sdl_display_init(MSDisplay *obj, MSPicture *fbuf){
sdl_initialized=TRUE;
ms_mutex_init(&sdl_mutex,NULL);
}
if (obj->data!=NULL)
if (obj->data!=NULL){
SDL_FreeYUVOverlay((SDL_Overlay*)obj->data);
}
lay=sdl_create_window(fbuf->w, fbuf->h);
if (lay){
@ -124,6 +130,8 @@ static bool_t sdl_display_init(MSDisplay *obj, MSPicture *fbuf){
fbuf->strides[0]=lay->pitches[0];
fbuf->strides[1]=lay->pitches[2];
fbuf->strides[2]=lay->pitches[1];
fbuf->w=lay->w;
fbuf->h=lay->h;
obj->data=lay;
sdl_show_window(TRUE);
return TRUE;
@ -158,36 +166,22 @@ static void sdl_display_update(MSDisplay *obj){
static bool_t sdl_poll_event(MSDisplay *obj, MSDisplayEvent *ev){
SDL_Event event;
static MSDisplayEvent last_ev;
static struct timeval tv;
static bool_t got_rs_ev=FALSE;
struct timeval cur;
int elapsed;
bool_t ret=FALSE;
if (sdl_screen==NULL) return FALSE;
ms_mutex_lock(&sdl_mutex);
if (SDL_PollEvent(&event)){
ms_mutex_unlock(&sdl_mutex);
switch(event.type){
case SDL_VIDEORESIZE:
last_ev.evtype=MS_DISPLAY_RESIZE_EVENT;
last_ev.w=event.resize.w;
last_ev.h=event.resize.h;
got_rs_ev=TRUE;
gettimeofday(&tv,NULL);
ev->evtype=MS_DISPLAY_RESIZE_EVENT;
ev->w=event.resize.w;
ev->h=event.resize.h;
return TRUE;
break;
default:
break;
}
}else ms_mutex_unlock(&sdl_mutex);
if (got_rs_ev){
gettimeofday(&cur,NULL);
elapsed=((cur.tv_sec-tv.tv_sec)*1000) + ((cur.tv_usec-tv.tv_usec)/1000);
if (elapsed>1000){
got_rs_ev=FALSE;
*ev=last_ev;
ret=TRUE;
}
}
return ret;
}
@ -213,7 +207,7 @@ MSDisplayDesc ms_sdl_display_desc={
.pollevent=sdl_poll_event
};
#else
#elif defined(WIN32)
#include <Vfw.h>
@ -386,25 +380,6 @@ static void yuv420p_to_rgb(MSPicture *src, uint8_t *rgb){
ms_error("Error in 420->rgb sws_scale().");
}
sws_freeContext(sws);
#if 0
/*revert colors*/
{
int i,j,stride;
rgb_t pix;
stride=src->w*3;
p=rgb;
for(i=0;i<src->h;++i){
for(j=0;j<stride;j+=3){
pix.r=p[j];
pix.g=p[j+1];
pix.b=p[j+2];
p[j]=pix.b;
p[j+2]=pix.r;
}
p+=stride;
}
}
#endif
}
static void win_display_update(MSDisplay *obj){
@ -465,12 +440,6 @@ static void win_display_uninit(MSDisplay *obj){
}
bool_t win_display_pollevent(MSDisplay *d, MSDisplayEvent *ev){
WinDisplay *wd=(WinDisplay*)d->data;
if (wd->new_ev){
wd->new_ev=FALSE;
*ev=wd->last_rsz;
return TRUE;
}
return FALSE;
}
@ -514,6 +483,24 @@ void ms_display_destroy(MSDisplay *obj){
ms_free(obj);
}
#ifdef HAVE_SDL
static MSDisplayDesc *default_display_desc=&ms_sdl_display_desc;
#elif defined(WIN32)
static MSDisplayDesc *default_display_desc=&ms_win_display_desc;
#endif
void ms_display_desc_set_default(MSDisplayDesc *desc){
default_display_desc=desc;
}
MSDisplayDesc * ms_display_desc_get_default(void){
return default_display_desc;
}
void ms_display_desc_set_default_window_id(MSDisplayDesc *desc, long id){
desc->default_window_id=id;
}
typedef struct VideoOut
{
AVRational ratio;
@ -527,6 +514,7 @@ typedef struct VideoOut
MSDisplay *display;
bool_t own_display;
bool_t ready;
bool_t autofit;
} VideoOut;
@ -535,8 +523,8 @@ typedef struct VideoOut
static void set_corner(VideoOut *s, int corner)
{
s->corner=corner;
s->local_pic.w=s->fbuf.w/SCALE_FACTOR;
s->local_pic.h=s->fbuf.h/SCALE_FACTOR;
s->local_pic.w=(s->fbuf.w/SCALE_FACTOR) & ~0x1;
s->local_pic.h=(s->fbuf.h/SCALE_FACTOR) & ~0x1;
if (corner==1)
{
/* top left corner */
@ -573,13 +561,10 @@ static void set_corner(VideoOut *s, int corner)
}
static void set_vsize(VideoOut *s, MSVideoSize *sz){
if (s->ratio.num!=0){
sz->width=sz->width & (~0x1);
sz->height=sz->width*s->ratio.den/s->ratio.num;
}
s->fbuf.w=sz->width;
s->fbuf.h=sz->height;
set_corner(s, s->corner);
s->fbuf.w=sz->width & ~0x1;
s->fbuf.h=sz->height & ~0x1;
set_corner(s,s->corner);
ms_message("Video size set to %ix%i",s->fbuf.w,s->fbuf.h);
}
static void video_out_init(MSFilter *f){
@ -596,6 +581,7 @@ static void video_out_init(MSFilter *f){
obj->display=NULL;
obj->own_display=FALSE;
obj->ready=FALSE;
obj->autofit=FALSE;
set_vsize(obj,&def_size);
f->data=obj;
}
@ -620,15 +606,10 @@ static void video_out_uninit(MSFilter *f){
ms_free(obj);
}
static void video_out_preprocess(MSFilter *f){
static void video_out_prepare(MSFilter *f){
VideoOut *obj=(VideoOut*)f->data;
if (obj->display==NULL){
#ifndef WIN32
obj->display=ms_display_new(&ms_sdl_display_desc);
#else
obj->display=ms_display_new(&ms_win_display_desc);
#endif
obj->display=ms_display_new(default_display_desc);
obj->own_display=TRUE;
}
if (!ms_display_init(obj->display,&obj->fbuf)){
@ -647,9 +628,30 @@ static void video_out_preprocess(MSFilter *f){
freemsg(obj->local_msg);
obj->local_msg=NULL;
}
set_corner(obj,obj->corner);
obj->ready=TRUE;
}
static int video_out_handle_resizing(MSFilter *f, void *data){
VideoOut *s=(VideoOut*)f->data;
MSDisplay *disp=s->display;
if (disp!=NULL){
MSDisplayEvent ev;
if (ms_display_poll_event(disp,&ev)){
if (ev.evtype==MS_DISPLAY_RESIZE_EVENT){
MSVideoSize sz;
sz.width=ev.w;
sz.height=ev.h;
ms_filter_lock(f);
set_vsize(s,&sz);
s->ready=FALSE;
ms_filter_unlock(f);
}
}
}
return 0;
}
static void video_out_postprocess(MSFilter *f){
}
@ -658,11 +660,8 @@ static void video_out_process(MSFilter *f){
VideoOut *obj=(VideoOut*)f->data;
mblk_t *inm;
#ifdef WIN32
video_out_handle_resize(f, NULL);
#endif
ms_filter_lock(f);
if (!obj->ready) video_out_prepare(f);
if (obj->display==NULL){
ms_filter_unlock(f);
if (f->inputs[0]!=NULL)
@ -705,6 +704,17 @@ static void video_out_process(MSFilter *f){
MSPicture src;
if (yuv_buf_init_from_mblk(&src,inm)==0){
if (obj->sws1==NULL){
MSVideoSize cur,newsize;
cur.width=obj->fbuf.w;
cur.height=obj->fbuf.h;
newsize.width=src.w;
newsize.height=src.h;
if (obj->autofit && (ms_video_size_greater_than(newsize,cur) &&
!ms_video_size_equal(newsize,cur) ) ){
set_vsize(obj,&newsize);
video_out_prepare(f);
obj->autofit=FALSE;
}
obj->sws1=sws_getContext(src.w,src.h,PIX_FMT_YUV420P,
obj->fbuf.w,obj->fbuf.h,PIX_FMT_YUV420P,
SWS_FAST_BILINEAR, NULL, NULL, NULL);
@ -734,18 +744,14 @@ static void video_out_process(MSFilter *f){
corner.planes,corner.strides,roi);
ms_display_unlock(obj->display);
}
ms_display_update(obj->display);
ms_filter_unlock(f);
}
static int video_out_set_vsize(MSFilter *f,void *arg){
VideoOut *s=(VideoOut*)f->data;
bool_t reconfigure;
ms_filter_lock(f);
reconfigure=s->ready;
set_vsize(s,(MSVideoSize*)arg);
if (reconfigure) video_out_preprocess(f);
ms_filter_unlock(f);
return 0;
}
@ -756,30 +762,16 @@ static int video_out_set_display(MSFilter *f,void *arg){
return 0;
}
static int video_out_handle_resize(MSFilter *f, void *arg){
static int video_out_auto_fit(MSFilter *f, void *arg){
VideoOut *s=(VideoOut*)f->data;
MSDisplay *disp=s->display;
if (disp!=NULL){
MSDisplayEvent ev;
if (ms_display_poll_event(disp,&ev)){
if (ev.evtype==MS_DISPLAY_RESIZE_EVENT){
MSVideoSize sz;
sz.width=ev.w;
sz.height=ev.h;
#ifndef WIN32
video_out_set_vsize(f,&sz);
#endif
}
}
}
s->autofit=*(int*)arg;
return 0;
}
static int video_out_set_corner(MSFilter *f,void *arg){
VideoOut *s=(VideoOut*)f->data;
set_corner(s, *(int*)arg);
#if 1
ms_filter_lock(f);
set_corner(s, *(int*)arg);
ms_display_lock(s->display);
{
int w=s->fbuf.w;
@ -793,15 +785,15 @@ static int video_out_set_corner(MSFilter *f,void *arg){
}
ms_display_unlock(s->display);
ms_filter_unlock(f);
#endif
return 0;
}
static MSFilterMethod methods[]={
{ MS_FILTER_SET_VIDEO_SIZE , video_out_set_vsize },
{ MS_VIDEO_OUT_SET_DISPLAY , video_out_set_display},
{ MS_VIDEO_OUT_HANDLE_RESIZING , video_out_handle_resize},
{ MS_VIDEO_OUT_SET_CORNER , video_out_set_corner},
{ MS_VIDEO_OUT_AUTO_FIT , video_out_auto_fit},
{ MS_VIDEO_OUT_HANDLE_RESIZING , video_out_handle_resizing},
{ 0 ,NULL}
};
@ -816,7 +808,7 @@ MSFilterDesc ms_video_out_desc={
2,
0,
video_out_init,
video_out_preprocess,
NULL,
video_out_process,
video_out_postprocess,
video_out_uninit,
@ -833,7 +825,7 @@ MSFilterDesc ms_video_out_desc={
.ninputs=2,
.noutputs=0,
.init=video_out_init,
.preprocess=video_out_preprocess,
.preprocess=NULL,
.process=video_out_process,
.postprocess=video_out_postprocess,
.uninit=video_out_uninit,

View file

@ -143,9 +143,11 @@ static void video_steam_process_rtcp(VideoStream *stream, mblk_t *m){
}
void video_stream_iterate(VideoStream *stream){
if (stream->output!=NULL)
ms_filter_call_method_noarg(stream->output,
MS_VIDEO_OUT_HANDLE_RESIZING);
if (stream->evq){
OrtpEvent *ev=ortp_ev_queue_get(stream->evq);
if (ev!=NULL){
@ -170,9 +172,15 @@ VideoStream *video_stream_new(int locport, bool_t use_ipv6){
stream->evq=ortp_ev_queue_new();
stream->rtpsend=ms_filter_new(MS_RTP_SEND_ID);
rtp_session_register_event_queue(stream->session,stream->evq);
stream->sent_vsize.width=MS_VIDEO_SIZE_CIF_W;
stream->sent_vsize.height=MS_VIDEO_SIZE_CIF_H;
return stream;
}
void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize){
stream->sent_vsize=vsize;
}
void video_stream_set_relay_session_id(VideoStream *stream, const char *id){
ms_filter_call_method(stream->rtpsend, MS_RTP_SEND_SET_RELAY_SESSION_ID,(void*)id);
}
@ -183,16 +191,15 @@ void video_stream_enable_adaptive_bitrate_control(VideoStream *s, bool_t yesno){
}
int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *remip, int remport,
int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *cam)
{
int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *cam){
PayloadType *pt;
RtpSession *rtps=stream->session;
MSPixFmt format;
MSVideoSize vsize;
MSVideoSize vsize,cam_vsize,disp_size;
float fps=15;
vsize.height=MS_VIDEO_SIZE_CIF_H;
vsize.width=MS_VIDEO_SIZE_CIF_W;
int tmp;
JBParameters jbp;
const int socket_buf_size=2000000;
pt=rtp_profile_get_payload(profile,payload);
if (pt==NULL){
@ -217,6 +224,13 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
rtp_session_set_recv_buf_size(stream->session,MAX_RTP_SIZE);
rtp_session_get_jitter_buffer_params(stream->session,&jbp);
jbp.max_packets=1000;//needed for high resolution video
rtp_session_set_jitter_buffer_params(stream->session,&jbp);
rtp_session_set_rtp_socket_recv_buffer_size(stream->session,socket_buf_size);
rtp_session_set_rtp_socket_send_buffer_size(stream->session,socket_buf_size);
/* creates two rtp filters to recv send streams (remote part) */
if (remport>0) ms_filter_call_method(stream->rtpsend,MS_RTP_SEND_SET_SESSION,stream->session);
@ -239,6 +253,8 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
ms_filter_call_method(stream->decoder,MS_FILTER_ADD_FMTP,pt->send_fmtp);
}
ms_filter_call_method(stream->encoder,MS_FILTER_GET_VIDEO_SIZE,&vsize);
vsize=ms_video_size_min(vsize,stream->sent_vsize);
ms_filter_call_method(stream->encoder,MS_FILTER_SET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->encoder,MS_FILTER_GET_FPS,&fps);
ms_message("Setting vsize=%ix%i, fps=%f",vsize.width,vsize.height,fps);
/* configure the filters */
@ -254,24 +270,22 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
/*set it to the pixconv */
ms_filter_call_method(stream->pixconv,MS_FILTER_SET_PIX_FMT,&format);
ms_filter_call_method(stream->source,MS_FILTER_GET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->source,MS_FILTER_GET_VIDEO_SIZE,&cam_vsize);
ms_filter_call_method(stream->pixconv,MS_FILTER_SET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->pixconv,MS_FILTER_SET_VIDEO_SIZE,&cam_vsize);
}
ms_filter_call_method(stream->encoder,MS_FILTER_GET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->sizeconv,MS_FILTER_SET_VIDEO_SIZE,&vsize);
/*force the decoder to output YUV420P */
format=MS_YUV420P;
ms_filter_call_method(stream->decoder,MS_FILTER_SET_PIX_FMT,&format);
/*ask the video display to always output CIF */
vsize.height=MS_VIDEO_SIZE_CIF_H;
vsize.width=MS_VIDEO_SIZE_CIF_W;
ms_filter_call_method(stream->output,MS_FILTER_SET_VIDEO_SIZE,&vsize);
disp_size.width=MS_VIDEO_SIZE_CIF_W;
disp_size.height=MS_VIDEO_SIZE_CIF_H;
tmp=1;
ms_filter_call_method(stream->output,MS_FILTER_SET_VIDEO_SIZE,&disp_size);
ms_filter_call_method(stream->output,MS_VIDEO_OUT_AUTO_FIT,&tmp);
ms_filter_call_method(stream->output,MS_FILTER_SET_PIX_FMT,&format);
if (pt->recv_fmtp!=NULL)
@ -331,12 +345,9 @@ void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const
VideoStream * video_preview_start(MSWebCam *device){
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize vsize){
VideoStream *stream = (VideoStream *)ms_new0 (VideoStream, 1);
MSPixFmt format;
MSVideoSize vsize;
vsize.width=MS_VIDEO_SIZE_CIF_W;
vsize.height=MS_VIDEO_SIZE_CIF_H;
/* creates the filters */
stream->source = ms_web_cam_create_reader(device);
@ -344,9 +355,9 @@ VideoStream * video_preview_start(MSWebCam *device){
/* configure the filters */
ms_filter_call_method(stream->source,MS_FILTER_GET_PIX_FMT,&format);
ms_filter_call_method(stream->source,MS_FILTER_SET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->source,MS_FILTER_GET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->source,MS_FILTER_GET_PIX_FMT,&format);
if (format==MS_MJPEG){
stream->pixconv=ms_filter_new(MS_MJPEG_DEC_ID);
}else{

View file

@ -119,8 +119,10 @@ static void parse_events(OrtpEvQueue *q){
const char *usage="mediastream --local <port> --remote <ip:port> --payload <payload type number>\n"
"[ --fmtp <fmtpline>]\n"
"[ --jitter <miliseconds>]\n";
static void run_media_streams(int localport, const char *remote_ip, int remoteport, int payload, const char *fmtp, int jitter, bool_t ec, int bitrate);
"[ --jitter <miliseconds>]\n"
"[ --width <pixels>]\n"
"[ --height <pixels> ]\n";
static void run_media_streams(int localport, const char *remote_ip, int remoteport, int payload, const char *fmtp, int jitter, bool_t ec, int bitrate, MSVideoSize vs);
int main(int argc, char * argv[])
@ -131,6 +133,7 @@ int main(int argc, char * argv[])
const char *fmtp=NULL;
int jitter=50;
int bitrate=0;
MSVideoSize vs;
bool_t ec=FALSE;
/*create the rtp session */
ortp_init();
@ -146,6 +149,9 @@ int main(int argc, char * argv[])
rtp_profile_set_payload(&av_profile,100,&payload_type_x_snow);
rtp_profile_set_payload(&av_profile,102,&payload_type_h264);
#endif
vs.width=MS_VIDEO_SIZE_CIF_W;
vs.height=MS_VIDEO_SIZE_CIF_H;
if (argc<4) {
printf(usage);
return -1;
@ -173,17 +179,23 @@ int main(int argc, char * argv[])
}else if (strcmp(argv[i],"--bitrate")==0){
i++;
bitrate=atoi(argv[i]);
}else if (strcmp(argv[i],"--width")==0){
i++;
vs.width=atoi(argv[i]);
}else if (strcmp(argv[i],"--height")==0){
i++;
vs.height=atoi(argv[i]);
}else if (strcmp(argv[i],"--ec")==0){
ec=TRUE;
}
}
run_media_streams(localport,ip,remoteport,payload,fmtp,jitter,ec,bitrate);
run_media_streams(localport,ip,remoteport,payload,fmtp,jitter,ec,bitrate,vs);
return 0;
}
void run_media_streams(int localport, const char *remote_ip, int remoteport, int payload, const char *fmtp, int jitter, bool_t ec, int bitrate)
void run_media_streams(int localport, const char *remote_ip, int remoteport, int payload, const char *fmtp, int jitter, bool_t ec, int bitrate, MSVideoSize vs)
{
AudioStream *audio=NULL;
#ifdef VIDEO_ENABLED
@ -212,7 +224,7 @@ void run_media_streams(int localport, const char *remote_ip, int remoteport, in
#ifdef VIDEO_ENABLED
printf("Starting video stream.\n");
video=video_stream_new(localport, ms_is_ipv6(remote_ip));
video_stream_set_sent_video_size(video,vs);
video_stream_start(video,profile,
remote_ip,
remoteport,remoteport+1,

View file

@ -24,7 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int main(int argc, char *argv[]){
VideoStream *vs;
MSWebCam *cam;
MSVideoSize vsize;
int i;
vsize.width=MS_VIDEO_SIZE_CIF_W;
vsize.height=MS_VIDEO_SIZE_CIF_H;
ortp_init();
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
ms_init();
@ -32,7 +37,7 @@ int main(int argc, char *argv[]){
/* this is to test the sequence start/stop */
for(i=0;i<1;++i){
int n;
vs=video_preview_start(cam);
vs=video_preview_start(cam,vsize);
for(n=0;n<1000;++n){
#ifdef WIN32