GStreamer 1.0 Good Plugins: level Return RMS = [-699.9999998436322, -699.9999998436322]

ivsatel wincky at mail.ru
Fri Jan 9 03:08:53 PST 2015


Возвращается не ожидаемое значение rms

import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gi.repository import Gtk
from gi.repository import GObject

GObject.threads_init()
Gst.init_check(None)

class MyLPlayer(object):
    def __init__(self, channel):

        self.caps = Gst.Caps.from_string('audio/*, rate=44100, channels=2')
        self.pipeline = Gst.Pipeline.new('my-player')

        self.playbin = Gst.ElementFactory.make('playbin')
        self.autoaudiosrc = Gst.ElementFactory.make('autoaudiosrc')
        self.audioconvert = Gst.ElementFactory.make('audioconvert')
        self.level = Gst.ElementFactory.make('level')
        self.fakesink = Gst.ElementFactory.make('fakesink')

        self.pipeline.add(self.playbin)
        self.pipeline.add(self.autoaudiosrc)
        self.pipeline.add(self.audioconvert)
        self.pipeline.add(self.fakesink)
        self.pipeline.add(self.level)

        self.autoaudiosrc.link(self.audioconvert)
        self.audioconvert.link_filtered(self.level, self.caps)
        self.level.link(self.fakesink)

        self.fakesink.set_property("sync", True)

        self.bus = self.pipeline.get_bus()
        self.bus.add_signal_watch()
        self.bus.connect('message', self.show_peak)

        self.playbin.set_property('uri', channel)
        self.pipeline.set_state(Gst.State.PLAYING)

    def show_peak(self, bus, message):
        s = Gst.Message.get_structure(message)

        if message.type == Gst.MessageType.ELEMENT:
            if str(Gst.Structure.get_name(s)) == 'level':
                a = s.get_value('rms')
                print(a)

win = MyLPlayer('http://http-live.sr.se/p1-mp3-192')
win
Gtk.main()

Why?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/GStreamer-1-0-Good-Plugins-level-Return-RMS-699-9999998436322-699-9999998436322-tp4670184.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list