Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
opuscomment
tests/
endianness.c
*.o
nls/*/opuscomment.cat
6 changes: 6 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/hcmiya/opuscomment)
![GitHub Release Date](https://img.shields.io/github/release-date/hcmiya/opuscomment)
![GitHub repo size](https://img.shields.io/github/repo-size/hcmiya/opuscomment)
![GitHub all releases](https://img.shields.io/github/downloads/hcmiya/opuscomment/total)
![GitHub](https://img.shields.io/github/license/hcmiya/opuscomment)

# opuscomment

## 概要
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
`Origin_:`![GitHub release (latest by date)](https://img.shields.io/github/v/release/hcmiya/opuscomment)
![GitHub Release Date](https://img.shields.io/github/release-date/hcmiya/opuscomment)
![GitHub repo size](https://img.shields.io/github/repo-size/hcmiya/opuscomment)
![GitHub all releases](https://img.shields.io/github/downloads/hcmiya/opuscomment/total)
![GitHub](https://img.shields.io/github/license/hcmiya/opuscomment)
`ORG.SLM:`![GitHub release (latest by date)](https://img.shields.io/github/v/release/Sound-Linux-More/opuscomment)
![GitHub Release Date](https://img.shields.io/github/release-date/Sound-Linux-More/opuscomment)
![GitHub repo size](https://img.shields.io/github/repo-size/Sound-Linux-More/opuscomment)
![GitHub all releases](https://img.shields.io/github/downloads/Sound-Linux-More/opuscomment/total)
![GitHub](https://img.shields.io/github/license/Sound-Linux-More/opuscomment)

# opuscomment

The formal README is written in [Japanese](./README.ja.md).
Expand Down
2 changes: 1 addition & 1 deletion doc/man/man1/opuschgain.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <[email protected]>.
.TH "OPUSCHGAIN" "1" "2019-06-02" "1.5.8" "User Manual"
.TH "OPUSCHGAIN" "1" "2022-07-24" "1.5.14" "User Manual"

.SH NAME
opuschgain \- Updated Ogg Opus file output gain and R128 gain tag
Expand Down
2 changes: 1 addition & 1 deletion doc/man/man1/opuscomment.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <[email protected]>.
.TH "OPUSCOMMENT" "1" "2019-06-02" "1.5.8" "User Manual"
.TH "OPUSCOMMENT" "1" "2022-07-24" "1.5.14" "User Manual"

.SH NAME
opuscomment \- Ogg Edit Opus file output gain and tag
Expand Down
2 changes: 1 addition & 1 deletion doc/man/man1/opusmbptag.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <[email protected]>.
.TH "OPUSMBPTAG" "1" "2019-06-02" "1.5.8" "User Manual"
.TH "OPUSMBPTAG" "1" "2022-07-24" "1.5.14" "User Manual"

.SH NAME
opusmbptag \- Generate METADATA_BLOCK_PICTURE tag from image file
Expand Down
36 changes: 36 additions & 0 deletions doc/man/man1/opuspic2tag.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.TH "OpusPic2Tag" "1" "2022-07-24" "1.5.14" "User Manual"
.SH NAME
opuspic2tag \- Convert picture to opus tag
.SH SYNOPSIS
.B opuspic2tag
.RI [ OPTIONS ]
.I FILE{.jpg,.png,.gif}
.SH DESCRIPTION
.PP
\fBopuspic2tag\fP is part \fBopustags\fP for edit the comment header of an Opus file.
.SH OPTIONS
.TP
.B \-h, \-\-help
Display a brief description of the options.
.TP
.B \-d, \-\-desc \fISTRING\fI
description
.TP
.B \-t, \-\-type NUM
set image type by 0-20 or keywords. Default: 3
.TP
.B \-o, \-\-output \fIFILE\fI
Output text file.
.SH EXAMPLE
opuspic2tag cover.jpg > cover.opustags
.PP
opuspic2tag -o cover.opustags cover.png
.PP
opuspic2tag cover.gif >> file.opustags
.SH SEE ALSO
.BR opuscomment (1),
.BR opusenc (1),
.BR vorbiscomment (1),
.BR sed (1)
.SH AUTHOR
Frédéric Mangano <[email protected]>
32 changes: 17 additions & 15 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,40 @@
# NLSに対応していない、あるいは必要がない場合は、CFLAGSに-UNLSを追加することで無効に出来ます。
# `DEFAULT_NLS_PATH`を文字列でdefineをすると、NLSPATHが無い時に最初にcatopen(3)をする場所を指定することができます。

CC=c99
CFLAGS=-D_POSIX_C_SOURCE=200809L -DNLS -g
LDFLAGS=-logg -lm -lpthread
SRCS=put-tags.c parse-tags.c read.c read-flac.c ocutil.c retrieve-tags.c select-codec.c
CONFSRCS=endianness.c error.c main.c
OBJS=$(SRCS:.c=.o) $(CONFSRCS:.c=.o)
SRCP=opuspic2tag.c picture.c
CONFSRCS=endianness.c error.c opuscomment.c
HEADERS=global.h ocutil.h limit.h error.h iconv-impl.h
ERRORDEFS=errordef/opus.tab errordef/main.tab
DEFAULT_MACROS=-D_POSIX_C_SOURCE=200809L -DNLS
#DEFAULT_MACROS=-D_XOPEN_SOURCE=600 -DNLS
LIBS=-logg -lm -lpthread
CC=c99
ERRORDEFS=errordef/opus.tab errordef/opuscomment.tab
OBJS=$(SRCS:.c=.o) $(CONFSRCS:.c=.o)
OBJP=$(SRCP:.c=.o)
RM = rm -f

all: opuscomment ;
all: opuscomment opuspic2tag

opuscomment: $(OBJS)
$(CC) -o opuscomment $(DEFAULT_MACROS) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@

opuspic2tag: $(OBJP)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
$(CC) $(DEFAULT_MACROS) $(CFLAGS) -c $<
$(CC) $(CFLAGS) -c $<

$(SRCS): $(HEADERS)
@touch $@

endianness.c: endianness-check.sh
./endianness-check.sh >endianness.c

error.c: $(ERRORDEFS) $(HEADERS)
@touch $@

main.c: $(HEADERS) version.h
opuscomment.c: $(HEADERS) version.h
@touch $@

clean:
rm endianness.c opuscomment $(OBJS) 2>/dev/null || :
$(RM) opuscomment opuspic2tag $(OBJS) $(OBJP) 2>/dev/null || :
52 changes: 0 additions & 52 deletions src/endianness-check.sh

This file was deleted.

73 changes: 73 additions & 0 deletions src/endianness.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include <stdint.h>
int endian_test()
{
int out[3] = {0, -1, 1}; // {terrible, little, big} endian
uint32_t sample = {0x02000001};
uint8_t *test = (uint8_t *)&sample;
return out[test[0]];
}

uint16_t oi16(uint16_t i)
{
int et = endian_test();
if (et == -1)
return i;
else if (et == 1)
return (i << 8 | i >> 8);
else
{
uint16_t sample = {0x0100};
uint8_t out[2];
uint8_t *ind = (uint8_t *)&sample;
uint8_t *val = (uint8_t *)&i;
for (int j = 0; j < 2; j++)
out[ind[j]] = val[j];
return *(uint16_t*)out;
}
}
uint32_t oi32(uint32_t i)
{
int et = endian_test();
if (et == -1)
return i;
else if (et == 1)
return (i << 24
| (i & (255ULL << 8)) << 8
| (i & (255ULL << 16)) >> 8
| i >> 24);
else
{
uint32_t sample = {0x03020100};
uint8_t out[4];
uint8_t *ind = (uint8_t *)&sample;
uint8_t *val = (uint8_t *)&i;
for (int j = 0; j < 4; j++)
out[ind[j]] = val[j];
return *(uint32_t*)out;
}
}
uint64_t oi64(uint64_t i)
{
int et = endian_test();
if (et == -1)
return i;
else if (et == 1)
return (i << 56
| (i & (255ULL << 8)) << 40
| (i & (255ULL << 16)) << 24
| (i & (255ULL << 24)) << 8
| (i & (255ULL << 32)) >> 8
| (i & (255ULL << 40)) >> 24
| (i & (255ULL << 48)) >> 40
| i >> 56);
else
{
uint64_t sample = {0x0706050403020100};
uint8_t out[8];
uint8_t *ind = (uint8_t *)&sample;
uint8_t *val = (uint8_t *)&i;
for (int j = 0; j < 8; j++)
out[ind[j]] = val[j];
return *(uint64_t*)out;
}
}
Loading