Skip to content

Commit

Permalink
Update Github Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
adrg committed Sep 13, 2024
1 parent dd734af commit 374767a
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 109 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/ci-v2.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/ci.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/lint-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint V2

on:
push:
branches: [master]
pull_request:

permissions:
contents: read

jobs:
lint:
strategy:
matrix:
go: [stable]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true

- name: Prerequisites
run: |
sudo apt-get update
sudo apt-get -y install libvlc-dev vlc-plugin-base vlc-plugin-video-output vlc-plugin-access-extra
- name: Prepare checkout
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4

- name: Lint
working-directory: ./v2
uses: golangci/golangci-lint-action@v6.1.0
with:
version: latest
args: --timeout=5m
41 changes: 41 additions & 0 deletions .github/workflows/lint-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint V3

on:
push:
branches: [master]
pull_request:

permissions:
contents: read

jobs:
lint:
strategy:
matrix:
go: [stable]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true

- name: Prerequisites
run: |
sudo apt-get update
sudo apt-get -y install libvlc-dev vlc-plugin-base vlc-plugin-video-output vlc-plugin-access-extra
- name: Prepare checkout
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4

- name: Lint
working-directory: ./v3
uses: golangci/golangci-lint-action@v6.1.0
with:
version: latest
args: --timeout=5m
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
</h1>

<h3 align="center">Go bindings for libVLC and high-level media player interface.</h3>
<h3 align="center">Handcrafted Go bindings for libVLC and high-level media player interface</h3>

<p align="center">
<a href="https://github.com/adrg/libvlc-go/actions/workflows/ci.yml">
Expand Down
31 changes: 19 additions & 12 deletions v3/media_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (ml *MediaList) AddMedia(m *Media) error {
if err := ml.Lock(); err != nil {
return err
}
defer ml.Unlock()
defer ml.unlock()

// Add the media to the list.
if C.libvlc_media_list_add_media(ml.list, m.media) < 0 {
Expand Down Expand Up @@ -133,7 +133,7 @@ func (ml *MediaList) InsertMedia(m *Media, index uint) error {
if err := ml.Lock(); err != nil {
return err
}
defer ml.Unlock()
defer ml.unlock()

// Insert the media in the list.
if C.libvlc_media_list_insert_media(ml.list, m.media, C.int(index)) < 0 {
Expand Down Expand Up @@ -207,7 +207,7 @@ func (ml *MediaList) RemoveMediaAtIndex(index uint) error {
if err := ml.Lock(); err != nil {
return err
}
defer ml.Unlock()
defer ml.unlock()

// Remove the media from the list.
if C.libvlc_media_list_remove_index(ml.list, C.int(index)) < 0 {
Expand All @@ -223,7 +223,7 @@ func (ml *MediaList) MediaAtIndex(index uint) (*Media, error) {
if err := ml.Lock(); err != nil {
return nil, err
}
defer ml.Unlock()
defer ml.unlock()

// Retrieve the media at the specified index.
media := C.libvlc_media_list_item_at_index(ml.list, C.int(index))
Expand All @@ -239,8 +239,9 @@ func (ml *MediaList) MediaAtIndex(index uint) (*Media, error) {
}

// IndexOfMedia returns the index of the specified media item in the list.
// NOTE: The same instance of a media item can be present multiple times
// in the list. The method returns the first matched index.
//
// NOTE: The same instance of a media item can be present multiple times
// in the list. The method returns the first matched index.
func (ml *MediaList) IndexOfMedia(m *Media) (int, error) {
if err := m.assertInit(); err != nil {
return 0, err
Expand All @@ -249,7 +250,7 @@ func (ml *MediaList) IndexOfMedia(m *Media) (int, error) {
if err := ml.Lock(); err != nil {
return 0, err
}
defer ml.Unlock()
defer ml.unlock()

// Retrieve the index of the media.
idx := int(C.libvlc_media_list_index_of_item(ml.list, m.media))
Expand All @@ -266,7 +267,7 @@ func (ml *MediaList) Count() (int, error) {
if err := ml.Lock(); err != nil {
return 0, err
}
defer ml.Unlock()
defer ml.unlock()

// Retrieve media count.
return int(C.libvlc_media_list_count(ml.list)), nil
Expand All @@ -284,7 +285,8 @@ func (ml *MediaList) IsReadOnly() (bool, error) {
// AssociatedMedia returns the media instance associated with the list,
// if one exists. A media instance is automatically associated with the
// list of its sub-items.
// NOTE: Do not call Release on the returned media instance.
//
// NOTE: Do not call Release on the returned media instance.
func (ml *MediaList) AssociatedMedia() (*Media, error) {
if err := ml.assertInit(); err != nil {
return nil, err
Expand All @@ -303,8 +305,9 @@ func (ml *MediaList) AssociatedMedia() (*Media, error) {
}

// AssociateMedia associates the specified media with the media list instance.
// NOTE: If another media instance is already associated with the list,
// it will be released.
//
// NOTE: If another media instance is already associated with the list,
// it will be released.
func (ml *MediaList) AssociateMedia(m *Media) error {
if err := ml.assertInit(); err != nil {
return err
Expand Down Expand Up @@ -333,7 +336,7 @@ func (ml *MediaList) Unlock() error {
return err
}

C.libvlc_media_list_unlock(ml.list)
ml.unlock()
return nil
}

Expand All @@ -358,3 +361,7 @@ func (ml *MediaList) assertInit() error {

return nil
}

func (ml *MediaList) unlock() {
C.libvlc_media_list_unlock(ml.list)
}

0 comments on commit 374767a

Please sign in to comment.