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
ba118447
Commit
ba118447
authored
Sep 12, 2003
by
Mike Melanson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deploy palette control API
Originally committed as revision 2266 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
50f52fcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
18 deletions
+30
-18
avcodec.h
libavcodec/avcodec.h
+19
-0
xan.c
libavcodec/xan.c
+6
-6
wc3movie.c
libavformat/wc3movie.c
+5
-12
No files found.
libavcodec/avcodec.h
View file @
ba118447
...
@@ -1305,6 +1305,25 @@ typedef struct AVPicture {
...
@@ -1305,6 +1305,25 @@ typedef struct AVPicture {
int
linesize
[
4
];
///< number of bytes per line
int
linesize
[
4
];
///< number of bytes per line
}
AVPicture
;
}
AVPicture
;
/**
* AVPaletteControl
* This structure defines a method for communicating palette changes
* between and demuxer and a decoder.
*/
typedef
struct
AVPaletteControl
{
/* demuxer sets this to 1 to indicate the palette has changed;
* decoder resets to 0 */
int
palette_changed
;
/* 256 3-byte RGB palette entries; the components should be
* formatted in the buffer as "RGBRGB..." and should be scaled to
* 8 bits if they originally represented 6-bit VGA palette
* components */
unsigned
char
palette
[
256
*
3
];
}
AVPaletteControl
;
extern
AVCodec
ac3_encoder
;
extern
AVCodec
ac3_encoder
;
extern
AVCodec
mp2_encoder
;
extern
AVCodec
mp2_encoder
;
extern
AVCodec
mp3lame_encoder
;
extern
AVCodec
mp3lame_encoder
;
...
...
libavcodec/xan.c
View file @
ba118447
...
@@ -115,9 +115,9 @@ static int xan_decode_init(AVCodecContext *avctx)
...
@@ -115,9 +115,9 @@ static int xan_decode_init(AVCodecContext *avctx)
s
->
avctx
=
avctx
;
s
->
avctx
=
avctx
;
if
((
avctx
->
codec
->
id
==
CODEC_ID_XAN_WC3
)
&&
if
((
avctx
->
codec
->
id
==
CODEC_ID_XAN_WC3
)
&&
(
s
->
avctx
->
extradata_size
!=
PALETTE_CONTROL_SIZE
))
{
(
s
->
avctx
->
extradata_size
!=
sizeof
(
AVPaletteControl
)
))
{
printf
(
" WC3 Xan video: expected extradata_size of %d
\n
"
,
printf
(
" WC3 Xan video: expected extradata_size of %d
\n
"
,
PALETTE_CONTROL_SIZE
);
sizeof
(
AVPaletteControl
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -809,13 +809,13 @@ static int xan_decode_frame(AVCodecContext *avctx,
...
@@ -809,13 +809,13 @@ static int xan_decode_frame(AVCodecContext *avctx,
uint8_t
*
buf
,
int
buf_size
)
uint8_t
*
buf
,
int
buf_size
)
{
{
XanContext
*
s
=
avctx
->
priv_data
;
XanContext
*
s
=
avctx
->
priv_data
;
unsigned
char
*
palette_control
=
avctx
->
extradata
;
AVPaletteControl
*
palette_control
=
(
AVPaletteControl
*
)
avctx
->
extradata
;
int
keyframe
=
0
;
int
keyframe
=
0
;
if
(
palette_control
[
0
]
)
{
if
(
palette_control
->
palette_changed
)
{
/* load the new palette and reset the palette control */
/* load the new palette and reset the palette control */
xan_wc3_build_palette
(
s
,
&
palette_control
[
1
]
);
xan_wc3_build_palette
(
s
,
palette_control
->
palette
);
palette_control
[
0
]
=
0
;
palette_control
->
palette_changed
=
0
;
keyframe
=
1
;
keyframe
=
1
;
}
}
...
...
libavformat/wc3movie.c
View file @
ba118447
...
@@ -74,9 +74,6 @@
...
@@ -74,9 +74,6 @@
#define PALETTE_SIZE (256 * 3)
#define PALETTE_SIZE (256 * 3)
#define PALETTE_COUNT 256
#define PALETTE_COUNT 256
/* palette is 3 bytes per entry plus 1 byte at the front to indicate to the
* decoder if the palette has changed */
#define PALETTE_CONTROL_SIZE ((PALETTE_COUNT * 3) + 1)
typedef
struct
Wc3DemuxContext
{
typedef
struct
Wc3DemuxContext
{
int
width
;
int
width
;
...
@@ -87,8 +84,7 @@ typedef struct Wc3DemuxContext {
...
@@ -87,8 +84,7 @@ typedef struct Wc3DemuxContext {
int
video_stream_index
;
int
video_stream_index
;
int
audio_stream_index
;
int
audio_stream_index
;
/* save a reference to extradata */
AVPaletteControl
palette_control
;
unsigned
char
*
palette_control
;
}
Wc3DemuxContext
;
}
Wc3DemuxContext
;
...
@@ -163,7 +159,6 @@ static int wc3_read_header(AVFormatContext *s,
...
@@ -163,7 +159,6 @@ static int wc3_read_header(AVFormatContext *s,
wc3
->
palette_count
=
0
;
wc3
->
palette_count
=
0
;
wc3
->
pts
=
0
;
wc3
->
pts
=
0
;
wc3
->
video_stream_index
=
wc3
->
audio_stream_index
=
0
;
wc3
->
video_stream_index
=
wc3
->
audio_stream_index
=
0
;
wc3
->
palette_control
=
av_mallocz
(
PALETTE_CONTROL_SIZE
);;
/* skip the first 3 32-bit numbers */
/* skip the first 3 32-bit numbers */
url_fseek
(
pb
,
12
,
SEEK_CUR
);
url_fseek
(
pb
,
12
,
SEEK_CUR
);
...
@@ -263,8 +258,8 @@ static int wc3_read_header(AVFormatContext *s,
...
@@ -263,8 +258,8 @@ static int wc3_read_header(AVFormatContext *s,
st
->
codec
.
height
=
wc3
->
height
;
st
->
codec
.
height
=
wc3
->
height
;
/* palette considerations */
/* palette considerations */
st
->
codec
.
extradata_size
=
PALETTE_CONTROL_SIZE
;
st
->
codec
.
extradata_size
=
sizeof
(
AVPaletteControl
)
;
st
->
codec
.
extradata
=
wc3
->
palette_control
;
st
->
codec
.
extradata
=
&
wc3
->
palette_control
;
st
=
av_new_stream
(
s
,
0
);
st
=
av_new_stream
(
s
,
0
);
if
(
!
st
)
if
(
!
st
)
...
@@ -324,11 +319,10 @@ static int wc3_read_packet(AVFormatContext *s,
...
@@ -324,11 +319,10 @@ static int wc3_read_packet(AVFormatContext *s,
palette_number
=
LE_32
(
&
preamble
[
0
]);
palette_number
=
LE_32
(
&
preamble
[
0
]);
if
(
palette_number
>=
wc3
->
palette_count
)
if
(
palette_number
>=
wc3
->
palette_count
)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
memcpy
(
wc3
->
palette_control
+
1
,
memcpy
(
wc3
->
palette_control
.
palette
,
&
wc3
->
palettes
[
palette_number
*
PALETTE_COUNT
*
3
],
&
wc3
->
palettes
[
palette_number
*
PALETTE_COUNT
*
3
],
PALETTE_COUNT
*
3
);
PALETTE_COUNT
*
3
);
/* indicate a palette change */
wc3
->
palette_control
.
palette_changed
=
1
;
wc3
->
palette_control
[
0
]
=
1
;
break
;
break
;
case
VGA__TAG
:
case
VGA__TAG
:
...
@@ -396,7 +390,6 @@ static int wc3_read_close(AVFormatContext *s)
...
@@ -396,7 +390,6 @@ static int wc3_read_close(AVFormatContext *s)
Wc3DemuxContext
*
wc3
=
(
Wc3DemuxContext
*
)
s
->
priv_data
;
Wc3DemuxContext
*
wc3
=
(
Wc3DemuxContext
*
)
s
->
priv_data
;
av_free
(
wc3
->
palettes
);
av_free
(
wc3
->
palettes
);
av_free
(
wc3
->
palette_control
);
return
0
;
return
0
;
}
}
...
...
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