Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7e68c91e
Commit
7e68c91e
authored
Oct 14, 2012
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rmdec: Move SIPR code shared with Matroska demuxer to a separate file
parent
95cd815c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
53 deletions
+101
-53
Makefile
libavformat/Makefile
+3
-3
matroskadec.c
libavformat/matroskadec.c
+1
-1
rm.h
libavformat/rm.h
+0
-8
rmdec.c
libavformat/rmdec.c
+1
-41
rmsipr.c
libavformat/rmsipr.c
+61
-0
rmsipr.h
libavformat/rmsipr.h
+35
-0
No files found.
libavformat/Makefile
View file @
7e68c91e
...
@@ -136,7 +136,7 @@ OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o
...
@@ -136,7 +136,7 @@ OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o
OBJS-$(CONFIG_M4V_DEMUXER)
+=
m4vdec.o
rawdec.o
OBJS-$(CONFIG_M4V_DEMUXER)
+=
m4vdec.o
rawdec.o
OBJS-$(CONFIG_M4V_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_M4V_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_MATROSKA_DEMUXER)
+=
matroskadec.o
matroska.o
\
OBJS-$(CONFIG_MATROSKA_DEMUXER)
+=
matroskadec.o
matroska.o
\
isom.o
rm
dec.o
rm
.o
isom.o
rm
sipr
.o
OBJS-$(CONFIG_MATROSKA_MUXER)
+=
matroskaenc.o
matroska.o
\
OBJS-$(CONFIG_MATROSKA_MUXER)
+=
matroskaenc.o
matroska.o
\
isom.o
avc.o
\
isom.o
avc.o
\
flacenc_header.o
avlanguage.o
flacenc_header.o
avlanguage.o
...
@@ -242,7 +242,7 @@ OBJS-$(CONFIG_R3D_DEMUXER) += r3d.o
...
@@ -242,7 +242,7 @@ OBJS-$(CONFIG_R3D_DEMUXER) += r3d.o
OBJS-$(CONFIG_RAWVIDEO_DEMUXER)
+=
rawvideodec.o
rawdec.o
OBJS-$(CONFIG_RAWVIDEO_DEMUXER)
+=
rawvideodec.o
rawdec.o
OBJS-$(CONFIG_RAWVIDEO_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_RAWVIDEO_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_RL2_DEMUXER)
+=
rl2.o
OBJS-$(CONFIG_RL2_DEMUXER)
+=
rl2.o
OBJS-$(CONFIG_RM_DEMUXER)
+=
rmdec.o
rm.o
OBJS-$(CONFIG_RM_DEMUXER)
+=
rmdec.o
rm.o
rmsipr.o
OBJS-$(CONFIG_RM_MUXER)
+=
rmenc.o
rm.o
OBJS-$(CONFIG_RM_MUXER)
+=
rmenc.o
rm.o
OBJS-$(CONFIG_ROQ_DEMUXER)
+=
idroqdec.o
OBJS-$(CONFIG_ROQ_DEMUXER)
+=
idroqdec.o
OBJS-$(CONFIG_ROQ_MUXER)
+=
idroqenc.o
rawenc.o
OBJS-$(CONFIG_ROQ_MUXER)
+=
idroqenc.o
rawenc.o
...
...
libavformat/matroskadec.c
View file @
7e68c91e
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
/* For ff_codec_get_id(). */
/* For ff_codec_get_id(). */
#include "riff.h"
#include "riff.h"
#include "isom.h"
#include "isom.h"
#include "rm.h"
#include "rm
sipr
.h"
#include "matroska.h"
#include "matroska.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h"
#include "libavcodec/mpeg4audio.h"
...
...
libavformat/rm.h
View file @
7e68c91e
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
#include "internal.h"
#include "internal.h"
extern
const
char
*
const
ff_rm_metadata
[
4
];
extern
const
char
*
const
ff_rm_metadata
[
4
];
extern
const
unsigned
char
ff_sipr_subpk_size
[
4
];
extern
const
AVCodecTag
ff_rm_codec_tags
[];
extern
const
AVCodecTag
ff_rm_codec_tags
[];
typedef
struct
RMStream
RMStream
;
typedef
struct
RMStream
RMStream
;
...
@@ -93,11 +92,4 @@ int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
...
@@ -93,11 +92,4 @@ int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
int
ff_rm_retrieve_cache
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
int
ff_rm_retrieve_cache
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
AVStream
*
st
,
RMStream
*
rst
,
AVPacket
*
pkt
);
AVStream
*
st
,
RMStream
*
rst
,
AVPacket
*
pkt
);
/**
* Perform 4-bit block reordering for SIPR data.
*
* @param buf SIPR data
*/
void
ff_rm_reorder_sipr_data
(
uint8_t
*
buf
,
int
sub_packet_h
,
int
framesize
);
#endif
/* AVFORMAT_RM_H */
#endif
/* AVFORMAT_RM_H */
libavformat/rmdec.c
View file @
7e68c91e
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "avformat.h"
#include "avformat.h"
#include "internal.h"
#include "internal.h"
#include "riff.h"
#include "riff.h"
#include "rmsipr.h"
#include "rm.h"
#include "rm.h"
#define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r') ///< interleaving for Cooker/Atrac
#define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r') ///< interleaving for Cooker/Atrac
...
@@ -59,21 +60,6 @@ typedef struct {
...
@@ -59,21 +60,6 @@ typedef struct {
int
audio_pkt_cnt
;
///< Output packet counter
int
audio_pkt_cnt
;
///< Output packet counter
}
RMDemuxContext
;
}
RMDemuxContext
;
static
const
unsigned
char
sipr_swaps
[
38
][
2
]
=
{
{
0
,
63
},
{
1
,
22
},
{
2
,
44
},
{
3
,
90
},
{
5
,
81
},
{
7
,
31
},
{
8
,
86
},
{
9
,
58
},
{
10
,
36
},
{
12
,
68
},
{
13
,
39
},
{
14
,
73
},
{
15
,
53
},
{
16
,
69
},
{
17
,
57
},
{
19
,
88
},
{
20
,
34
},
{
21
,
71
},
{
24
,
46
},
{
25
,
94
},
{
26
,
54
},
{
28
,
75
},
{
29
,
50
},
{
32
,
70
},
{
33
,
92
},
{
35
,
74
},
{
38
,
85
},
{
40
,
56
},
{
42
,
87
},
{
43
,
65
},
{
45
,
59
},
{
48
,
79
},
{
49
,
93
},
{
51
,
89
},
{
55
,
95
},
{
61
,
76
},
{
67
,
83
},
{
77
,
80
}
};
const
unsigned
char
ff_sipr_subpk_size
[
4
]
=
{
29
,
19
,
37
,
20
};
static
inline
void
get_strl
(
AVIOContext
*
pb
,
char
*
buf
,
int
buf_size
,
int
len
)
static
inline
void
get_strl
(
AVIOContext
*
pb
,
char
*
buf
,
int
buf_size
,
int
len
)
{
{
int
i
;
int
i
;
...
@@ -719,32 +705,6 @@ rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt)
...
@@ -719,32 +705,6 @@ rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt)
}
}
}
}
/**
* Perform 4-bit block reordering for SIPR data.
* @todo This can be optimized, e.g. use memcpy() if data blocks are aligned
*/
void
ff_rm_reorder_sipr_data
(
uint8_t
*
buf
,
int
sub_packet_h
,
int
framesize
)
{
int
n
,
bs
=
sub_packet_h
*
framesize
*
2
/
96
;
// nibbles per subpacket
for
(
n
=
0
;
n
<
38
;
n
++
)
{
int
j
;
int
i
=
bs
*
sipr_swaps
[
n
][
0
];
int
o
=
bs
*
sipr_swaps
[
n
][
1
];
/* swap 4bit-nibbles of block 'i' with 'o' */
for
(
j
=
0
;
j
<
bs
;
j
++
,
i
++
,
o
++
)
{
int
x
=
(
buf
[
i
>>
1
]
>>
(
4
*
(
i
&
1
)))
&
0xF
,
y
=
(
buf
[
o
>>
1
]
>>
(
4
*
(
o
&
1
)))
&
0xF
;
buf
[
o
>>
1
]
=
(
x
<<
(
4
*
(
o
&
1
)))
|
(
buf
[
o
>>
1
]
&
(
0xF
<<
(
4
*
!
(
o
&
1
))));
buf
[
i
>>
1
]
=
(
y
<<
(
4
*
(
i
&
1
)))
|
(
buf
[
i
>>
1
]
&
(
0xF
<<
(
4
*
!
(
i
&
1
))));
}
}
}
int
int
ff_rm_parse_packet
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
ff_rm_parse_packet
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
AVStream
*
st
,
RMStream
*
ast
,
int
len
,
AVPacket
*
pkt
,
AVStream
*
st
,
RMStream
*
ast
,
int
len
,
AVPacket
*
pkt
,
...
...
libavformat/rmsipr.c
0 → 100644
View file @
7e68c91e
/*
* tables and functions for demuxing SIPR audio muxed RealMedia style
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
#include "rmsipr.h"
const
unsigned
char
ff_sipr_subpk_size
[
4
]
=
{
29
,
19
,
37
,
20
};
static
const
unsigned
char
sipr_swaps
[
38
][
2
]
=
{
{
0
,
63
},
{
1
,
22
},
{
2
,
44
},
{
3
,
90
},
{
5
,
81
},
{
7
,
31
},
{
8
,
86
},
{
9
,
58
},
{
10
,
36
},
{
12
,
68
},
{
13
,
39
},
{
14
,
73
},
{
15
,
53
},
{
16
,
69
},
{
17
,
57
},
{
19
,
88
},
{
20
,
34
},
{
21
,
71
},
{
24
,
46
},
{
25
,
94
},
{
26
,
54
},
{
28
,
75
},
{
29
,
50
},
{
32
,
70
},
{
33
,
92
},
{
35
,
74
},
{
38
,
85
},
{
40
,
56
},
{
42
,
87
},
{
43
,
65
},
{
45
,
59
},
{
48
,
79
},
{
49
,
93
},
{
51
,
89
},
{
55
,
95
},
{
61
,
76
},
{
67
,
83
},
{
77
,
80
}
};
/* This can be optimized, e.g. use memcpy() if data blocks are aligned. */
void
ff_rm_reorder_sipr_data
(
uint8_t
*
buf
,
int
sub_packet_h
,
int
framesize
)
{
int
n
,
bs
=
sub_packet_h
*
framesize
*
2
/
96
;
// nibbles per subpacket
for
(
n
=
0
;
n
<
38
;
n
++
)
{
int
j
;
int
i
=
bs
*
sipr_swaps
[
n
][
0
];
int
o
=
bs
*
sipr_swaps
[
n
][
1
];
/* swap 4bit-nibbles of block 'i' with 'o' */
for
(
j
=
0
;
j
<
bs
;
j
++
,
i
++
,
o
++
)
{
int
x
=
(
buf
[
i
>>
1
]
>>
(
4
*
(
i
&
1
)))
&
0xF
,
y
=
(
buf
[
o
>>
1
]
>>
(
4
*
(
o
&
1
)))
&
0xF
;
buf
[
o
>>
1
]
=
(
x
<<
(
4
*
(
o
&
1
)))
|
(
buf
[
o
>>
1
]
&
(
0xF
<<
(
4
*
!
(
o
&
1
))));
buf
[
i
>>
1
]
=
(
y
<<
(
4
*
(
i
&
1
)))
|
(
buf
[
i
>>
1
]
&
(
0xF
<<
(
4
*
!
(
i
&
1
))));
}
}
}
libavformat/rmsipr.h
0 → 100644
View file @
7e68c91e
/*
* tables and functions for demuxing SIPR audio muxed RealMedia style
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFORMAT_RMSIPR_H
#define AVFORMAT_RMSIPR_H
#include <stdint.h>
extern
const
unsigned
char
ff_sipr_subpk_size
[
4
];
/**
* Perform 4-bit block reordering for SIPR data.
*
* @param buf SIPR data
*/
void
ff_rm_reorder_sipr_data
(
uint8_t
*
buf
,
int
sub_packet_h
,
int
framesize
);
#endif
/* AVFORMAT_RMSIPR_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment