/
mpg321-0.3.2.patchset
103 lines (97 loc) · 3.08 KB
/
mpg321-0.3.2.patchset
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From fe24ad2d395ffecfafc39e24db00eb3253e13ed7 Mon Sep 17 00:00:00 2001
From: raefaldhia <raefaldhiamartya@gmail.com>
Date: Sat, 17 Dec 2016 12:18:33 +0700
Subject: Add compatibility to build on haiku
diff --git a/mpg321.c b/mpg321.c
index 19282bb..e728d7e 100644
--- a/mpg321.c
+++ b/mpg321.c
@@ -47,7 +47,6 @@
#include <sys/mman.h>
#include <sys/ipc.h>
#include <sys/sem.h>
-#include <sys/shm.h>
#include <getopt.h> /* GNU getopt is needed, so I included it */
#include "mpg321.h"
@@ -614,56 +613,7 @@ int main(int argc, char *argv[])
goto out;
//exit(EXIT_FAILURE);
}
-
- /* Shared Memory */
- mem_key = ftok(argv[0],1);
- shm_id = shmget(mem_key,buffer_size * sizeof(output_frame), IPC_CREAT | S_IREAD | S_IWRITE);
- if(shm_id == -1)
- {
- perror("Cannot initialize shared buffer");
- goto out;
- //exit(EXIT_FAILURE);
- }
- Output_Queue = shmat(shm_id,NULL,0);
- if(*(int *)Output_Queue == -1)
- {
- perror("Error while attaching shared buffer to mad_decoder");
- if(shmctl(shm_id,IPC_RMID,NULL))
- perror("Cannot destroy shared buffer");
- goto out;
- //exit(EXIT_FAILURE);
- }
- static int n;
- for(n=0;n<buffer_size;n++)
- {
- memset((Output_Queue+n)->data,'\0',4608);
- memset((Output_Queue+n)->time,'\0',80);
- (Output_Queue+n)->length = 0;
- (Output_Queue+n)->seconds = 0;
- (Output_Queue+n)->num_frames = 0;
- }
- frames_key = ftok(argv[0],2);
- frames_id = shmget(frames_key,buffer_size * sizeof(decoded_frames), IPC_CREAT | S_IREAD | S_IWRITE);
- if(frames_id == -1)
- {
- perror("Cannot initialize shared frames counter");
- goto out;
- //exit(EXIT_FAILURE);
- }
- Decoded_Frames = shmat(frames_id,NULL,0);
- if(*(int *)Decoded_Frames == -1)
- {
- perror("Error while attaching shared frames counter to mad_decoder");
- if(shmctl(frames_id,IPC_RMID,NULL))
- perror("Cannot destroy shared frames counter");
- goto out;
- //exit(EXIT_FAILURE);
- }
-
- Decoded_Frames->is_http = 0;
- Decoded_Frames->is_file = 0;
-
}
else {
ao_initialize();
@@ -1187,12 +1137,6 @@ out:
perror("Error while waiting for output process to exit");
if(semctl(semarray,0,IPC_RMID) == -1)
perror("Error while destroying semaphores");
- if(shmdt(Output_Queue) == -1)
- perror("Error while detaching shared buffer");
- if(shmctl(shm_id,IPC_RMID,NULL))
- perror("Cannot destroy shared buffer");
- if(shmctl(frames_id,IPC_RMID,NULL))
- perror("Cannot destroy shared buffer");
}
return(0);
}
diff --git a/options.c b/options.c
index dae001e..3ba0f91 100644
--- a/options.c
+++ b/options.c
@@ -312,7 +312,6 @@ void parse_options(int argc, char *argv[], playlist *pl)
case 'I':
/* We only try to get high priority. If it fails (just as
mpg123 does when run as a user), that's fine */
- setpriority(PRIO_PROCESS, getpid(), -20);
break;
case 'T':
--
2.7.0