Commit a3c259974ea93b160112a9c61101e667664443c3

Authored by bellard
1 parent 69db0ac7

audio capture fixes (malc)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2061 c046a42c-6fe2-441c-8c8c-71466251a162
audio/audio.c
@@ -1845,16 +1845,21 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque) @@ -1845,16 +1845,21 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
1845 1845
1846 if (!cap->cb_head.lh_first) { 1846 if (!cap->cb_head.lh_first) {
1847 SWVoiceOut *sw = cap->hw.sw_head.lh_first, *sw1; 1847 SWVoiceOut *sw = cap->hw.sw_head.lh_first, *sw1;
  1848 +
1848 while (sw) { 1849 while (sw) {
  1850 + SWVoiceCap *sc = (SWVoiceCap *) sw;
1849 #ifdef DEBUG_CAPTURE 1851 #ifdef DEBUG_CAPTURE
1850 dolog ("freeing %s\n", sw->name); 1852 dolog ("freeing %s\n", sw->name);
1851 #endif 1853 #endif
  1854 +
1852 sw1 = sw->entries.le_next; 1855 sw1 = sw->entries.le_next;
1853 if (sw->rate) { 1856 if (sw->rate) {
1854 st_rate_stop (sw->rate); 1857 st_rate_stop (sw->rate);
1855 sw->rate = NULL; 1858 sw->rate = NULL;
1856 } 1859 }
1857 LIST_REMOVE (sw, entries); 1860 LIST_REMOVE (sw, entries);
  1861 + LIST_REMOVE (sc, entries);
  1862 + qemu_free (sc);
1858 sw = sw1; 1863 sw = sw1;
1859 } 1864 }
1860 LIST_REMOVE (cap, entries); 1865 LIST_REMOVE (cap, entries);
audio/wavcapture.c
@@ -121,7 +121,8 @@ int wav_start_capture (CaptureState *s, const char *path, int freq, @@ -121,7 +121,8 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
121 121
122 wav = qemu_mallocz (sizeof (*wav)); 122 wav = qemu_mallocz (sizeof (*wav));
123 if (!wav) { 123 if (!wav) {
124 - AUD_log ("wav", "Could not allocate memory (%zu bytes)", sizeof (*wav)); 124 + term_printf ("Could not allocate memory for wav capture (%zu bytes)",
  125 + sizeof (*wav));
125 return -1; 126 return -1;
126 } 127 }
127 128
qemu-doc.texi
@@ -741,6 +741,8 @@ show emulated PCI device @@ -741,6 +741,8 @@ show emulated PCI device
741 show USB devices plugged on the virtual USB hub 741 show USB devices plugged on the virtual USB hub
742 @item info usbhost 742 @item info usbhost
743 show all USB host devices 743 show all USB host devices
  744 +@item info capture
  745 +show information about active capturing
744 @end table 746 @end table
745 747
746 @item q or quit 748 @item q or quit
@@ -755,6 +757,23 @@ Change a removable media. @@ -755,6 +757,23 @@ Change a removable media.
755 @item screendump filename 757 @item screendump filename
756 Save screen into PPM image @var{filename}. 758 Save screen into PPM image @var{filename}.
757 759
  760 +@item wavcapture filename [frequency [bits [channels]]]
  761 +Capture audio into @var{filename}. Using sample rate @var{frequency}
  762 +bits per sample @var{bits} and number of channels @var{channels}.
  763 +
  764 +Defaults:
  765 +@itemize @minus
  766 +@item Sample rate = 44100 Hz - CD quality
  767 +@item Bits = 16
  768 +@item Number of channels = 2 - Stereo
  769 +@end itemize
  770 +
  771 +@item stopcapture index
  772 +Stop capture with a given @var{index}, index can be obtained with
  773 +@example
  774 +info capture
  775 +@end example
  776 +
758 @item log item1[,...] 777 @item log item1[,...]
759 Activate logging of the specified items to @file{/tmp/qemu.log}. 778 Activate logging of the specified items to @file{/tmp/qemu.log}.
760 779