|
List Info
Thread: split/reassemble a stream into fixed-size buffers
|
|
| split/reassemble a stream into
fixed-size buffers |
  France |
2007-02-22 06:56:35 |
Hi,
In my application I have to end up with buffers of a fixed
size (these
are PCMU audio buffers), for reasons I don't have control
over.
I've tried to use a queue but the queue doesn't actually
rechunk
buffers, it just waits for the threshold and size conditions
to be met
and then passes the buffers unmodified.
Is there a built-in element to actually recompose a stream
into
fixed-size buffers, or do I have to write a custom element
using a
gst.Adapter ?
Thanks
Antoine.
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
|
|
| Re: split/reassemble a stream into
fixed-size buffers |
  United States |
2007-02-26 05:04:49 |
Hi Antoine,
On Thu, 2007-02-22 at 13:56 +0100, Antoine Pitrou wrote:
> In my application I have to end up with buffers of a
fixed size (these
> are PCMU audio buffers), for reasons I don't have
control over.
...
> Is there a built-in element to actually recompose a
stream into
> fixed-size buffers, or do I have to write a custom
element using a
> gst.Adapter ?
Your suspicions are correct You have
to write a custom element, and
using gstadapter is a good idea.
Regards,
Andy.
--
http://wingolog.org/
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
|
|
| problem for replacing an element in a
built pipeline |
  France |
2007-02-26 12:28:44 |
I have a problem for replacing an element in a built
pipeline.
I have coded a program that build the following pipe:
filesrc | ffdemux | queue | fakesink
and once it is done I want to change fakesink by another
sink that we
would call fakesink_2
the steps of my process are:
add filesrc to pipeline
add ffdemux to pipeline
link filesrc | ffdemux
set state READY
set state PAUSED
by making this, the callback that I have plugged is called
on the
creation of source pad of ffdemux
The process of this callback is:
add queue to pipeline
link ffdemux | queue
add fakesink to pipeline
link queue | fakesink
set state PAUSED (in order that my 2 new elements
(queue,fakesink) are
in the right state (PAUSED))
when my 4 elements filesrc | ffdemux | queue | fakesink (+
the pipe
line) are in the state PAUSED,
I want to change element fakesink by fakesink_2
So I make a
set state READY (this will remove the pad of ffmpeg if I
understand well)
set state PAUSED
this time in the callback for pad creation of ffdemux, the
process is:
unlink fakesink
remove fakesink from pipe
get queue from pipeline (thanks to gst_bin_get_by_name)
link ffdemux | queue
add fakesink_2 to pipeline
link queue | fakesink_2
set state PAUSED
that is were an error occurs:
WARNING gst_base_sink_chain (gstbasesink.c l. 2012): Push on
pad
videosink:sink, but it was not activated in push mode
Even if fakesink_2 is a sink that do something or is a real
fakesink, I
have the same problem.
Could you tell me what I do not the good way?
How to replace an element?
Regards
Matthieu
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
|
|
| Re: split/reassemble a stream into
fixed-size buffers |
  France |
2007-02-28 07:32:37 |
Hi Andy,
Le lundi 26 février 2007 à 12:04 +0100, Andy Wingo a écrit
:
> On Thu, 2007-02-22 at 13:56 +0100, Antoine Pitrou
wrote:
> > In my application I have to end up with buffers of
a fixed size (these
> > are PCMU audio buffers), for reasons I don't have
control over.
> ...
> > Is there a built-in element to actually recompose
a stream into
> > fixed-size buffers, or do I have to write a custom
element using a
> > gst.Adapter ?
>
> Your suspicions are correct You have
to write a custom element, and
> using gstadapter is a good idea.
Thanks for your answer !
So I did it in Python, but the problem is gst.Adapter throws
some
(seemingly random) error messages about refcount errors:
(nosetests:13339): GStreamer-CRITICAL **:
gst_mini_object_unref: assertion `mini_object->refcount
> 0' failed
The workaround I found is to always build a copy of the
incoming buffer,
but of course it negates the advantage of using gst.Adapter
which is to
not make a copy every time. The code for my element follows,
if I remove
the "buf = buf.copy()" line in the chain function
I get those warning
messages. Is there anything wrong in my code?
(I'm not that much bothered by the inefficiency, since I'm
doing it in
Python anyway, but I'd like to learn and know whether I'm
doing things
wrong )
Regards
Antoine.
class Chunker(gst.Element):
"""
This element recomposes a stream into a stream of
fixed-size buffers,
splitting and reassembling them as necessary.
"""
_sinkpadtemplate = gst.PadTemplate("sink",
gst.PAD_SINK,
gst.PAD_ALWAYS,
gst.caps_new_any())
_srcpadtemplate = gst.PadTemplate("src",
gst.PAD_SRC,
gst.PAD_ALWAYS,
gst.caps_new_any())
def __init__(self, chunk_size):
self.__gobject_init__()
if chunk_size <= 0:
raise ValueError("bad chunk size %s" %
chunk_size)
self.chunk_size = chunk_size
self.sink_pad = gst.Pad(self._sinkpadtemplate,
"sink")
self.add_pad(self.sink_pad)
self.src_pad = gst.Pad(self._srcpadtemplate,
"src")
self.add_pad(self.src_pad)
self.sink_pad.set_chain_function(self.chain_function)
self.sink_pad.set_event_function(self.event_function)
self.adapter = gst.Adapter()
def event_function(self, pad, event):
if event.type in (gst.EVENT_NEWSEGMENT,
gst.EVENT_EOS, gst.EVENT_FLUSH_STOP):
self._clear()
return pad.event_default(event)
def chain_function(self, pad, buf):
buf = buf.copy()
self.adapter.push(buf)
while self.adapter.available() >=
self.chunk_size:
ret =
self.src_pad.push(self.adapter.take_buffer(self.chunk_size))
if ret != gst.FLOW_OK:
return ret
return gst.FLOW_OK
def _clear(self):
self.adapter.clear()
gobject.type_register(Chunker)
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
|
|
| Re: gstreamer: streaming : audio and
video synchronization |

|
2007-04-02 09:36:20 |
|
On 4/2/07, Stefan Kost < ensonic hora-obscura.de">ensonic hora-obscura.de> wrote:
|
| Re: gstreamer: streaming : audio
and video synchronization |
  Germany |
2007-04-02 10:10:19 |
Hallo Alejo d,
Am Montag, den 02.04.2007, 16:36 +0200 schrieb alejo d:
> what a great answer, full of insight.
Sarcasm is a good way not to get help ...
>
> i have tried also and got lost with audio since it
didnt work, my
> naive pipeline is this one for video:
>
> gst-launch-0.10 v4lsrc device=/dev/video0 !
> "video/x-raw-yuv",width=320,height=240 !
ffmpegcolorspace ! theoraenc
> bitrate=80 ! oggmux name=mux ! shout2send ip=son0p.tv
port=8000
> password=pppppp mount=son0p.ogg { mux. }
>
>
> if someone could add the audio pipeline part for
alsacards (it didnt
> work for me) might that be a solution for Matthieu.
If I were you I would try this pipeline (please note the
queues, that
should decouple the elements - use the queues luke!):
gst-launch-0.10 v4lsrc device=/dev/video0 !
"video/x-raw-yuv",width=320,height=240 !
ffmpegcolorspace ! theoraenc bitrate=80 !
queue ! mux.
alsasrc device="maestro3" !
audioconvert ! vorbisenc ! queue ! mux.
oggmux name=mux ! filesink
location=test.ogm
I have no *cast running and won't install it, but replacing
the filesink
with shout2send. You will also have to adjust the alsasrc
line, but this
gives me a ogg container with muxed vorbis sound and theora
video.
HTH
Matthias
--
Matthias Bläsing (GPG-Schlüsselkennung: A71B4BD5)
ICQ: 84617206 AIM: linuxfun81 MSN: linuxfun hotmail.com
"Wer die Freiheit aufgibt um Sicherheit zu gewinnen,
der wird am Ende beides verlieren."
Benjamin Franklin
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
|
|
[1-6]
|
|