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
71a861cf
Commit
71a861cf
authored
Jun 18, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: make avcodec_alloc_context3 officially public.
Deprecate avcodec_alloc_context/2.
parent
18c007ba
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
17 deletions
+41
-17
cmdutils.c
cmdutils.c
+1
-1
ffserver.c
ffserver.c
+2
-2
api-example.c
libavcodec/api-example.c
+4
-4
avcodec.h
libavcodec/avcodec.h
+22
-5
motion-test.c
libavcodec/motion-test.c
+1
-1
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+1
-1
options.c
libavcodec/options.c
+4
-0
version.h
libavcodec/version.h
+3
-0
movenc.c
libavformat/movenc.c
+1
-1
movenchint.c
libavformat/movenchint.c
+1
-1
utils.c
libavformat/utils.c
+1
-1
No files found.
cmdutils.c
View file @
71a861cf
...
...
@@ -63,7 +63,7 @@ void init_opts(void)
{
int
i
;
for
(
i
=
0
;
i
<
AVMEDIA_TYPE_NB
;
i
++
)
avcodec_opts
[
i
]
=
avcodec_alloc_context
2
(
i
);
avcodec_opts
[
i
]
=
avcodec_alloc_context
3
(
NULL
);
avformat_opts
=
avformat_alloc_context
();
#if CONFIG_SWSCALE
sws_opts
=
sws_getContext
(
16
,
16
,
0
,
16
,
16
,
0
,
SWS_BICUBIC
,
NULL
,
NULL
,
NULL
);
...
...
ffserver.c
View file @
71a861cf
...
...
@@ -3468,7 +3468,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
if
(
!
fst
)
return
NULL
;
if
(
copy
)
{
fst
->
codec
=
avcodec_alloc_context
(
);
fst
->
codec
=
avcodec_alloc_context3
(
NULL
);
memcpy
(
fst
->
codec
,
codec
,
sizeof
(
AVCodecContext
));
if
(
codec
->
extradata_size
)
{
fst
->
codec
->
extradata
=
av_malloc
(
codec
->
extradata_size
);
...
...
@@ -3885,7 +3885,7 @@ static void add_codec(FFStream *stream, AVCodecContext *av)
st
=
av_mallocz
(
sizeof
(
AVStream
));
if
(
!
st
)
return
;
st
->
codec
=
avcodec_alloc_context
(
);
st
->
codec
=
avcodec_alloc_context
3
(
NULL
);
stream
->
streams
[
stream
->
nb_streams
++
]
=
st
;
memcpy
(
st
->
codec
,
av
,
sizeof
(
AVCodecContext
));
}
...
...
libavcodec/api-example.c
View file @
71a861cf
...
...
@@ -65,7 +65,7 @@ static void audio_encode_example(const char *filename)
exit
(
1
);
}
c
=
avcodec_alloc_context
(
);
c
=
avcodec_alloc_context3
(
codec
);
/* put sample parameters */
c
->
bit_rate
=
64000
;
...
...
@@ -135,7 +135,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
exit
(
1
);
}
c
=
avcodec_alloc_context
(
);
c
=
avcodec_alloc_context3
(
codec
);
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
...
...
@@ -216,7 +216,7 @@ static void video_encode_example(const char *filename)
exit
(
1
);
}
c
=
avcodec_alloc_context
(
);
c
=
avcodec_alloc_context3
(
codec
);
picture
=
avcodec_alloc_frame
();
/* put sample parameters */
...
...
@@ -347,7 +347,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
exit
(
1
);
}
c
=
avcodec_alloc_context
(
);
c
=
avcodec_alloc_context3
(
codec
);
picture
=
avcodec_alloc_frame
();
if
(
codec
->
capabilities
&
CODEC_CAP_TRUNCATED
)
...
...
libavcodec/avcodec.h
View file @
71a861cf
...
...
@@ -3529,21 +3529,38 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
* we WILL change its arguments and name a few times! */
int
avcodec_get_context_defaults3
(
AVCodecContext
*
s
,
AVCodec
*
codec
);
#if FF_API_ALLOC_CONTEXT
/**
* Allocate an AVCodecContext and set its fields to default values. The
* resulting struct can be deallocated by simply calling av_free().
*
* @return An AVCodecContext filled with default values or NULL on failure.
* @see avcodec_get_context_defaults
*
* @deprecated use avcodec_alloc_context3()
*/
attribute_deprecated
AVCodecContext
*
avcodec_alloc_context
(
void
);
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
* we WILL change its arguments and name a few times! */
attribute_deprecated
AVCodecContext
*
avcodec_alloc_context2
(
enum
AVMediaType
);
#endif
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
* we WILL change its arguments and name a few times! */
/**
* Allocate an AVCodecContext and set its fields to default values. The
* resulting struct can be deallocated by simply calling av_free().
*
* @param codec if non-NULL, allocate private data and initialize defaults
* for the given codec. It is illegal to then call avcodec_open()
* with a different codec.
*
* @return An AVCodecContext filled with default values or NULL on failure.
* @see avcodec_get_context_defaults
*
* @deprecated use avcodec_alloc_context3()
*/
AVCodecContext
*
avcodec_alloc_context3
(
AVCodec
*
codec
);
/**
...
...
@@ -3553,7 +3570,7 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
* can use this AVCodecContext to decode/encode video/audio data.
*
* @param dest target codec context, should be initialized with
* avcodec_alloc_context(), but otherwise uninitialized
* avcodec_alloc_context
3
(), but otherwise uninitialized
* @param src source codec context
* @return AVERROR() on error (e.g. memory allocation error), 0 on success
*/
...
...
@@ -3640,7 +3657,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
* if (!codec)
* exit(1);
*
* context = avcodec_alloc_context
(
);
* context = avcodec_alloc_context
3(codec
);
*
* if (avcodec_open(context, codec) < 0)
* exit(1);
...
...
@@ -3649,7 +3666,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
* @param avctx The context which will be set up to use the given codec.
* @param codec The codec to use within the context.
* @return zero on success, a negative value on error
* @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder, avcodec_close
* @see avcodec_alloc_context
3
, avcodec_find_decoder, avcodec_find_encoder, avcodec_close
*
* @deprecated use avcodec_open2
*/
...
...
libavcodec/motion-test.c
View file @
71a861cf
...
...
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
printf
(
"ffmpeg motion test
\n
"
);
ctx
=
avcodec_alloc_context
(
);
ctx
=
avcodec_alloc_context
3
(
NULL
);
ctx
->
dsp_mask
=
AV_CPU_FLAG_FORCE
;
dsputil_init
(
&
cctx
,
ctx
);
for
(
c
=
0
;
c
<
flags_size
;
c
++
)
{
...
...
libavcodec/mpegvideo_enc.c
View file @
71a861cf
...
...
@@ -944,7 +944,7 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){
static
int
estimate_best_b_count
(
MpegEncContext
*
s
){
AVCodec
*
codec
=
avcodec_find_encoder
(
s
->
avctx
->
codec_id
);
AVCodecContext
*
c
=
avcodec_alloc_context
(
);
AVCodecContext
*
c
=
avcodec_alloc_context3
(
NULL
);
AVFrame
input
[
FF_MAX_B_FRAMES
+
2
];
const
int
scale
=
s
->
avctx
->
brd_scale
;
int
i
,
j
,
out_size
,
p_lambda
,
b_lambda
,
lambda2
;
...
...
libavcodec/options.c
View file @
71a861cf
...
...
@@ -540,6 +540,7 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
return
avctx
;
}
#if FF_API_ALLOC_CONTEXT
AVCodecContext
*
avcodec_alloc_context2
(
enum
AVMediaType
codec_type
){
AVCodecContext
*
avctx
=
av_malloc
(
sizeof
(
AVCodecContext
));
...
...
@@ -549,14 +550,17 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
return
avctx
;
}
#endif
void
avcodec_get_context_defaults
(
AVCodecContext
*
s
){
avcodec_get_context_defaults2
(
s
,
AVMEDIA_TYPE_UNKNOWN
);
}
#if FF_API_ALLOC_CONTEXT
AVCodecContext
*
avcodec_alloc_context
(
void
){
return
avcodec_alloc_context2
(
AVMEDIA_TYPE_UNKNOWN
);
}
#endif
int
avcodec_copy_context
(
AVCodecContext
*
dest
,
const
AVCodecContext
*
src
)
{
...
...
libavcodec/version.h
View file @
71a861cf
...
...
@@ -68,6 +68,9 @@
#ifndef FF_API_GET_PIX_FMT_NAME
#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_ALLOC_CONTEXT
#define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AVCODEC_OPEN
#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
...
...
libavformat/movenc.c
View file @
71a861cf
...
...
@@ -2102,7 +2102,7 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
track
->
mode
=
mov
->
mode
;
track
->
tag
=
MKTAG
(
't'
,
'e'
,
'x'
,
't'
);
track
->
timescale
=
MOV_TIMESCALE
;
track
->
enc
=
avcodec_alloc_context
(
);
track
->
enc
=
avcodec_alloc_context
3
(
NULL
);
track
->
enc
->
codec_type
=
AVMEDIA_TYPE_SUBTITLE
;
for
(
i
=
0
;
i
<
s
->
nb_chapters
;
i
++
)
{
...
...
libavformat/movenchint.c
View file @
71a861cf
...
...
@@ -36,7 +36,7 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
track
->
tag
=
MKTAG
(
'r'
,
't'
,
'p'
,
' '
);
track
->
src_track
=
src_index
;
track
->
enc
=
avcodec_alloc_context
(
);
track
->
enc
=
avcodec_alloc_context
3
(
NULL
);
if
(
!
track
->
enc
)
goto
fail
;
track
->
enc
->
codec_type
=
AVMEDIA_TYPE_DATA
;
...
...
libavformat/utils.c
View file @
71a861cf
...
...
@@ -2668,7 +2668,7 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
return
NULL
;
}
st
->
codec
=
avcodec_alloc_context
(
);
st
->
codec
=
avcodec_alloc_context3
(
NULL
);
if
(
s
->
iformat
)
{
/* no default bitrate if decoding */
st
->
codec
->
bit_rate
=
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