(self, location, caps)
| 39 | '''Decodes audio file, outputs at specified caps''' |
| 40 | |
| 41 | def __init__(self, location, caps): |
| 42 | gst.Bin.__init__(self) |
| 43 | |
| 44 | # Create elements |
| 45 | src = gst.element_factory_make('filesrc') |
| 46 | dec = gst.element_factory_make('decodebin') |
| 47 | conv = gst.element_factory_make('audioconvert') |
| 48 | rsmpl = gst.element_factory_make('audioresample') |
| 49 | ident = gst.element_factory_make('identity') |
| 50 | |
| 51 | # Set 'location' property on filesrc |
| 52 | src.set_property('location', location) |
| 53 | |
| 54 | # Connect handler for 'new-decoded-pad' signal |
| 55 | dec.connect('new-decoded-pad', self.__on_new_decoded_pad) |
| 56 | |
| 57 | # Add elements to bin |
| 58 | self.add(src, dec, conv, rsmpl, ident) |
| 59 | |
| 60 | # Link *some* elements |
| 61 | # This is completed in self.__on_new_decoded_pad() |
| 62 | src.link(dec) |
| 63 | conv.link(rsmpl) |
| 64 | rsmpl.link(ident, caps) |
| 65 | |
| 66 | # Reference used in self.__on_new_decoded_pad() |
| 67 | self.__apad = conv.get_pad('sink') |
| 68 | |
| 69 | # Add ghost pad |
| 70 | self.add_pad(gst.GhostPad('src', ident.get_pad('src'))) |
| 71 | |
| 72 | |
| 73 | def __on_new_decoded_pad(self, element, pad, last): |
nothing calls this directly
no test coverage detected