[MPlayer-cvslog] r29493 - in trunk/libmpdemux: demux_rtp.cpp demux_rtp_codec.cpp

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Aug 11 20:36:24 CEST 2009


On Tue, Aug 11, 2009 at 08:28:27PM +0200, cehoyos wrote:
> Modified: trunk/libmpdemux/demux_rtp.cpp
> ==============================================================================
> --- trunk/libmpdemux/demux_rtp.cpp	Tue Aug 11 20:21:31 2009	(r29492)
> +++ trunk/libmpdemux/demux_rtp.cpp	Tue Aug 11 20:28:26 2009	(r29493)
> @@ -117,6 +117,7 @@ int rtsp_transport_tcp = 0;
>  #endif
>  
>  extern int rtsp_port;
> +extern void *avcctx;
>  
>  extern "C" int audio_id, video_id, dvdsub_id;
>  extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
> @@ -388,6 +389,9 @@ extern "C" void demux_close_rtp(demuxer_
>    delete rtpState->videoBufferQueue;
>    delete rtpState->sdpDescription;
>    delete rtpState;
> +#ifdef CONFIG_LIBAVCODEC
> +  av_free(avcctx);
> +#endif
>  
>    env->reclaim(); delete scheduler;
>  }
> @@ -561,7 +565,7 @@ static demux_packet_t* getBuffer(demuxer
>      }
>      if (headersize == 3 && h264parserctx) { // h264
>        consumed = h264parserctx->parser->parser_parse(h264parserctx,
> -                               NULL,
> +                               (AVCodecContext *)avcctx,
>                                 &poutbuf, &poutbuf_size,
>                                 dp->buffer, dp->len);

The cast is useless anyway, though avcctx should be AVCodecContext *
anyway.

> Modified: trunk/libmpdemux/demux_rtp_codec.cpp
> ==============================================================================
> --- trunk/libmpdemux/demux_rtp_codec.cpp	Tue Aug 11 20:21:31 2009	(r29492)
> +++ trunk/libmpdemux/demux_rtp_codec.cpp	Tue Aug 11 20:28:26 2009	(r29493)
> @@ -30,6 +30,7 @@ extern "C" {
>  #ifdef CONFIG_LIBAVCODEC
>  AVCodecParserContext * h264parserctx;
>  #endif
> +void *avcctx;
>  
>  // Copied from vlc
>  static unsigned char* parseH264ConfigStr( char const* configStr,
> @@ -137,6 +138,7 @@ void rtpCodecInitialize_video(demuxer_t*
>  #ifdef CONFIG_LIBAVCODEC
>      avcodec_register_all();
>      h264parserctx = av_parser_init(CODEC_ID_H264);
> +    avcctx = avcodec_alloc_context();
>  #endif

Why are you doing this in such a chaotic way?
Why is the avcctx declaration not under CONFIG_LIBAVCODEC together with
the h264parserctx?
The same for the extern declaration.
Why is it (after that change) not of type AVCodecContext *?
Also while it (currently?) does not matter, first allocating a context
and then a parser seems a far more logical order - either way
match the order of the declarations and the initializations (they
currently are I think, just remember it if you change things).


More information about the MPlayer-cvslog mailing list