• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/madplay/0001-switch-to-new-alsa-api.patch
Peter KorsgaardPeter Korsgaard committed 298cd8eaa2103 Feb 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
                 printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err));
 
1
Switch madplay to the new API. This is done thanks to a patch written
2
by Micha Nelissen <micha@neli.hopto.org> and available at
3
http://article.gmane.org/gmane.comp.audio.mad.devel/729.
4
​
5
--- madplay-0.15.2b/audio_alsa.c    2008-10-18 15:10:16.000000000 +0200
6
+++ madplay-0.15.2b/audio_alsa.c.new    2008-10-18 15:03:27.000000000 +0200
7
@@ -28,31 +28,30 @@
8
​
9
 #include <errno.h>
10
​
11
-#define ALSA_PCM_OLD_HW_PARAMS_API
12
-#define ALSA_PCM_OLD_SW_PARAMS_API
13
 #include <alsa/asoundlib.h>
14
​
15
 #include <mad.h>
16
​
17
 #include "audio.h"
18
​
19
-char *buf  = NULL;
20
-int paused = 0;
21
+#define BUFFER_TIME_MAX     500000
22
​
23
-int rate   = -1;
24
-int channels   = -1;
25
-int bitdepth   = -1;
26
-int sample_size    = -1;
27
-
28
-int buffer_time        = 500000;
29
-int period_time        = 100000;
30
-char *defaultdev   = "plughw:0,0";
31
+unsigned char *buf  = NULL;
32
+int paused     = 0;
33
+
34
+unsigned int rate           = 0;
35
+unsigned int channels      = -1;
36
+unsigned int bitdepth      = -1;
37
+unsigned int sample_size    = -1;
38
+
39
+unsigned int buffer_time;
40
+unsigned int period_time;
41
+char *defaultdev       = "plughw:0,0";
42
​
43
 snd_pcm_hw_params_t *alsa_hwparams;
44
 snd_pcm_sw_params_t *alsa_swparams;
45
​
46
-snd_pcm_sframes_t buffer_size;
47
-snd_pcm_sframes_t period_size;
48
+snd_pcm_uframes_t buffer_size;
49
​
50
 snd_pcm_format_t  alsa_format = -1;
51
 snd_pcm_access_t  alsa_access = SND_PCM_ACCESS_MMAP_INTERLEAVED;
52
@@ -66,14 +65,20 @@
53
         snd_pcm_hw_params_t *params,
54
         snd_pcm_access_t access)
55
 {
56
-   int err, dir;
57
-   
58
+   int err;
59
+
60
    /* choose all parameters */
61
    err = snd_pcm_hw_params_any(handle,params);
62
    if (err < 0) {
63
        printf("Access type not available for playback: %s\n", snd_strerror(err));
64
        return err;
65
    }
66
+   /* set the access type */
67
+   err = snd_pcm_hw_params_set_access(handle, params, alsa_access);
68
+   if (err < 0) {
69
+       printf("Sample format not available for playback: %s\n", snd_strerror(err));
70
+       return err;
71
+   }
72
    /* set the sample format */
73
    err = snd_pcm_hw_params_set_format(handle, params, alsa_format);
74
    if (err < 0) {
75
@@ -87,29 +92,38 @@
76
        return err;
77
    }
78
    /* set the stream rate */
79
-   err = snd_pcm_hw_params_set_rate_near(handle, params, rate, 0);
80
+   err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
81
    if (err < 0) {
82
        printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
83
        return err;
84
    }
85
-   if (err != rate) {
86
-       printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err);
87
-       return -EINVAL;
88
-   }
89
+   err = snd_pcm_hw_params_get_buffer_time_max(params, &buffer_time, NULL);
90
+        if (err < 0) {
91
+                printf("Unable to retrieve buffer time: %s\n", snd_strerror(err));
92
+                return err;
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.