Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Steve Lhomme
vlc
Commits
025fde2a
Commit
025fde2a
authored
Jun 19, 2017
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: revector, no functional changes
parent
bdf4249d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
40 deletions
+60
-40
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+22
-8
modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.c
+4
-22
modules/codec/avcodec/avcodec.h
modules/codec/avcodec/avcodec.h
+4
-3
modules/codec/avcodec/subtitle.c
modules/codec/avcodec/subtitle.c
+12
-3
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+18
-4
No files found.
modules/codec/avcodec/audio.c
View file @
025fde2a
...
...
@@ -210,28 +210,35 @@ void EndAudioDec( decoder_t *p_dec )
*****************************************************************************
* The avcodec codec will be opened, some memory allocated.
*****************************************************************************/
int
InitAudioDec
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
,
const
AVCodec
*
p_codec
)
int
InitAudioDec
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
;
const
AVCodec
*
codec
;
AVCodecContext
*
avctx
=
ffmpeg_AllocContext
(
p_dec
,
&
codec
);
if
(
avctx
==
NULL
)
return
VLC_EGENERIC
;
avctx
->
refcounted_frames
=
true
;
/* Allocate the memory needed to store the decoder's structure */
if
(
(
p_dec
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
*
p_sys
))
)
==
NULL
)
decoder_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
if
(
unlikely
(
p_sys
==
NULL
)
)
{
avcodec_free_context
(
&
avctx
);
return
VLC_ENOMEM
;
}
p_
context
->
refcounted_frames
=
true
;
p_sys
->
p_context
=
p_context
;
p_sys
->
p_codec
=
p_
codec
;
p_
dec
->
p_sys
=
p_sys
;
p_sys
->
p_context
=
avctx
;
p_sys
->
p_codec
=
codec
;
// Initialize decoder extradata
InitDecoderConfig
(
p_dec
,
p_context
);
InitDecoderConfig
(
p_dec
,
avctx
);
/* ***** Open the codec ***** */
if
(
OpenAudioCodec
(
p_dec
)
<
0
)
{
free
(
p_sys
);
avcodec_free_context
(
&
avctx
);
return
VLC_EGENERIC
;
}
...
...
@@ -253,6 +260,13 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
p_dec
->
pf_decode
=
DecodeAudio
;
p_dec
->
pf_flush
=
Flush
;
/* XXX: Writing input format makes little sense. */
if
(
avctx
->
profile
!=
FF_PROFILE_UNKNOWN
)
p_dec
->
fmt_in
.
i_profile
=
avctx
->
profile
;
if
(
avctx
->
level
!=
FF_LEVEL_UNKNOWN
)
p_dec
->
fmt_in
.
i_level
=
avctx
->
level
;
return
VLC_SUCCESS
;
}
...
...
modules/codec/avcodec/avcodec.c
View file @
025fde2a
...
...
@@ -236,7 +236,6 @@ vlc_module_begin ()
#endif
vlc_module_end
()
static
AVCodecContext
*
ffmpeg_AllocContext
(
decoder_t
*
p_dec
,
const
AVCodec
**
restrict
codecp
)
{
...
...
@@ -295,41 +294,24 @@ AVCodecContext *ffmpeg_AllocContext( decoder_t *p_dec,
static
int
OpenDecoder
(
vlc_object_t
*
p_this
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
const
AVCodec
*
p_codec
;
AVCodecContext
*
avctx
=
ffmpeg_AllocContext
(
p_dec
,
&
p_codec
);
if
(
unlikely
(
avctx
==
NULL
)
)
return
VLC_EGENERIC
;
int
ret
;
switch
(
p_dec
->
fmt_in
.
i_cat
)
{
case
VIDEO_ES
:
ret
=
InitVideoDec
(
p_dec
,
avctx
,
p_codec
);
ret
=
InitVideoDec
(
p_dec
);
break
;
case
AUDIO_ES
:
ret
=
InitAudioDec
(
p_dec
,
avctx
,
p_codec
);
ret
=
InitAudioDec
(
p_dec
);
break
;
case
SPU_ES
:
ret
=
InitSubtitleDec
(
p_dec
,
avctx
,
p_codec
);
ret
=
InitSubtitleDec
(
p_dec
);
break
;
default:
vlc_assert_unreachable
();
}
if
(
ret
!=
VLC_SUCCESS
)
{
avcodec_free_context
(
&
avctx
);
return
ret
;
}
if
(
avctx
->
profile
!=
FF_PROFILE_UNKNOWN
)
p_dec
->
fmt_in
.
i_profile
=
avctx
->
profile
;
if
(
avctx
->
level
!=
FF_LEVEL_UNKNOWN
)
p_dec
->
fmt_in
.
i_level
=
avctx
->
level
;
return
VLC_SUCCESS
;
return
ret
;
}
/*****************************************************************************
...
...
modules/codec/avcodec/avcodec.h
View file @
025fde2a
...
...
@@ -35,18 +35,19 @@ int OpenEncoder ( vlc_object_t * );
void
CloseEncoder
(
vlc_object_t
*
);
/* Video Decoder */
int
InitVideoDec
(
decoder_t
*
,
AVCodecContext
*
,
const
AVCodec
*
);
int
InitVideoDec
(
decoder_t
*
);
void
EndVideoDec
(
decoder_t
*
p_dec
);
/* Audio Decoder */
int
InitAudioDec
(
decoder_t
*
,
AVCodecContext
*
,
const
AVCodec
*
);
int
InitAudioDec
(
decoder_t
*
);
void
EndAudioDec
(
decoder_t
*
p_dec
);
/* Subtitle Decoder */
int
InitSubtitleDec
(
decoder_t
*
,
AVCodecContext
*
,
const
AVCodec
*
);
int
InitSubtitleDec
(
decoder_t
*
);
void
EndSubtitleDec
(
decoder_t
*
);
/* Initialize decoder */
AVCodecContext
*
ffmpeg_AllocContext
(
decoder_t
*
,
const
AVCodec
**
);
int
ffmpeg_OpenCodec
(
decoder_t
*
p_dec
,
AVCodecContext
*
,
const
AVCodec
*
);
/*****************************************************************************
...
...
modules/codec/avcodec/subtitle.c
View file @
025fde2a
...
...
@@ -52,9 +52,13 @@ static void Flush(decoder_t *);
/**
* Initialize subtitle decoder
*/
int
InitSubtitleDec
(
decoder_t
*
dec
,
AVCodecContext
*
context
,
const
AVCodec
*
codec
)
int
InitSubtitleDec
(
decoder_t
*
dec
)
{
const
AVCodec
*
codec
;
AVCodecContext
*
context
=
ffmpeg_AllocContext
(
dec
,
&
codec
);
if
(
context
==
NULL
)
return
VLC_EGENERIC
;
decoder_sys_t
*
sys
;
/* */
...
...
@@ -65,13 +69,17 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
break
;
default:
msg_Warn
(
dec
,
"refusing to decode non validated subtitle codec"
);
avcodec_free_context
(
&
context
);
return
VLC_EGENERIC
;
}
/* */
dec
->
p_sys
=
sys
=
malloc
(
sizeof
(
*
sys
));
if
(
!
sys
)
if
(
unlikely
(
sys
==
NULL
))
{
avcodec_free_context
(
&
context
);
return
VLC_ENOMEM
;
}
sys
->
p_context
=
context
;
sys
->
p_codec
=
codec
;
...
...
@@ -107,6 +115,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
if
(
ret
<
0
)
{
msg_Err
(
dec
,
"cannot open codec (%s)"
,
codec
->
name
);
free
(
sys
);
avcodec_free_context
(
&
context
);
return
VLC_EGENERIC
;
}
...
...
modules/codec/avcodec/video.c
View file @
025fde2a
...
...
@@ -434,16 +434,24 @@ static int OpenVideoCodec( decoder_t *p_dec )
* the ffmpeg codec will be opened, some memory allocated. The vout is not yet
* opened (done after the first decoded frame).
*****************************************************************************/
int
InitVideoDec
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
,
const
AVCodec
*
p_codec
)
int
InitVideoDec
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
;
const
AVCodec
*
p_codec
;
AVCodecContext
*
p_context
=
ffmpeg_AllocContext
(
p_dec
,
&
p_codec
);
if
(
p_context
==
NULL
)
return
VLC_EGENERIC
;
int
i_val
;
/* Allocate the memory needed to store the decoder's structure */
if
(
(
p_dec
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
decoder_sys_t
)
)
)
==
NULL
)
decoder_sys_t
*
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
if
(
unlikely
(
p_sys
==
NULL
)
)
{
avcodec_free_context
(
&
p_context
);
return
VLC_ENOMEM
;
}
p_dec
->
p_sys
=
p_sys
;
p_sys
->
p_context
=
p_context
;
p_sys
->
p_codec
=
p_codec
;
p_sys
->
p_va
=
NULL
;
...
...
@@ -590,12 +598,18 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
{
vlc_sem_destroy
(
&
p_sys
->
sem_mt
);
free
(
p_sys
);
avcodec_free_context
(
&
p_context
);
return
VLC_EGENERIC
;
}
p_dec
->
pf_decode
=
DecodeVideo
;
p_dec
->
pf_flush
=
Flush
;
/* XXX: Writing input format makes little sense. */
if
(
p_context
->
profile
!=
FF_PROFILE_UNKNOWN
)
p_dec
->
fmt_in
.
i_profile
=
p_context
->
profile
;
if
(
p_context
->
level
!=
FF_LEVEL_UNKNOWN
)
p_dec
->
fmt_in
.
i_level
=
p_context
->
level
;
return
VLC_SUCCESS
;
}
...
...
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