<html><head><base href="x-msg://1/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">yes, there are a handful of examples of this.. &nbsp;look for example, in v4l2bufferpool.. &nbsp;xvimagesink, etc..<div><br></div><div>basically the principle is to subclass GstBuffer, provide your own finalize function that revives the buffer and returns it to your pool of buffers.</div><div><br></div><div><br></div><div>(random thought: &nbsp;really, it's a pattern seen in enough gst elements, that perhaps it would be nice to see a generic GstBufferPool class..)</div><div><br></div><div><br></div><div>BR,</div><div>-R</div><div><br><div><div><div>On Jan 7, 2010, at 8:56 PM, Chen, Weian wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div lang="ZH-CN" link="blue" vlink="purple"><div class="Section1"><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; ">Hi All,<o:p></o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; "><o:p>&nbsp;</o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; ">In my current element, I will create and new a GstBuffer (which means to use g_malloc to allocate buffer) in the _chain() function for each frame.<o:p></o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; "><o:p>&nbsp;</o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; ">My question is: Can I allocate several buffers (ring buffers) ahead of time, then I can re-use them and don’t need to allocate buffer for each call of _chain, if yes, how?<o:p></o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; "><o:p>&nbsp;</o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; ">Thanks in advanced.<o:p></o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; "><o:p>&nbsp;</o:p></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman'; "><font size="2" color="blue" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial; color: blue; ">Weian</span></font><span lang="EN-US"><o:p></o:p></span></div></div>------------------------------------------------------------------------------<br>This<span class="Apple-converted-space">&nbsp;</span><a href="http://SF.Net" style="color: blue; text-decoration: underline; ">SF.Net</a><span class="Apple-converted-space">&nbsp;</span>email is sponsored by the Verizon Developer Community<br>Take advantage of Verizon's best-in-class app development support<br>A streamlined, 14 day to market process makes app distribution fast and easy<br>Join now and get one step closer to millions of Verizon customers<br><a href="http://p.sf.net/sfu/verizon-dev2dev" style="color: blue; text-decoration: underline; ">http://p.sf.net/sfu/verizon-dev2dev</a><span class="Apple-converted-space">&nbsp;</span>_______________________________________________<br>gstreamer-devel mailing list<br><a href="mailto:gstreamer-devel@lists.sourceforge.net" style="color: blue; text-decoration: underline; ">gstreamer-devel@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" style="color: blue; text-decoration: underline; ">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br></div></span></blockquote></div><br></div></div></body></html>