popcornmix / omxplayer

omxplayer
GNU General Public License v2.0
1.02k stars 332 forks source link

omxplayer and bus at runtime #456

Closed TheSin- closed 8 years ago

TheSin- commented 8 years ago

Is there an options to disable DBUS requirements. This would be very helping if it was a switch to that boot splashes can use this before bus starts. And since I don't really need bus messages for this to work it'd be nice if it was possible.

I don't know much about dbus, to I'm not sure if this is a thing or even possible, but thought I'd ask.

waiting for dbus address to appear

filling up my syslog because it never stops the loop if it's started early in the boot and writes to the log ever 0.2 seconds kinda sucks :D

Also for bootsplash since I want to use start-stop-daemon I can't set a pid is I call the helper scripts, I need to call the .bin file since the scripts forks but doesn't respect the parent being killed. So a no bus options would be amazing for this.

for the record, calling omxplayer.bin directly this is what I see (without the bus part of the script)

Output mode 4: 1280x720@60 N:4 ntsc_freq:1 
Video codec omx-h264 width 480 height 270 profile 77 fps 29.970030
Audio codec aac channels 2 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
Aborted

so doesn't even give me much reason for the abort, if I use the same options with the scripts it works.

jehutting commented 8 years ago

There is already a feature request for having OMXPlayer running without DBus #404. I have done it a long time ago (see my own repository branch keyb-omxcontrol-dbus). I will have to look how I did that...

Aborted...with directly I assume from within the terminal. Please use the -g option to get omxplayer.log and look if it gives more info.

popcornmix commented 8 years ago

I'll close this as a duplicate. Discussion can continue in #404.

TheSin- commented 8 years ago

Sorry I missed #404, though it really is NOT a duplicate. I don't want to build it without dbusm I just want a runtime switch to suppress dbus at run time for special runs like at boot time.

TheSin- commented 8 years ago

here is the log

00:51:36 T:1405241756   DEBUG: DllOMX: Using omx system library
00:51:36 T:1405246658   DEBUG: DllAvFormat: Using libavformat system library
00:51:36 T:1405247230 WARNING: dbus_bus_get_private(): Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
00:51:36 T:1405247339 WARNING: DBus connection failed, trying alternate
00:51:36 T:1405247593 WARNING: dbus_bus_get_private(): Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
00:51:36 T:1405247707 WARNING: DBus connection failed, alternate failed, will continue without DBus
00:51:36 T:1405247815   DEBUG: DllAvUtilBase: Using libavutil system library
00:51:36 T:1405247882   DEBUG: DllAvCodec: Using libavcodec system library
00:51:36 T:1405247942   DEBUG: DllAvFormat: Using libavformat system library
00:51:36 T:1405661827   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.clock input port 80 output port 81 m_handle 0x1447860
00:51:36 T:1405662761   DEBUG: OMXClock::OMXStop
00:51:36 T:1405668237   DEBUG: OMXClock::OMXSetSpeed(0.00) pause_resume:1
00:51:36 T:1405669329   DEBUG: EGL get supported modes (1) = 10, prefer_group=2, prefer_mode=1b
00:51:36 T:1405748467   DEBUG: DllAvUtilBase: Using libavutil system library
00:51:36 T:1405748610   DEBUG: DllAvCodec: Using libavcodec system library
00:51:36 T:1405748676   DEBUG: DllAvFormat: Using libavformat system library
00:51:36 T:1405751242   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.video_decode input port 130 output port 131 m_handle 0x146ba10
00:51:36 T:1405753157   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.video_decode) - port(130), nBufferCountMin(1), nBufferCountActual(60), nBufferSize(81920), nBufferAlignmen(16)
00:51:36 T:1405768625   DEBUG: COMXVideo::Open - decoder_component(0x0x146ba10), input_port(0x82), output_port(0x83) deinterlace 1 hdmiclocksync 1
00:51:36 T:1405769158   DEBUG: OMXThread::Create - Thread with id 1904210992 started
00:51:36 T:1405769279   DEBUG: DllAvUtilBase: Using libavutil system library
00:51:36 T:1405769347   DEBUG: DllAvCodec: Using libavcodec system library
00:51:36 T:1405769409   DEBUG: DllAvFormat: Using libavformat system library
00:51:36 T:1405769476   DEBUG: DllAvUtilBase: Using libavutil system library
00:51:36 T:1405769538   DEBUG: DllAvCodec: Using libavcodec system library
00:51:36 T:1405769597   DEBUG: DllAvFormat: Using libswresample system library
00:51:36 T:1405782273   DEBUG: DllAvUtilBase: Using libavutil system library
00:51:36 T:1405782433   DEBUG: COMXAudio::SetCodingType OMX_AUDIO_CodingPCM
00:51:36 T:1405782541    INFO: CPCMRemap: I channel map: FL,FR
00:51:36 T:1405782701    INFO: CPCMRemap: O channel map: FL,FR
00:51:36 T:1405782777   DEBUG: CPCMRemap: Downmix normalization is disabled
00:51:36 T:1405782876   DEBUG: CPCMRemap: FL = FL(1.000000*)
00:51:36 T:1405782966   DEBUG: CPCMRemap: FR = FR(1.000000*)
00:51:36 T:1405785391   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_decode input port 120 output port 121 m_handle 0x146b930
00:51:37 T:1405787668   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_decode) - port(120), nBufferCountMin(4), nBufferCountActual(16), nBufferSize(65536), nBufferAlignmen(16)
00:51:37 T:1405804832   DEBUG: COMXAudio::Initialize Input bps 32 samplerate 48000 channels 2 buffer size 576000 bytes per second 384000
00:51:37 T:1405804964   DEBUG: pcm->direction      : input
00:51:37 T:1405805034   DEBUG: pcm->nPortIndex     : 120
00:51:37 T:1405805106   DEBUG: pcm->eNumData       : 0
00:51:37 T:1405805176   DEBUG: pcm->eEndian        : 1
00:51:37 T:1405805244   DEBUG: pcm->bInterleaved   : 1
00:51:37 T:1405805306   DEBUG: pcm->nBitPerSample  : 32
00:51:37 T:1405805367   DEBUG: pcm->ePCMMode       : 0
00:51:37 T:1405805426   DEBUG: pcm->nChannels      : 2
00:51:37 T:1405805486   DEBUG: pcm->nSamplingRate  : 48000
00:51:37 T:1405805547   DEBUG: OMX_AUDIO_ChannelLF
00:51:37 T:1405805606   DEBUG: OMX_AUDIO_ChannelRF
00:51:37 T:1405805668   DEBUG: COMXAudio::Initialize device omx:hdmi passthrough 0 hwdecode 0
00:51:37 T:1405806136   DEBUG: OMXThread::Create - Thread with id 1895822384 started
00:51:37 T:1405806315  NOTICE: OMXClock using audio as reference
00:51:37 T:1405806862   DEBUG: OMXClock::OMXReset audio / video : 1 / 1 wait mask 0->3 state : 2->1
TheSin- commented 8 years ago

So for this to work, we'd need a new switch like --no-dbus. It looks like all the DBus calls are in OMXControl.cpp and Keyboard.cpp, I'd assume the best way to deal with it would be have a convince function for all DBus calls, and in that function check for a switch, if --no-dbus is enabled then a var would be setup on init and if that var is set skip DBus calls, and don't listen to it. My C++ isn't super strong so I'm likely not the best person to be making a PR. Since i'm sure most of what I write would get redone anyhow. But just looking at it I don't think it's be too hard honestly, and it wouldn't change anything form default behaviour, it would just give back the option to run it early in the boot before DBus is avail.

Ideas? comments?

jehutting commented 8 years ago

First the logging...is that all...than it is certainly aborting... can you show the command-line you are using?

Do I understand it correct that you want to use the --no-dbus option to INITIALLY have no dbus interface initialization/handling, and (a time period) LATER this same OMXPlayer can 'switch the D-Bus interface on'. How do you want to turn it on?

TheSin- commented 8 years ago

not the same instance no. I want to be able to use OMXPlayer on boot before bus starts. So I want to call it during boot, then close that thread of it via start-stop-daemon. If it's used again later on, by an other process or the user it can then us DBus since it will exist.

so if I call it with --no-dbus, it would simple skip the connect/disconenct to dbus and not write or read from it. Just skip those calls. Otherwise if it's called without --no-dbus it acts exactly how it is today.

EDIT: I forgot my cmdline. The reason it's bailing is I'm not using the omxplayer script, I'm calling omxplayer.bin so the dbus stuff isn't being setup. If I call it with the helper script and the exact same cmdline it works. (thought not at boot time, then it just fills syslog very fast since the while loop never ends, the while loop waits for DBus, which will never happen since it tried to connect to it to early, before it's started, and in the while loop it never tries again it just loops forever)

jehutting commented 8 years ago

@TheSin- I just uploaded the --no-dbus modification in my own omxplayer repository branch no-dbus. See commit Initial implementation of the --no-dbus option. for the modifications.

It needs to be tested and more shapend, but for a first run it would be OK.

With or without D-Bus, strange that it aborts, using or not using the OMXPlayer script.

TheSin- commented 8 years ago

yeah it's a real PITA, I had to switch to fbi but I want video :\

do you have an armhf build of it per chance? I'd give it a shot if you do since I don't have a build env for it.

jehutting commented 8 years ago

OK...get here the initial release. Hopefully it works.

TheSin- commented 8 years ago

works like a dream!!!! was that version 100% bus free, or just the switch, cause it worked well!! I'd love to post a video of it, if this project wasn't closed ;) Now lets see if @popcornmix will accept it

EDIT: figured it out, no dbus at all since --no-dbus makes no diff, it works with or without it for me ;)

EDIT2: Ahh I see the dbus stuff was removed from the commits. So sadly I doubt that will get accepted, but maybe I can use that to build one where the switch works, so I can make a PR for it, might even be able to use the same stuff for a no dbus compile option too for problem #404

jehutting commented 8 years ago

...Than it doesn't work as I had in mind...

Without the --no-dbus option it should work as usual (with the D-Bus Interface), and with the option the D-Bus interface (/stuff) shouldn't be called.

Easily checked with dbuscontrol.sh. With the option you must get

$ ./dbuscontrol-popcornmix.sh pause
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2.omxplayer was not provided by any .service files

Without the option a dbuscontrol.sh pause should pause omxplayer.

To get rid of the D-Bus completely a line CFLAGS+=-DNO_DBUS_USAGE must be added to Makefile and ompxlayer needs to be fully recompiled. Puts the --no-dbus option out of work.

The Keyboard doesn't use the D-Bus interface anymore... It is ridiculous that it worked that way. In the current releases without a working D-Bus interface (see the log messages

00:51:36 T:1405247230 WARNING: dbus_bus_get_private(): Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
00:51:36 T:1405247339 WARNING: DBus connection failed, trying alternate
00:51:36 T:1405247593 WARNING: dbus_bus_get_private(): Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
00:51:36 T:1405247707 WARNING: DBus connection failed, alternate failed, will continue without DBus

-I can get them too when I ssh without the -X option to my RPI-) the standard key handling still works (follow the m_action handling). The longterm plan behind it is also to make the way free for e.g. a (also feature request) key command file, and even have an omxcontrol switch for the real mpris2 D-Bus implementation.

As mentioned, this is an intial release. There are some things to be shaped (getArg and getWinarg functions of OMXControl); I used NO_DBUS_USAGE around e.g. ACTION_SET_ALPHA as that kind of functons are only usable with D-Bus.

TheSin- commented 8 years ago

oh I see so you just removed it from Keyboard and left all the DBus in the Control cpp. Okay that makes sense. I just assumed it didn't have bus at all since it ran for me using omxplayer.bin from the command line even without --no-dbus. And the old one didn't do that. So maybe it is working I'll test with that shell script and see. I'll report back shortly.

TheSin- commented 8 years ago

hmm odd, if I use omxplayer.bin, I can get it start, but I can not get it to play videos at all using the omxplayer script. With or without --no-dbus, it just hangs

same output with or without --no-dbus

root@topberrypi:~# omxplayer -g -b -r -o hdmi --loop --no-keys --no-osd --no-dbus /usr/share/splash/splash.mov 
Output mode 4: 1280x720@60 N:4
ntsc_freq:1 
Video codec omx-h264 width 480 height 270 profile 77 fps 29.970030
Audio codec aac channels 2 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0

log file

14:23:45 T:18446744072805107721   DEBUG: DllBcm: Using omx system library
14:23:45 T:18446744072805110350   DEBUG: DllOMX: Using omx system library
14:23:45 T:18446744072805118462   DEBUG: DllAvFormat: Using libavformat system library
14:23:45 T:18446744072805118651   DEBUG: DllAvUtilBase: Using libavutil system library
14:23:45 T:18446744072805118718   DEBUG: DllAvCodec: Using libavcodec system library
14:23:45 T:18446744072805118778   DEBUG: DllAvFormat: Using libavformat system library
14:23:45 T:18446744072805289076   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.clock input port 80 output port 81 m_handle 0x114b4b0
14:23:45 T:18446744072805289862   DEBUG: OMXClock::OMXStop
14:23:45 T:18446744072805290142   DEBUG: OMXClock::OMXSetSpeed(0.00) pause_resume:1
14:23:45 T:18446744072805291117   DEBUG: EGL get supported modes (1) = 10, prefer_group=2, prefer_mode=1b
14:23:45 T:18446744072805291959   DEBUG: DllAvUtilBase: Using libavutil system library
14:23:45 T:18446744072805292080   DEBUG: DllAvCodec: Using libavcodec system library
14:23:45 T:18446744072805292146   DEBUG: DllAvFormat: Using libavformat system library
14:23:45 T:18446744072805294656   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.video_decode input port 130 output port 131 m_handle 0x11942e0
14:23:45 T:18446744072805296485   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.video_decode) - port(130), nBufferCountMin(1), nBufferCountActual(60), nBufferSize(81920), nBufferAlignmen(16)
14:23:45 T:18446744072805311754   DEBUG: COMXVideo::Open - decoder_component(0x0x11942e0), input_port(0x82), output_port(0x83) deinterlace 1 hdmiclocksync 1
14:23:45 T:18446744072805312291   DEBUG: OMXThread::Create - Thread with id 1924133968 started
14:23:45 T:18446744072805312417   DEBUG: DllAvUtilBase: Using libavutil system library
14:23:45 T:18446744072805312486   DEBUG: DllAvCodec: Using libavcodec system library
14:23:45 T:18446744072805312546   DEBUG: DllAvFormat: Using libavformat system library
14:23:45 T:18446744072805312614   DEBUG: DllAvUtilBase: Using libavutil system library
14:23:45 T:18446744072805312675   DEBUG: DllAvCodec: Using libavcodec system library
14:23:45 T:18446744072805312752   DEBUG: DllAvFormat: Using libswresample system library
14:23:45 T:18446744072805318824   DEBUG: DllAvUtilBase: Using libavutil system library
14:23:45 T:18446744072805318983   DEBUG: COMXAudio::SetCodingType OMX_AUDIO_CodingPCM
14:23:45 T:18446744072805319092    INFO: CPCMRemap: I channel map: FL,FR
14:23:45 T:18446744072805319196    INFO: CPCMRemap: O channel map: FL,FR
14:23:45 T:18446744072805319267   DEBUG: CPCMRemap: Downmix normalization is disabled
14:23:45 T:18446744072805319368   DEBUG: CPCMRemap: FL = FL(1.000000*)
14:23:45 T:18446744072805319458   DEBUG: CPCMRemap: FR = FR(1.000000*)
14:23:45 T:18446744072805321885   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_decode input port 120 output port 121 m_handle 0x10ce260
14:23:45 T:18446744072805324118   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_decode) - port(120), nBufferCountMin(4), nBufferCountActual(16), nBufferSize(65536), nBufferAlignmen(16)
14:23:45 T:18446744072805338175   DEBUG: COMXAudio::Initialize Input bps 32 samplerate 48000 channels 2 buffer size 576000 bytes per second 384000
14:23:45 T:18446744072805338315   DEBUG: pcm->direction      : input
14:23:45 T:18446744072805338385   DEBUG: pcm->nPortIndex     : 120
14:23:45 T:18446744072805338450   DEBUG: pcm->eNumData       : 0
14:23:45 T:18446744072805338513   DEBUG: pcm->eEndian        : 1
14:23:45 T:18446744072805338575   DEBUG: pcm->bInterleaved   : 1
14:23:45 T:18446744072805338637   DEBUG: pcm->nBitPerSample  : 32
14:23:45 T:18446744072805338701   DEBUG: pcm->ePCMMode       : 0
14:23:45 T:18446744072805338761   DEBUG: pcm->nChannels      : 2
14:23:45 T:18446744072805338822   DEBUG: pcm->nSamplingRate  : 48000
14:23:45 T:18446744072805338886   DEBUG: OMX_AUDIO_ChannelLF
14:23:45 T:18446744072805338945   DEBUG: OMX_AUDIO_ChannelRF
14:23:45 T:18446744072805339007   DEBUG: COMXAudio::Initialize device omx:hdmi passthrough 0 hwdecode 0
14:23:45 T:18446744072805339468   DEBUG: OMXThread::Create - Thread with id 1915745360 started
14:23:45 T:18446744072805339711  NOTICE: OMXClock using audio as reference
14:23:45 T:18446744072805340190   DEBUG: OMXClock::OMXReset audio / video : 1 / 1 wait mask 0->3 state : 2->1

EDIT: it's --no-keys that breaks it. But only when used with the script, with omxplayer.bin --no-keys is fine.

TheSin- commented 8 years ago

okay if I don't use --no-keys, I have tested it.

with --no-dbus

root@topberrypi:~# ./dbuscontrol.sh pause
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2.omxplayer was not provided by any .service files

without --no-dbus, and it paused on the display!!

root@topberrypi:~# ./dbuscontrol.sh pause
root@topberrypi:~# ./dbuscontrol.sh pause

Great job, looks like you just need to figure out --no-keys, otherwise looks great! and is exactly what I need/want!!

jehutting commented 8 years ago

@TheSin- Thanks for testing and reporting the --no-keys failure. I will fix that.

TheSin- commented 8 years ago

let me know if you have a rebuild you want me to test again

jehutting commented 8 years ago

Fixed the --no-keys issue. Get this deb.

TheSin- commented 8 years ago

like a glove!! good job, and thank you for this, now lets get it accepted!

TheSin- commented 8 years ago

@popcornmix still no change of including the --no-dbus option from @jehutting ? It's still working great for me I'd really love to have this option for a better bootsplash option on the Pi.