Skip to content

Commit

Permalink
Added support of VLC 2.2.x and 3.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nurupo committed Nov 10, 2014
1 parent 785c4ea commit 716870f
Show file tree
Hide file tree
Showing 10 changed files with 594 additions and 27 deletions.
28 changes: 3 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,8 @@
This plugin allows you to pause/play a video by clicking on the video image.

## Supported versions of VLC
Tested to work on VLC 2.1.5, so supposedly should work on 2.1.x versions.
2.2.x and 3.0.x (see [`vlc-2.2.x+/`](vlc-2.2.x+/) directory).

Doesn't work on VLC 3.x because of API changes.
2.1.x (see [`vlc-2.1.x/`](vlc-2.1.x/) directory).

## Install

### Debian
Get required libraries and tools:
```bash
sudo apt-get install build-essential pkg-config libvlccore-dev
```

Build and install:
```bash
make
sudo make install
```

### Windows
If you are using 32-bit VLC, simply extract [this archive](https://github.com/nurupo/vlc-pause-click-plugin/releases/download/0.1.0/windows-i686.zip) at `{VLC}/plugins/video_filter/`

## Usage
1. Go into advanced preferences: Tools -> Preferences -> Show settings -> All
2. Enable/Disable the plugin with a checkbox: (in advanced preferences) Video -> Filters -> Pause/Play video on mouse click
3. Restart VLC
4. Play a video
5. Click on video picture to pause/play the video
Versions lower than 2.1.0 are not supported, though you might want to take a look at [this](https://github.com/3demax/vlc-clickpause) lua extension.
File renamed without changes.
2 changes: 1 addition & 1 deletion Makefile → vlc-2.1.x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ uninstall:
rm -f $(plugindir)/video_filter/libpause_click_plugin.so

clean:
rm -f -- libpause_click_plugin.so *.o
rm -f -- libpause_click_plugin.so pause_click.o

mostlyclean: clean

Expand Down
30 changes: 30 additions & 0 deletions vlc-2.1.x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Pause Click plugin for VLC
This plugin allows you to pause/play a video by clicking on the video image.

## Supported versions of VLC
Tested to work on VLC 2.1.5, so supposedly should work on 2.1.x.

## Install

### Windows
To be added soon.

### Debian
Get required libraries and tools:
```bash
sudo apt-get install build-essential pkg-config libvlccore-dev
```

Build and install:
```bash
make
sudo make install
```

## Usage
1. Restart VLC after installing the plugin
2. Go into advanced preferences: Tools -> Preferences -> Show settings -> All
3. Enable/Disable the plugin with a checkbox: (in advanced preferences) Video -> Filters -> Pause/Play video on mouse click
4. Restart VLC
5. Play a video
6. Click on video picture to pause/play the video
1 change: 0 additions & 1 deletion pause_click.c → vlc-2.1.x/pause_click.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ vlc_module_begin()
set_description(N_("Pause/Play video on mouse click"))
set_shortname(N_("Pause click"))
set_capability("video filter2", 0)
// there might be a better place for it
set_category(CAT_VIDEO)
set_subcategory(SUBCAT_VIDEO_VFILTER)
set_callbacks(Open, NULL)
Expand Down
29 changes: 29 additions & 0 deletions vlc-2.2.x+/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
48 changes: 48 additions & 0 deletions vlc-2.2.x+/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
PREFIX = /usr
LD = ld
CC = cc
INSTALL = install
CFLAGS = -g -O2 -Wall -Wextra
LDFLAGS =
VLC_PLUGIN_CFLAGS := $(shell pkg-config --cflags vlc-plugin)
VLC_PLUGIN_LIBS := $(shell pkg-config --libs vlc-plugin)

libdir = $(PREFIX)/lib
plugindir = $(libdir)/vlc/plugins

override CC += -std=gnu99
override CPPFLAGS += -DPIC -I. -Isrc
override CFLAGS += -fPIC
override LDFLAGS += -Wl,-no-undefined,-z,defs

override CPPFLAGS += -DMODULE_STRING=\"pause_click\"
override CFLAGS += $(VLC_PLUGIN_CFLAGS)
override LDFLAGS += $(VLC_PLUGIN_LIBS)

TARGETS = libpause_click_plugin.so

all: libpause_click_plugin.so

install: all
mkdir -p -- $(DESTDIR)$(plugindir)/video_filter
$(INSTALL) --mode 0755 libpause_click_plugin.so $(DESTDIR)$(plugindir)/video_filter

install-strip:
$(MAKE) install INSTALL="$(INSTALL) -s"

uninstall:
rm -f $(plugindir)/video_filter/libpause_click_plugin.so

clean:
rm -f -- libpause_click_plugin.so pause_click.o

mostlyclean: clean

SOURCES = pause_click.c

$(SOURCES:%.c=%.o): %: pause_click.c

libpause_click_plugin.so: $(SOURCES:%.c=%.o)
$(CC) $(LDFLAGS) -shared -o $@ $^

.PHONY: all install install-strip uninstall clean mostlyclean
33 changes: 33 additions & 0 deletions vlc-2.2.x+/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Pause Click plugin for VLC
This plugin allows you to pause/play a video by clicking on the video image.

## Supported versions of VLC
Tested to work on VLC 2.2.0 and 3.0.0, so supposedly should work on 2.2.x and 3.0.x versions.

## Install

### Windows
To be added soon.

### Debian
Get required libraries and tools:
```bash
sudo apt-get install build-essential pkg-config libvlccore-dev
```

Build and install:
```bash
make
sudo make install
```

Note: because of API change in VLC 2.2.0 this build requires `vlc_interface.h`, which is not present in libvlccore-dev package since it's not considered to be a public header by VLC build system. `vlc_interface.h` that is present here is from the current master branch of VLC (3.0.0). It's highly unlikely, but if the plugin doesn't work, you might need to get `vlc_interface.h` appropriate for your VLC version out of the VLC source tree.

## Usage
1. Restart VLC after installing the plugin
2. Go into advanced preferences: Tools -> Preferences -> Show settings -> All
3. Enable/Disable the plugin with a checkbox: (in advanced preferences) Video -> Filters -> Pause/Play video on mouse click
4. Enable/Disable the plugin with a checkbox: (in advanced preferences) Interface -> Control Interfaces -> Pause/Play video on mouse click
5. Restart VLC
6. Play a video
7. Click on video picture to pause/play the video
87 changes: 87 additions & 0 deletions vlc-2.2.x+/pause_click.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*****************************************************************************
* pause_click.c : A filter that allows to pause/play a video by a mouse click
*****************************************************************************
* Copyright (C) 2014 Maxim Biro
*
* Authors: Maxim Biro <nurupo.contributions@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/

#ifdef HAVE_CONFIG_H
# include "config.h"
#else
# define N_(str) (str)
#endif

#include <vlc_common.h>
#include <vlc_filter.h>
#include <vlc_interface.h>
#include <vlc_mouse.h>
#include <vlc_playlist.h>
#include <vlc_plugin.h>

int OpenFilter(vlc_object_t *);
int OpenInterface(vlc_object_t *);

intf_thread_t *p_intf = NULL;

vlc_module_begin()
set_description("Pause/Play video on mouse click")
set_shortname("Pause-on-click")
set_capability("video filter2", 0)
set_category(CAT_VIDEO)
set_subcategory(SUBCAT_VIDEO_VFILTER)
set_callbacks(OpenFilter, NULL)
add_submodule()
set_capability("interface", 0)
set_category(CAT_INTERFACE)
set_subcategory(SUBCAT_INTERFACE_CONTROL)
set_callbacks(OpenInterface, NULL)
vlc_module_end()

int mouse(filter_t *p_filter, vlc_mouse_t *p_mouse_out, const vlc_mouse_t *p_mouse_old, const vlc_mouse_t *p_mouse_new)
{
if (p_intf != NULL && vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, MOUSE_BUTTON_LEFT)) {
playlist_t* p_playlist = pl_Get(p_intf);
playlist_Control(p_playlist, (playlist_Status(p_playlist) == PLAYLIST_RUNNING ? PLAYLIST_PAUSE : PLAYLIST_PLAY), 0);
}

// don't propagate any mouse change
return VLC_EGENERIC;
}

picture_t *filter(filter_t *p_filter, picture_t *p_pic_in)
{
// don't alter picture
return p_pic_in;
}

int OpenFilter(vlc_object_t *p_this)
{
filter_t *p_filter = (filter_t *)p_this;

p_filter->pf_video_filter = filter;
p_filter->pf_video_mouse = mouse;

return VLC_SUCCESS;
}

int OpenInterface(vlc_object_t *p_this)
{
p_intf = (intf_thread_t*) p_this;

return VLC_SUCCESS;
}
Loading

0 comments on commit 716870f

Please sign in to comment.