1- From 0b19a91216c630e8193573219ed0f83e2bca64eb Mon Sep 17 00:00:00 2001
1+ From ddd6b27f8ab8e0425651e704846c9d5c68dde83f Mon Sep 17 00:00:00 2001
22From: Isaac Marovitz <isaacryu@icloud.com>
33Date: Wed, 30 Jul 2025 16:54:47 +0100
44Subject: [PATCH] Update portfile
@@ -7,43 +7,44 @@ Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
77
88Add xmaframes
99
10+ Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
11+
12+ Update patch
13+
1014Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
1115---
12- ports/ffmpeg/0008-xmaframes.patch | 287 ++++++++++++++++++++++++++++++
16+ ports/ffmpeg/0008-xmaframes.patch | 206 ++++++++++++++++++++++++++++++
1317 ports/ffmpeg/portfile.cmake | 14 +-
14- 2 files changed, 299 insertions(+), 2 deletions(-)
18+ 2 files changed, 218 insertions(+), 2 deletions(-)
1519 create mode 100644 ports/ffmpeg/0008-xmaframes.patch
1620
1721diff --git a/ports/ffmpeg/0008-xmaframes.patch b/ports/ffmpeg/0008-xmaframes.patch
1822new file mode 100644
19- index 0000000000..9bed6f27b0
23+ index 0000000000..a704b52f8a
2024--- /dev/null
2125+++ b/ports/ffmpeg/0008-xmaframes.patch
22- @@ -0,0 +1,287 @@
23- + From f8fcccf99cc3a06809570c9b2becea99ae041791 Mon Sep 17 00:00:00 2001
26+ @@ -0,0 +1,206 @@
27+ + From 48cbf0db44ccb7ea67b78575faeb3cf8b0202763 Mon Sep 17 00:00:00 2001
2428+ From: Isaac Marovitz <isaacryu@icloud.com>
25- + Date: Sun, 6 Jul 2025 13:23:15 +0100
26- + Subject: [PATCH 1/4] avcodec/wmaprodec: add xma raw frame decoder
27- +
28- + packets need to be handled externally
29- + useful for hardware decoder emulation
29+ + Date: Wed, 30 Jul 2025 17:09:10 +0100
30+ + Subject: [PATCH] xmaframes
3031+
31- + Co-authored-by: Joel Linn <jl@conductive.de>
3232+ Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
3333+ ---
3434+ configure | 1 +
3535+ libavcodec/Makefile | 1 +
3636+ libavcodec/allcodecs.c | 1 +
37- + libavcodec/codec_desc.c | 7 +++
37+ + libavcodec/codec_desc.c | 7 ++++
3838+ libavcodec/codec_id.h | 1 +
39- + libavcodec/wmaprodec.c | 96 +++++++++++++++++++++++++++++++++++++++++
40- + 6 files changed, 107 insertions(+)
39+ + libavcodec/version.c | 2 +-
40+ + libavcodec/wmaprodec.c | 89 +++++++++++++++++++++++++++++++++++++++++
41+ + 7 files changed, 101 insertions(+), 1 deletion(-)
4142+
4243+ diff --git a/configure b/configure
43- + index 63d11de207793..00756b66198f4 100755
44+ + index ffa407d53d55a..bd30ae76e5655 100755
4445+ --- a/configure
4546+ +++ b/configure
46- + @@ -3171 ,6 +3171 ,7 @@ wmv3_decoder_select="vc1_decoder"
47+ + @@ -3130 ,6 +3130 ,7 @@ wmv3_decoder_select="vc1_decoder"
4748+ wmv3image_decoder_select="wmv3_decoder"
4849+ xma1_decoder_select="wmapro_decoder"
4950+ xma2_decoder_select="wmapro_decoder"
@@ -52,10 +53,10 @@ index 0000000000..9bed6f27b0
5253+ zerocodec_decoder_select="inflate_wrapper"
5354+ zlib_decoder_select="inflate_wrapper"
5455+ diff --git a/libavcodec/Makefile b/libavcodec/Makefile
55- + index 215577f7c9f15..065c35c85615c 100644
56+ + index a4fcce3b42156..0dad9f35435b3 100644
5657+ --- a/libavcodec/Makefile
5758+ +++ b/libavcodec/Makefile
58- + @@ -851 ,6 +851 ,7 @@ OBJS-$(CONFIG_XFACE_ENCODER) += xfaceenc.o xface.o
59+ + @@ -839 ,6 +839 ,7 @@ OBJS-$(CONFIG_XFACE_ENCODER) += xfaceenc.o xface.o
5960+ OBJS-$(CONFIG_XL_DECODER) += xl.o
6061+ OBJS-$(CONFIG_XMA1_DECODER) += wmaprodec.o wma.o wma_common.o
6162+ OBJS-$(CONFIG_XMA2_DECODER) += wmaprodec.o wma.o wma_common.o
@@ -64,10 +65,10 @@ index 0000000000..9bed6f27b0
6465+ OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o
6566+ OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o
6667+ diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
67- + index 7b01453ca28df..d8b2c499eba9b 100644
68+ + index aa0fc4764782a..557bf6d82e6dc 100644
6869+ --- a/libavcodec/allcodecs.c
6970+ +++ b/libavcodec/allcodecs.c
70- + @@ -557 ,6 +557 ,7 @@ extern const FFCodec ff_wmavoice_decoder;
71+ + @@ -550 ,6 +550 ,7 @@ extern const FFCodec ff_wmavoice_decoder;
7172+ extern const FFCodec ff_ws_snd1_decoder;
7273+ extern const FFCodec ff_xma1_decoder;
7374+ extern const FFCodec ff_xma2_decoder;
@@ -76,10 +77,10 @@ index 0000000000..9bed6f27b0
7677+ /* PCM codecs */
7778+ extern const FFCodec ff_pcm_alaw_encoder;
7879+ diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
79- + index dae229668937d..2352168d365e5 100644
80+ + index d58c3d889c8d9..bd6177ad4d693 100644
8081+ --- a/libavcodec/codec_desc.c
8182+ +++ b/libavcodec/codec_desc.c
82- + @@ -3298 ,6 +3298 ,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
83+ + @@ -3251 ,6 +3251 ,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
8384+ .long_name = NULL_IF_CONFIG_SMALL("Xbox Media Audio 2"),
8485+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
8586+ },
@@ -94,22 +95,35 @@ index 0000000000..9bed6f27b0
9495+ .id = AV_CODEC_ID_DST,
9596+ .type = AVMEDIA_TYPE_AUDIO,
9697+ diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
97- + index d00d3fe121ea0..5e492a5b65844 100644
98+ + index 0a8d3bed1e38c..b1bbf3efc2320 100644
9899+ --- a/libavcodec/codec_id.h
99100+ +++ b/libavcodec/codec_id.h
100- + @@ -528 ,6 +528 ,7 @@ enum AVCodecID {
101+ + @@ -518 ,6 +518 ,7 @@ enum AVCodecID {
101102+ AV_CODEC_ID_INTERPLAY_ACM,
102103+ AV_CODEC_ID_XMA1,
103104+ AV_CODEC_ID_XMA2,
104105+ + AV_CODEC_ID_XMAFRAMES,
105106+ AV_CODEC_ID_DST,
106107+ AV_CODEC_ID_ATRAC3AL,
107108+ AV_CODEC_ID_ATRAC3PAL,
109+ + diff --git a/libavcodec/version.c b/libavcodec/version.c
110+ + index 27f94323b86d6..b62f95f36b822 100644
111+ + --- a/libavcodec/version.c
112+ + +++ b/libavcodec/version.c
113+ + @@ -35,7 +35,7 @@ unsigned avcodec_version(void)
114+ + AV_CODEC_ID_PCM_SGA == 65572 &&
115+ + AV_CODEC_ID_ADPCM_XMD == 69683 &&
116+ + AV_CODEC_ID_CBD2_DPCM == 81928 &&
117+ + - AV_CODEC_ID_QOA == 86121 &&
118+ + + AV_CODEC_ID_QOA == 86122 &&
119+ + AV_CODEC_ID_ARIB_CAPTION == 94233 &&
120+ + AV_CODEC_ID_SMPTE_2038 == 98315,
121+ + "Don't insert new codec ids in the middle of a list");
108122+ diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
109- + index d87ed0433e19e..a2ac771b50cb3 100644
123+ + index a6c4a756324d0..fcaf3905831e4 100644
110124+ --- a/libavcodec/wmaprodec.c
111125+ +++ b/libavcodec/wmaprodec.c
112- + @@ -400 ,6 +400 ,11 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu
126+ + @@ -408 ,6 +408 ,11 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu
113127+ s->bits_per_sample = 16;
114128+ channel_mask = 0; /* would need to aggregate from all streams */
115129+ s->nb_channels = edata_ptr[8 + 20*num_stream + 17]; /* nth stream config */
@@ -121,7 +135,7 @@ index 0000000000..9bed6f27b0
121135+ } else if (avctx->codec_id == AV_CODEC_ID_WMAPRO && avctx->extradata_size >= 18) {
122136+ s->decode_flags = AV_RL16(edata_ptr+14);
123137+ channel_mask = AV_RL32(edata_ptr+2);
124- + @@ -2082 ,6 +2087,82 @@ static void xma_flush(AVCodecContext *avctx)
138+ + @@ -2088 ,6 +2093,74 @@ static void xma_flush(AVCodecContext *avctx)
125139+ s->flushed = 0;
126140+ }
127141+
@@ -143,19 +157,11 @@ index 0000000000..9bed6f27b0
143157+ + return 0;
144158+ +}
145159+ +
146- + +/**
147- + + *@brief Decode a single WMA frame. Packet parsing is out of this decoders scope.
148- + + *@param avctx codec context
149- + + *@param data the output buffer
150- + + *@param avpkt input packet. the data is preceeded by one byte that contains bit padding information
151- + + *@return number of bytes that were read from the input buffer
152- + + */
153- + +static int xmaframes_decode_packet(AVCodecContext *avctx, void *data,
160+ + +static int xmaframes_decode_packet(AVCodecContext *avctx, AVFrame *frame,
154161+ + int *got_frame_ptr, AVPacket *avpkt)
155162+ +{
156163+ + WMAProDecodeCtx *s = avctx->priv_data;
157164+ + GetBitContext* gb = &s->gb;
158- + + AVFrame *frame = data;
159165+ + int ret, xma_frame_len = 0;
160166+ + uint8_t padding_start, padding_end = 0;
161167+ +
@@ -196,117 +202,34 @@ index 0000000000..9bed6f27b0
196202+ + return 0;
197203+ + }
198204+ +
199- + + decode_frame(s, data , got_frame_ptr);
205+ + + decode_frame(s, frame , got_frame_ptr);
200206+ +
201207+ + return avpkt->size;
202208+ +}
203209+ +
204210+ /**
205211+ *@brief wmapro decoder
206212+ */
207- + @@ -2129 ,3 +2210,18 @@ const FFCodec ff_xma2_decoder = {
208- + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP) ,
213+ + @@ -2150 ,3 +2223,19 @@ const FFCodec ff_xma2_decoder = {
214+ + AV_SAMPLE_FMT_NONE } ,
209215+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
210216+ };
211217+ +
212218+ +const FFCodec ff_xmaframes_decoder = {
213- + + .p.name = "xmaframes",
214- + + CODEC_LONG_NAME("Xbox Media Audio raw frames"),
215- + + .p.type = AVMEDIA_TYPE_AUDIO,
216- + + .p.id = AV_CODEC_ID_XMAFRAMES,
217- + + .priv_data_size = sizeof(WMAProDecodeCtx),
218- + + .init = xmaframes_decode_init,
219- + + .close = xmaframes_decode_end,
220- + + FF_CODEC_DECODE_CB(xmaframes_decode_packet),
221- + + .flush = wmapro_flush,
222- + + .p.capabilities = AV_CODEC_CAP_DR1,
223- + + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP),
224- + + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
219+ + + .p.name = "xmaframes",
220+ + + CODEC_LONG_NAME("Xbox Media Audio raw frames"),
221+ + + .p.type = AVMEDIA_TYPE_AUDIO,
222+ + + .p.id = AV_CODEC_ID_XMAFRAMES,
223+ + + .priv_data_size = sizeof(WMAProDecodeCtx),
224+ + + .init = xmaframes_decode_init,
225+ + + .close = xmaframes_decode_end,
226+ + + FF_CODEC_DECODE_CB(xmaframes_decode_packet),
227+ + + .flush = wmapro_flush,
228+ + + .p.capabilities = AV_CODEC_CAP_DR1,
229+ + + .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
230+ + + AV_SAMPLE_FMT_NONE },
231+ + + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
225232+ +};
226- +
227- + From 6bc3d67e53e91d6656a9194f7b3873da73c04883 Mon Sep 17 00:00:00 2001
228- + From: Isaac Marovitz <isaacryu@icloud.com>
229- + Date: Sun, 6 Jul 2025 13:36:28 +0100
230- + Subject: [PATCH 2/4] Fix version.c
231- +
232- + Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
233- + ---
234- + libavcodec/version.c | 2 +-
235- + 1 file changed, 1 insertion(+), 1 deletion(-)
236- +
237- + diff --git a/libavcodec/version.c b/libavcodec/version.c
238- + index 8a0398f28ff3b..ba8fdac457e04 100644
239- + --- a/libavcodec/version.c
240- + +++ b/libavcodec/version.c
241- + @@ -35,7 +35,7 @@ unsigned avcodec_version(void)
242- + AV_CODEC_ID_PCM_SGA == 65572 &&
243- + AV_CODEC_ID_ADPCM_XMD == 69683 &&
244- + AV_CODEC_ID_CBD2_DPCM == 81928 &&
245- + - AV_CODEC_ID_QOA == 86121 &&
246- + + AV_CODEC_ID_QOA == 86122 &&
247- + AV_CODEC_ID_IVTV_VBI == 94234 &&
248- + AV_CODEC_ID_SMPTE_2038 == 98315,
249- + "Don't insert new codec ids in the middle of a list");
250- +
251- + From b48478c1c0766eb19a713cb771b87d8cb10d7d75 Mon Sep 17 00:00:00 2001
252- + From: Isaac Marovitz <isaacryu@icloud.com>
253- + Date: Sun, 6 Jul 2025 13:38:26 +0100
254- + Subject: [PATCH 3/4] Fix signature
255- +
256- + Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
257- + ---
258- + libavcodec/wmaprodec.c | 10 +---------
259- + 1 file changed, 1 insertion(+), 9 deletions(-)
260- +
261- + diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
262- + index a2ac771b50cb3..a8db563a6addc 100644
263- + --- a/libavcodec/wmaprodec.c
264- + +++ b/libavcodec/wmaprodec.c
265- + @@ -2105,19 +2105,11 @@ static av_cold int xmaframes_decode_end(AVCodecContext* avctx)
266- + return 0;
267- + }
268- +
269- + -/**
270- + - *@brief Decode a single WMA frame. Packet parsing is out of this decoders scope.
271- + - *@param avctx codec context
272- + - *@param data the output buffer
273- + - *@param avpkt input packet. the data is preceeded by one byte that contains bit padding information
274- + - *@return number of bytes that were read from the input buffer
275- + - */
276- + -static int xmaframes_decode_packet(AVCodecContext *avctx, void *data,
277- + +static int xmaframes_decode_packet(AVCodecContext *avctx, AVFrame *frame,
278- + int *got_frame_ptr, AVPacket *avpkt)
279- + {
280- + WMAProDecodeCtx *s = avctx->priv_data;
281- + GetBitContext* gb = &s->gb;
282- + - AVFrame *frame = data;
283- + int ret, xma_frame_len = 0;
284- + uint8_t padding_start, padding_end = 0;
285- +
286- +
287- + From 706d3a4d746b03ffd05b76c869814ccb7fb50541 Mon Sep 17 00:00:00 2001
288- + From: Isaac Marovitz <isaacryu@icloud.com>
289- + Date: Sun, 6 Jul 2025 13:41:51 +0100
290- + Subject: [PATCH 4/4] Typo
291- +
292- + Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
293- + ---
294- + libavcodec/wmaprodec.c | 2 +-
295- + 1 file changed, 1 insertion(+), 1 deletion(-)
296- +
297- + diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
298- + index a8db563a6addc..6cd81ce5cebf1 100644
299- + --- a/libavcodec/wmaprodec.c
300- + +++ b/libavcodec/wmaprodec.c
301- + @@ -2150,7 +2150,7 @@ static int xmaframes_decode_packet(AVCodecContext *avctx, AVFrame *frame,
302- + return 0;
303- + }
304- +
305- + - decode_frame(s, data, got_frame_ptr);
306- + + decode_frame(s, frame, got_frame_ptr);
307- +
308- + return avpkt->size;
309- + }
310233diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake
311234index 519b343af0..9abcbbd3a5 100644
312235--- a/ports/ffmpeg/portfile.cmake
@@ -355,3 +278,4 @@ index 519b343af0..9abcbbd3a5 100644
355278 string(REGEX REPLACE "-arch [A-Za-z0-9_]+" "" VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE_SANITIZED "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}")
356279- -
3572802.39.5 (Apple Git-154)
281+
0 commit comments