コピペ: freshplayerがpulseaudioで音声出力する時にサイトのドメインをnameに使うようにしてみた

全部freshwrapper | playbackって書いてあって区別しづらいなー。と思ったのでやってみた。 pulseaudio以外を使う場合、効果はない。入力ストリームに対しても、効果はない。 パッチファイルって、コピーライトとライセンスどこに書くのが正しいんだろうか。 私は大したもの書いてないんで、どう使ってもらってもいいんですが、 基のソフトがMITライセンスで、これを消しちゃいけないらしいので困った。

形式
Diff
投稿日時
2017-01-26 02:24
公開期間
無期限
  1. * Copyright © 2013-2015 Rinat Ibragimov
  2. *
  3. * This file is part of FreshPlayerPlugin.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. --- a/src/audio_thread.h
  23. +++ b/src/audio_thread.h
  24. @@ -51,12 +51,12 @@
  25. typedef audio_stream *
  26. (audio_create_playback_stream_f)(unsigned int sample_rate, unsigned int sample_frame_count,
  27. - audio_stream_playback_cb_f *cb, void *cb_user_data);
  28. + audio_stream_playback_cb_f *cb, void *cb_user_data, const char *name);
  29. typedef audio_stream *
  30. (audio_create_capture_stream_f)(unsigned int sample_rate, unsigned int sample_frame_count,
  31. audio_stream_capture_cb_f *cb, void *cb_user_data,
  32. - const char *device_longname);
  33. + const char *device_longname, const char *name);
  34. /// returns NULL-terminated array of device names
  35. ///
  36. --- a/src/audio_thread_alsa.c
  37. +++ b/src/audio_thread_alsa.c
  38. @@ -436,7 +436,7 @@
  39. static
  40. audio_stream *
  41. alsa_create_playback_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  42. - audio_stream_playback_cb_f *cb, void *cb_user_data)
  43. + audio_stream_playback_cb_f *cb, void *cb_user_data, const char *name)
  44. {
  45. audio_stream *as = alsa_create_stream(STREAM_PLAYBACK, sample_rate, sample_frame_count,
  46. "default");
  47. @@ -508,7 +508,7 @@
  48. audio_stream *
  49. alsa_create_capture_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  50. audio_stream_capture_cb_f *cb, void *cb_user_data,
  51. - const char *longname)
  52. + const char *longname, const char *name)
  53. {
  54. char *pcm_name = find_pcm_name(longname);
  55. audio_stream *as = alsa_create_stream(STREAM_CAPTURE, sample_rate, sample_frame_count,
  56. --- a/src/audio_thread_jack.c
  57. +++ b/src/audio_thread_jack.c
  58. @@ -381,7 +381,7 @@
  59. static
  60. audio_stream *
  61. ja_create_playback_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  62. - audio_stream_playback_cb_f *cb, void *cb_user_data)
  63. + audio_stream_playback_cb_f *cb, void *cb_user_data, const char *name)
  64. {
  65. return ja_do_create_stream(sample_rate, sample_frame_count, cb, NULL, cb_user_data,
  66. STREAM_PLAYBACK);
  67. @@ -391,7 +391,7 @@
  68. audio_stream *
  69. ja_create_capture_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  70. audio_stream_capture_cb_f *cb, void *cb_user_data,
  71. - const char *longname)
  72. + const char *longname, const char *name)
  73. {
  74. (void)longname; // have no meaning here. JACK itself selects appropriate sound device
  75. return ja_do_create_stream(sample_rate, sample_frame_count, NULL, cb, cb_user_data,
  76. --- a/src/audio_thread_noaudio.c
  77. +++ b/src/audio_thread_noaudio.c
  78. @@ -148,7 +148,7 @@
  79. static
  80. audio_stream *
  81. noaudio_create_playback_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  82. - audio_stream_playback_cb_f *cb, void *cb_user_data)
  83. + audio_stream_playback_cb_f *cb, void *cb_user_data, const char *name)
  84. {
  85. audio_stream *as = noaudio_create_stream(sample_rate, sample_frame_count);
  86. if (!as)
  87. @@ -163,7 +163,7 @@
  88. audio_stream *
  89. noaudio_create_capture_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  90. audio_stream_capture_cb_f *cb, void *cb_user_data,
  91. - const char *longname)
  92. + const char *longname, const char *name)
  93. {
  94. return NULL;
  95. }
  96. --- a/src/audio_thread_pulseaudio.c
  97. +++ b/src/audio_thread_pulseaudio.c
  98. @@ -236,7 +236,7 @@
  99. pulse_do_create_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  100. audio_stream_playback_cb_f *playback_cb,
  101. audio_stream_capture_cb_f *capture_cb, void *cb_user_data,
  102. - audio_stream_direction direction)
  103. + audio_stream_direction direction, const char *name)
  104. {
  105. // ensure main loop is running
  106. if (!pulse_available()) {
  107. @@ -264,7 +264,7 @@
  108. pa_threaded_mainloop_lock(mainloop);
  109. - const char *stream_name = (direction == STREAM_PLAYBACK) ? "playback" : "capture";
  110. + const char *stream_name = name;//(direction == STREAM_PLAYBACK) ? "playback" : "capture";
  111. as->stream = pa_stream_new(context, stream_name, &as->sample_spec, NULL);
  112. if (!as->stream) {
  113. if (direction == STREAM_PLAYBACK)
  114. @@ -327,21 +327,21 @@
  115. static
  116. audio_stream *
  117. pulse_create_playback_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  118. - audio_stream_playback_cb_f *cb, void *cb_user_data)
  119. + audio_stream_playback_cb_f *cb, void *cb_user_data, const char *name)
  120. {
  121. return pulse_do_create_stream(sample_rate, sample_frame_count, cb, NULL, cb_user_data,
  122. - STREAM_PLAYBACK);
  123. + STREAM_PLAYBACK, name);
  124. }
  125. static
  126. audio_stream *
  127. pulse_create_capture_stream(unsigned int sample_rate, unsigned int sample_frame_count,
  128. audio_stream_capture_cb_f *cb, void *cb_user_data,
  129. - const char *longname)
  130. + const char *longname, const char *name)
  131. {
  132. (void)longname; // have no meaning here. PulseAudio itself selects appropriate sound device
  133. return pulse_do_create_stream(sample_rate, sample_frame_count, NULL, cb, cb_user_data,
  134. - STREAM_CAPTURE);
  135. + STREAM_CAPTURE, name);
  136. }
  137. static
  138. --- a/src/ppb_audio.c
  139. +++ b/src/ppb_audio.c
  140. @@ -27,6 +27,7 @@
  141. #include "ppb_audio.h"
  142. #include "ppb_core.h"
  143. #include <stdlib.h>
  144. +#include <string.h>
  145. #include <glib.h>
  146. #include "trace.h"
  147. #include "tables.h"
  148. @@ -36,6 +37,7 @@
  149. #include "ppb_message_loop.h"
  150. #include "eintr_retry.h"
  151. #include "audio_thread.h"
  152. +#include "ppb_var.h"
  153. static
  154. void
  155. @@ -95,8 +97,37 @@
  156. goto err;
  157. }
  158. + const char *stname;
  159. + const char *should_free = NULL;
  160. + if(pp_i->document_url.type == PP_VARTYPE_STRING){
  161. + const char *url = ppb_var_var_to_utf8(pp_i->document_url, NULL);
  162. + const char *mp1, *mp2;
  163. + mp1 = strstr(url, "://");
  164. + if(mp1){
  165. + mp1 += 3;
  166. + }else{
  167. + mp1 = url;
  168. + }
  169. + size_t sl;
  170. + mp2 = strchr(mp1, '/');
  171. + if(mp2){
  172. + sl = mp2 - mp1;
  173. + }else{
  174. + sl = strlen(mp1);
  175. + }
  176. + char *domain = (char *)malloc(sl+1);
  177. + memcpy(domain, mp1, sl);
  178. + domain[sl] = '\0';
  179. + stname = should_free = domain;
  180. + }else{
  181. + stname = "playback";
  182. + }
  183. +
  184. a->stream = a->stream_ops->create_playback_stream(a->sample_rate, a->sample_frame_count,
  185. - playback_cb, a);
  186. + playback_cb, a, stname);
  187. + if(should_free){
  188. + free(should_free);
  189. + }
  190. if (!a->stream) {
  191. trace_error("%s, can't create playback stream\n", __func__);
  192. goto err;
  193. --- a/src/ppb_audio_input.c
  194. +++ b/src/ppb_audio_input.c
  195. @@ -157,7 +157,7 @@
  196. ai->cb_user_data = user_data;
  197. ai->stream = ai->stream_ops->create_capture_stream(ai->sample_rate, ai->sample_frame_count,
  198. - capture_cb, ai, longname);
  199. + capture_cb, ai, longname, "capture");
  200. if (!ai->stream) {
  201. trace_error("%s, can't create capture stream\n", __func__);
  202. goto err_3;
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト