[FFmpeg-devel] [PATCH] Export H264 profile/level in AVCodecContext
Michael Niedermayer
michaelni
Thu Jan 28 16:53:02 CET 2010
On Thu, Jan 28, 2010 at 02:02:29PM +0100, Rafa?l Carr? wrote:
> Hi,
>
> profile_idc / level_idc are copied verbatim to avctx after the sps has
> been decoded.
>
> Add descriptions of the profile to avcodec.h, level is self descriptive.
>
>
> I am not sure of what happens in a multi threaded context:
>
> Is it possible to have a stream with different sequences and different
> profile/level combinations in each SPS ?
>
> If it's the case I think AVCodecContext shouldn't be modified until all
> the frames from the previous sequence have been decoded (the parser
> should be safe on this point), and I don't know how to do that.
>
> Thread synchronisation isn't obvious when reading h264.c, I only see
> that execute_decode_slices() is the only user of avctx->execute() and
> that it's called before & after SPS decoding in decode_nal_units()
>
> If the first context waits for all the other contexts to finish
> execution then it won't be a problem when using multiple threads.
>
> --
> Rafa?l Carr?
> avcodec.h | 10 ++++++++++
> h264.c | 5 ++++-
> h264_parser.c | 5 ++++-
> 3 files changed, 18 insertions(+), 2 deletions(-)
> 2c6dd04c26f97edb41acbfce03456497182058f1 h264-profile-level.diff
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index aa59097..332ab92 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2123,11 +2123,21 @@ typedef struct AVCodecContext {
> */
> int profile;
> #define FF_PROFILE_UNKNOWN -99
> +
> #define FF_PROFILE_AAC_MAIN 0
> #define FF_PROFILE_AAC_LOW 1
> #define FF_PROFILE_AAC_SSR 2
> #define FF_PROFILE_AAC_LTP 3
>
> +#define FF_PROFILE_H264_BASELINE 66
> +#define FF_PROFILE_H264_MAIN 77
> +#define FF_PROFILE_H264_EXTENDED 88
> +#define FF_PROFILE_H264_HIGH 100
> +#define FF_PROFILE_H264_HIGH_10 110
> +#define FF_PROFILE_H264_HIGH_422 122
> +#define FF_PROFILE_H264_HIGH_444 244
> +#define FF_PROFILE_H264_CAVLC_444 44
> +
> /**
> * level
> * - encoding: Set by user.
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index e4a47cf..1ebe931 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -2589,7 +2589,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
> break;
> case NAL_SPS:
> init_get_bits(&s->gb, ptr, bit_length);
> - ff_h264_decode_seq_parameter_set(h);
> + if(!ff_h264_decode_seq_parameter_set(h)) {
> + avctx->profile = h->sps.profile_idc;
> + avctx->level = h->sps.level_idc;
> + }
The active profile should be exportet not the one of the last sps
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100128/7ae8b3af/attachment.pgp>
More information about the ffmpeg-devel
mailing list