I have improved the tcpserversrc to a retentive service to receive tcp data continually.<br><br>this is my code:<br><br>struct _GstTCPServerSrc {<br> GstPushSrc element;<br><br>//../Add some gboolean vars<br> gboolean recvError; default = FALSE;<br> gboolean bReconnected; default=TRUE;<br>}<br><br>Then in gst_tcp_server_src_create():<br><br><font color="#808080">static GstFlowReturn<br>gst_tcp_server_src_create(GstPushSrc * psrc,<br> GstBuffer ** outbuf) {<br> GstTCPServerSrc *src;<br> GstFlowReturn ret = GST_FLOW_OK;<br>/* static gint indexPocket = 0;<br> int i = 0;*/<br><br> src = GST_TCP_SERVER_SRC (psrc);<br><br> if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_SERVER_SRC_OPEN))<br> goto wrong_state;<br><br>restart:<br><br>//Libing begin<br> if (src->client_sock_fd.fd >= 0) {<br> if(src->recvError){<br>// g_print("**********Client connection has closed fd=%d clientnum=%d**************\n",<br>// src->client_sock_fd.fd, src->clientnum);<br><br> gst_poll_remove_fd(src->fdset, &src->client_sock_fd);<br> gst_poll_fd_ctl_read(src->fdset, &src->server_sock_fd, TRUE);<br> src->client_sock_fd.fd = -1;<br> src->bReconnected = TRUE;<br> }else{<br> /* if we have a client, wait for read */<br> gst_poll_fd_ctl_read(src->fdset, &src->server_sock_fd, FALSE);<br> gst_poll_fd_ctl_read(src->fdset, &src->client_sock_fd, TRUE);<br> }<br><br> } else {<br> /* else wait on server socket for connections */<br> gst_poll_fd_ctl_read(src->fdset, &src->server_sock_fd, TRUE);<br> }<br>//Libing end<br><br>// g_print("Poll will wait!!!!~~~~~~\n");<br><br> /* no action (0) is an error too in our case */<br> if ((ret = gst_poll_wait(src->fdset, GST_CLOCK_TIME_NONE)) <= 0) {<br> if (ret == -1 && errno == EBUSY)<br> goto select_cancelled;<br> else<br> goto select_error;<br> }<br><br> /* if we have no client socket we can accept one now */<br> if (src->client_sock_fd.fd < 0) {<br> if (gst_poll_fd_can_read(src->fdset, &src->server_sock_fd)) {<br> if ((src->client_sock_fd.fd = accept(src->server_sock_fd.fd,<br> (struct sockaddr *) &src->client_sin,<br> &src->client_sin_len)) == -1)<br> goto accept_error;<br><br> gst_poll_add_fd(src->fdset, &src->client_sock_fd);<br> src->recvError = FALSE;<br><br>/* g_print("**********Client has connected fd=%d clientnum=%d**************\n",<br> src->client_sock_fd.fd, src->clientnum);*/<br> }<br> /* and restart now to poll the socket. */<br> goto restart;<br> }<br><br> GST_LOG_OBJECT(src, "asked for a buffer");<br><br> switch (src->protocol) {<br> case GST_TCP_PROTOCOL_NONE:{<br> if((ret = gst_tcp_server_src_read_buffer(src, src->client_sock_fd.fd,<br> src->fdset, outbuf)) == GST_FLOW_OK){<br> return ret;<br> }else{<br> g_print("____________Receive Error!\n");<br> close(src->client_sock_fd.fd);<br> src->recvError = TRUE;<br> goto restart;<br> }<br> break;<br> }<br> case GST_TCP_PROTOCOL_GDP:{<br> if (!src->caps_received) {<br> GstCaps *caps;<br> gchar *string;<br><br> ret = gst_tcp_gdp_read_caps(GST_ELEMENT (src),<br> src->client_sock_fd.fd, src->fdset, &caps);<br><br> if (ret == GST_FLOW_WRONG_STATE)<br> goto gdp_cancelled;<br><br> if (ret != GST_FLOW_OK)<br> goto gdp_caps_read_error;<br><br> src->caps_received = TRUE;<br> string = gst_caps_to_string(caps);<br> GST_DEBUG_OBJECT(src, "Received caps through GDP: %s", string);<br> g_free(string);<br><br> gst_pad_set_caps(GST_BASE_SRC_PAD (psrc), caps);<br> }<br><br> ret = gst_tcp_gdp_read_buffer(GST_ELEMENT (src),<br> src->client_sock_fd.fd, src->fdset, outbuf);<br><br> if (ret == GST_FLOW_OK)<br> gst_buffer_set_caps(*outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));<br><br> break;<br> }<br> default:<br> /* need to assert as buf == NULL */<br> g_assert("Unhandled protocol type");<br> break;<br> }<br><br> if (ret == GST_FLOW_OK) {<br> GST_LOG_OBJECT (src,<br> "Returning buffer from _get of size %d, ts %"<br> GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT<br> ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,<br> GST_BUFFER_SIZE (*outbuf),<br> GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*outbuf)),<br> GST_TIME_ARGS (GST_BUFFER_DURATION (*outbuf)),<br> GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));<br> }<br><br> return ret;<br><br> wrong_state:<br> {<br> GST_DEBUG_OBJECT (src, "connection to closed, cannot read data");<br> return GST_FLOW_WRONG_STATE;<br> }<br> select_error:<br> {<br> GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),<br> ("Select error: %s", g_strerror (errno)));<br> return GST_FLOW_ERROR;<br> }<br> select_cancelled:<br> {<br> GST_DEBUG_OBJECT (src, "select canceled");<br> return GST_FLOW_WRONG_STATE;<br> }<br> accept_error:<br> {<br> GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),<br> ("Could not accept client on server socket: %s", g_strerror (errno)));<br> return GST_FLOW_ERROR;<br> }<br> gdp_cancelled:<br> {<br> GST_DEBUG_OBJECT (src, "reading gdp canceled");<br> return GST_FLOW_WRONG_STATE;<br> }<br> gdp_caps_read_error:<br> {<br> /* if we did not get canceled, report an error */<br> if (ret != GST_FLOW_WRONG_STATE) {<br> GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),<br> ("Could not read caps through GDP"));<br> }<br> return ret;<br> }<br>}</font><br><br><font color="#ff0000"><br></font><font color="#ff0000">GstFlowReturn<br>gst_tcp_server_src_read_buffer (GstTCPServerSrc* src, int socket,<br> GstPoll * fdset, GstBuffer ** buf)</font><br><br><br><div>--<br>
<div>Bercy Li<br>+8615954811012<br>libing195@163.com<br></div>
</div><br><pre><br>在2010-05-15 14:44:11,gstreamer-devel-request@lists.sourceforge.net 写道:
>Send gstreamer-devel mailing list submissions to
>        gstreamer-devel@lists.sourceforge.net
>
>To subscribe or unsubscribe via the World Wide Web, visit
>        https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>or, via email, send a message with subject or body 'help' to
>        gstreamer-devel-request@lists.sourceforge.net
>
>You can reach the person managing the list at
>        gstreamer-devel-owner@lists.sourceforge.net
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of gstreamer-devel digest..."
>
>
>Today's Topics:
>
> 1. tcpserversrc restarting (Antoine Martin)
> 2. Re: GStreamer Conference 2010 (wl2776)
> 3. Re: No EOS message at the end of file. (wl2776)
> 4. Re: RTSP Seek and DVB subtitles (Alexander Olekhnovich)
> 5. Framestepping backwards in MPEG2 files (wl2776)
> 6. Pre-releases! gst-plugins-good 0.10.22.2, -ugly 0.10.14.2,
> -bad 0.10.18.2 (Tim-Philipp M?ller)
> 7. Memory profiling and hunting memory leaks (Loc Nguyen)
> 8. Re: Black-and-white output (Marco Ballesio)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Fri, 14 May 2010 18:20:28 +0700
>From: Antoine Martin <antoine@nagafix.co.uk>
>Subject: [gst-devel] tcpserversrc restarting
>To: "gstreamer-devel@lists.sourceforge.net"
>        <gstreamer-devel@lists.sourceforge.net>
>Message-ID: <4BED31FC.2090405@nagafix.co.uk>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Hi,
>
>I have some code largely based on this tcpserversrc example:
>http://www.jejik.com/articles/2007/01/streaming_audio_over_tcp_with_python-gstreamer/
>
>I want to ensure that it keeps working after the first client
>disconnects, which is not the case by default.
>At the moment, the tcp socket shows as "listening" but any further data
>sent will not be processed.
>
>I've tried unlink()ing the decoder when receiving EOS and re-adding a
>new one, but it complained that that there was an existing one with the
>same name. How do I free the resources to start again? How about even
>freeing the socket?
>
>I would rather not switch to using RTP... But if I have to I will, how
>does gstrtpbin deal with multiple clients connecting?
>
>Thanks
>Antoine
>
>
>
>------------------------------
>
>Message: 2
>Date: Fri, 14 May 2010 04:38:05 -0700 (PDT)
>From: wl2776 <wl2776@gmail.com>
>Subject: Re: [gst-devel] GStreamer Conference 2010
>To: gstreamer-devel@lists.sourceforge.net
>Message-ID: <1273837085181-2216448.post@n4.nabble.com>
>Content-Type: text/plain; charset=us-ascii
>
>
>Great to hear this.
>
>What's the registration fee?
>--
>View this message in context: http://gstreamer-devel.966125.n4.nabble.com/GStreamer-Conference-2010-tp2123970p2216448.html
>Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
>
>
>------------------------------
>
>Message: 3
>Date: Fri, 14 May 2010 05:34:17 -0700 (PDT)
>From: wl2776 <wl2776@gmail.com>
>Subject: Re: [gst-devel] No EOS message at the end of file.
>To: gstreamer-devel@lists.sourceforge.net
>Message-ID: <1273840457055-2216515.post@n4.nabble.com>
>Content-Type: text/plain; charset=us-ascii
>
>
>
>Wim Taymans wrote:
>>
>> On Fri, 2010-05-14 at 11:42 +0100, Giles Atkinson wrote:
>>> > My problem is that the EOS message doesn't appear on playbin2's bus,
>>> after
>>> > some manipulations with reverse and forward playback. But the playbin2
>>> is
>>> > surely at the end of file, as reported by _query_position().
>>
>> EOS should always be sent in the PLAYING state when the pipeline is EOS,
>> if not, please file a bug with an example or a way to reproduce the
>> strange behaviour that you are seeing.
>>
>
>Hmm... The problem is gone now. After rebuild.
>--
>View this message in context: http://gstreamer-devel.966125.n4.nabble.com/No-EOS-message-at-the-end-of-file-tp2216227p2216515.html
>Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
>
>
>------------------------------
>
>Message: 4
>Date: Fri, 14 May 2010 15:23:16 +0300
>From: Alexander Olekhnovich <a.olekhnovich@gmail.com>
>Subject: Re: [gst-devel] RTSP Seek and DVB subtitles
>To: Marc Leeman <marc.leeman@gmail.com>,         Discussion of the
>        development of GStreamer        <gstreamer-devel@lists.sourceforge.net>
>Message-ID:
>        <AANLkTimoGwsXJlzjOgX7SE449wL76Od70A7d9Q3FUGX9@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi Marc,
>
>I think ppl are interested :) At least I would really like to have a look at
>that.
>
>On Thu, May 13, 2010 at 7:24 PM, Marc Leeman <marc.leeman@gmail.com> wrote:
>
>> > Regarding dvb subtitles, there is a little bit of work going on. One
>> > with gst-teletext to grab subtitles from teletext and another with
>> > image subtitles.
>>
>> I've got a working implementation that I am willing to share if ppl are
>> interested.
>>
>> You can use pango to get an approximate of a full TT page or just get
>> the subs (page) in text format.
>>
>> Tested on a number of DVB-S streams with good result.
>>
>> --
>> greetz, marc
>> After an instrument has been assembled, extra components will be found
>> on the bench.
>> crichton 2.6.26 #1 PREEMPT Tue Jul 29 21:17:59 CDT 2008 GNU/Linux
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.6 (GNU/Linux)
>>
>> iD8DBQFL7CfOUQpj09NWLeERAoeFAKDPbRQw/hGwVPZXD7/ll3NZdjEp8QCZAVsN
>> 7CCwL8z16lUE6OgsbktpAWU=
>> =lYBv
>> -----END PGP SIGNATURE-----
>>
>>
>> ------------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>
>
>--
>Thank you,
>Alexander Olekhnovich
>-------------- next part --------------
>An HTML attachment was scrubbed...
>
>------------------------------
>
>Message: 5
>Date: Fri, 14 May 2010 08:03:24 -0700 (PDT)
>From: wl2776 <wl2776@gmail.com>
>Subject: [gst-devel] Framestepping backwards in MPEG2 files
>To: gstreamer-devel@lists.sourceforge.net
>Message-ID: <1273849404627-2216718.post@n4.nabble.com>
>Content-Type: text/plain; charset=us-ascii
>
>
>Is it complete?
>My pipeline doesn't step one frame backwards.
>
>m_player is an instance of the playbin2. It has loaded the MPEG2 Program
>Stream.
>Then, the pipeline was paused before calling step_left
>
>void gst_player::step_left(void)
>{GstFormat fmt=GST_FORMAT_TIME;
>
> if(m_player){
> if(m_current_position>=40*GST_MSECOND){
> gboolean rb=gst_element_seek(m_player,-1.0,GST_FORMAT_TIME,
>
>(GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
>
>GST_SEEK_TYPE_SET,m_current_position,GST_SEEK_TYPE_SET,m_stream_duration);
> GST_DEBUG("seek backwards: %d",rb);
> GstEvent *event = gst_event_new_step (GST_FORMAT_BUFFERS, 1, 1.0,
>TRUE, FALSE);
> rb=gst_element_send_event (m_player, event);
> GST_DEBUG("send step event: %d",rb);
> }
> }
>}
>
>
>Both _seek and _send_event(_new_step) return TRUE.
>However, I don't see any changes in picture on the screen.
>After several calls to step_left() I get the EOS.
>What am I doing wrong?
>--
>View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Framestepping-backwards-in-MPEG2-files-tp2216718p2216718.html
>Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
>
>
>------------------------------
>
>Message: 6
>Date: Fri, 14 May 2010 20:49:47 +0100
>From: Tim-Philipp M?ller <t.i.m@zen.co.uk>
>Subject: [gst-devel] Pre-releases! gst-plugins-good 0.10.22.2, -ugly
>        0.10.14.2, -bad 0.10.18.2
>To: gstreamer-devel@lists.sourceforge.net
>Message-ID: <1273866587.26703.6.camel@zingle>
>Content-Type: text/plain; charset="UTF-8"
>
>Hi,
>
>Below the latest pre-releases for gst-plugins-good, -ugly and -bad.
>
>Please test them thoroughly and file blocker bugs for all regressions or
>other major issues you find at http://gstreamer.freedesktop.org/bugs/
>
>Packagers please note some plugins/elements have moved from -bad to
>-good (imagefreeze plugin, oss4 plugin, capsfilter element).
>
>md5sums and links:
>
>794e8d737657c60b2d6f4d44475d8b59 gst-plugins-good-0.10.22.2.tar.gz
>59403cd259529dee36ad09435898d80f gst-plugins-good-0.10.22.2.tar.bz2
>
>http://gstreamer.freedesktop.org/src/gst-plugins-good/pre/gst-plugins-good-0.10.22.2.tar.gz
>http://gstreamer.freedesktop.org/src/gst-plugins-good/pre/gst-plugins-good-0.10.22.2.tar.bz2
>
>bafd26e74b2bacecb59fd6c938888ed0 gst-plugins-ugly-0.10.14.2.tar.gz
>41bf784355cce044c0a7072c20fa053c gst-plugins-ugly-0.10.14.2.tar.bz2
>
>http://gstreamer.freedesktop.org/src/gst-plugins-ugly/pre/gst-plugins-ugly-0.10.14.2.tar.gz
>http://gstreamer.freedesktop.org/src/gst-plugins-ugly/pre/gst-plugins-ugly-0.10.14.2.tar.bz2
>
>2f5f14c58c50e1b476fb2a31af6270c4 gst-plugins-bad-0.10.18.2.tar.gz
>fe4fde65ed036c927427a158f0165298 gst-plugins-bad-0.10.18.2.tar.bz2
>
>http://gstreamer.freedesktop.org/src/gst-plugins-bad/pre/gst-plugins-bad-0.10.18.2.tar.gz
>http://gstreamer.freedesktop.org/src/gst-plugins-bad/pre/gst-plugins-bad-0.10.18.2.tar.bz2
>
>Cheers
> -Tim
>
>
>
>
>
>------------------------------
>
>Message: 7
>Date: Fri, 14 May 2010 16:19:22 -0700
>From: Loc Nguyen <loc.x.nguyen@oracle.com>
>Subject: [gst-devel] Memory profiling and hunting memory leaks
>To: gstreamer-devel@lists.sourceforge.net
>Message-ID: <4BEDDA7A.2090703@oracle.com>
>Content-Type: text/plain; charset=UTF-8; format=flowed
>
>Hey, I sent an email a few days ago but was never sent to the mailing
>list. I'm trying to hunt down some memory leaks in gstreamer on
>Windows. Can anyone advise on how core gstreamer devs are doing this?
>Any internal APIs that maybe useful for me to try?
>
>-Loc
>
>
>
>------------------------------
>
>Message: 8
>Date: Sat, 15 May 2010 09:44:04 +0300
>From: Marco Ballesio <gibrovacco@gmail.com>
>Subject: Re: [gst-devel] Black-and-white output
>To: Discussion of the development of GStreamer
>        <gstreamer-devel@lists.sourceforge.net>
>Message-ID:
>        <AANLkTinXaUJMYOytUyvpgHoB88pyHJZsR57Fr4hH97Xx@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi,
>
>On Wed, May 12, 2010 at 7:11 PM, Louis-Simon Houde <houdelou@hotmail.com>wrote:
>
>> Hello,
>>
>> The question might sound completely silly for you but does gstreamer needs
>> a video card to generate video output on command line with its gst-launch
>> command ?
>>
>
>it shouldn't matter as long as you're not rendering the output on the card
>itself.. can you please post the gst-launch command you're using?
>
>Regards
>
>
>>
>> I'm asking this question because we use gst-launch to generate video
>> output. On one of the server, with identical command, the output is
>> black-and-white. One of the server doesn't have any video card because it is
>> hosted on Amazon EC2.
>>
>> Ubuntu versions are different also so it might be another cue. But it is
>> the same gstreamer version on both servers.
>>
>> Thanks
>>
>> ------------------------------
>> 10 000 $ de magasinage avec Hotmail. Inscrivez-vous!<http://go.microsoft.com/?linkid=9729716>
>>
>>
>> ------------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>
>------------------------------
>
>------------------------------------------------------------------------------
>
>
>
>------------------------------
>
>_______________________________________________
>gstreamer-devel mailing list
>gstreamer-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
>End of gstreamer-devel Digest, Vol 48, Issue 23
>***********************************************
</pre><br><br><span title="neteasefooter"/><hr/>
<a href="http://ym.163.com/?from=od3" target="_blank">网易为中小企业免费提供企业邮箱(自主域名)</a>
</span>