Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Mplayer freezes after feh is used
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 26
Location: FL, USA

PostPosted: Fri Jan 05, 2018 2:50 pm    Post subject: [Solved] Mplayer freezes after feh is used Reply with quote

Hello,

I am running mplayer-1.3.0 remotely on a Gentoo Linux computer (4.1.43-gentoo-r1, x86_64):
Code:
mplayer -display :0.0 -slave -msglevel all=4 -input file=/tmp/mplayer_cmd /home/user/video.mkv


Where /tmp/mplayer_cmd is a named pipe created beforehand.

Config file ~/.mplayer/config:
Code:
vo=vdpau
vc=ffh264vdpau
fs=1


There is no display manager.

I need to pause playback and display a PNG image on the screen with Feh program.

Mplayer is paused like this:
Code:
echo -n -e 'pausing get_file_name\x0A' > /tmp/mplayer_cmd


Then, feh is called (and the picture appears on the screen)
Code:

DISPLAY=:0.0 feh /home/user/image.png


The problem comes when I need to stop feh and continue playback:

CTRL+C is pressed to stop feh. Feh process disappears, however, the image stays on the screen.

An attempt to resume playback fails - mplayer simply does not react, nor respond on any command:
Code:
echo -n -e 'get_file_name\x0A' > /tmp/mplayer_cmd


At the same time CPU usage of mplayer process goes to 100%.

What seems to make mplayer alive again is any keystroke (even pressing ALT button works). At which point mplayer resumes playback and responds to ALL commands that were sent to it while it was frozen. Using the keyboard to unpause the mplayer in first place does not cause this strange behavior. It only occurs when mplayer is commanded with slave protocol.

So, I am trying to understand what is this element that hangs and waits for a keystroke.

Does anybody have any idea what is going on?
_________________
Use GNU/Linux


Last edited by nc-pv on Fri Feb 02, 2018 3:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
blopsalot
Apprentice
Apprentice


Joined: 28 Jan 2017
Posts: 231

PostPosted: Fri Jan 05, 2018 6:41 pm    Post subject: Reply with quote

mplayer is not quite abandoned, but 1.3.0 is almost 2 years old. you may want to try https://wiki.gentoo.org/wiki/Mpv
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 26
Location: FL, USA

PostPosted: Fri Jan 05, 2018 9:49 pm    Post subject: Reply with quote

Blopsalot,

Thank you for your response. First, I would like to see if I can make it work with mplayer.
_________________
Use GNU/Linux
Back to top
View user's profile Send private message
beandog
Developer
Developer


Joined: 04 May 2003
Posts: 2062
Location: /usa/utah

PostPosted: Fri Feb 02, 2018 5:13 am    Post subject: Reply with quote

What slave commands are you sending it to wake it up?

Also have you tried a tiny window manager? That may help, but dunno what your reasons are for not wanting one. I'd recommend tinywm myself or evilwm is good.
_________________
If it ain't broke, tweak it. packages | dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 26
Location: FL, USA

PostPosted: Fri Feb 02, 2018 2:57 pm    Post subject: Reply with quote

beandog wrote:
What slave commands are you sending it to wake it up?


I use this command:

Code:
get_file_name


beandog wrote:
Also have you tried a tiny window manager? That may help, but dunno what your reasons are for not wanting one. I'd recommend tinywm myself or evilwm is good.


No I have not. However, recently I figured out a solution that worked for me.

I have a program written in C that does all the above manipulations with mplayer - forks it, kills it, controls it, etc.

I call LibXCB's xcb_clear_area_checked() function on the root window right after feh has been terminated. It removes the old picture that was displayed by feh and brings mplayer back to live.

I wondering if anybody else will ever need to know this, since this use case and the problem that I run into appears to be very unique.
_________________
Use GNU/Linux
Back to top
View user's profile Send private message
beandog
Developer
Developer


Joined: 04 May 2003
Posts: 2062
Location: /usa/utah

PostPosted: Fri Feb 02, 2018 3:20 pm    Post subject: Reply with quote

nc-pv wrote:
I wondering if anybody else will ever need to know this, since this use case and the problem that I run into appears to be very unique.


I'm really curious to see what you came up with. Plus, Gentoo is all about unique situations. :)
_________________
If it ain't broke, tweak it. packages | dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 26
Location: FL, USA

PostPosted: Fri Feb 02, 2018 3:58 pm    Post subject: Reply with quote

beandog wrote:
nc-pv wrote:
I wondering if anybody else will ever need to know this, since this use case and the problem that I run into appears to be very unique.


I'm really curious to see what you came up with. Plus, Gentoo is all about unique situations. :)


Yeah, right!

I do not remember how exactly I arrived to that solution, but I was doing a lot of testing to see what could be causing this behavior. And I found that clearing display's root window after feh has been closed solves the problem. At that point it was just a matter of implementing this functionality into the control program that runs on that computer. There were two options - using Xlib library or XCB library. I decided to go with XCB and wrote a small function that clears all root windows for particular display of the X server. So, I could say the problem was solved by programming.

Code:
static void clear_root_window()
{
    xcb_connection_t * xcb_ctx = xcb_connect( ":0", NULL );

    const int err = xcb_connection_has_error( xcb_ctx );

    if( err != 0 )
    {
        switch( err )
        {
        case XCB_CONN_ERROR:
            syslog( LOG_ERR, "XCB: Socket, pipe or stream error" );
            break;
        case XCB_CONN_CLOSED_EXT_NOTSUPPORTED:
            syslog( LOG_ERR, "XCB: Extension not supported" );
            break;
        case XCB_CONN_CLOSED_MEM_INSUFFICIENT:
            syslog( LOG_ERR, "XCB: Memory is not available" );
            break;
        case XCB_CONN_CLOSED_REQ_LEN_EXCEED:
            syslog( LOG_ERR, "XCB: Maximum request length exceeded" );
            break;
        case XCB_CONN_CLOSED_PARSE_ERR:
            syslog( LOG_ERR, "XCB: Error parsing display string" );
            break;
        case XCB_CONN_CLOSED_INVALID_SCREEN:
            syslog( LOG_ERR, "XCB: Invalid screen" );
            break;
        default:
            syslog( LOG_ERR, "XCB: Unknown error" );
            break;
        }

        xcb_disconnect( xcb_ctx );
        return;
    }

    xcb_screen_iterator_t it = xcb_setup_roots_iterator( xcb_get_setup( xcb_ctx ));

    // "i" represents static limit for maximum iterations of this loop
    for( int i = 0; i < 128 && it.rem > 0; ++i, xcb_screen_next( &it ) )
    {
        // Per the man page, this request never generates errors
        xcb_clear_area_checked( xcb_ctx, 0, it.data->root, 0, 0, 0, 0 );
    }

    xcb_flush( xcb_ctx );

    xcb_disconnect( xcb_ctx );
}

_________________
Use GNU/Linux
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum