[MPlayer-dev-eng] [PATCH]SPDIF pass through decoder

Diego Biurrun diego at biurrun.de
Mon Aug 15 17:55:25 CEST 2011


On Sun, Aug 14, 2011 at 01:37:14AM +0900, Naoya OYAMA wrote:
> 
> 2011/8/12, Diego Biurrun <diego at biurrun.de>:
> > On Thu, Aug 11, 2011 at 11:38:42PM +0900, Naoya OYAMA wrote:
> >> I write SPDIF pass through decoder in MPlayer.
> >> This decoder use ffmpeg/libavformat/spdifenc.c .
> >
> > .. cursory first round of review ..
> >
> >> --- /dev/null
> >> +++ b/libmpcodecs/ad_spdif.c
> >> @@ -0,0 +1,311 @@
> >> +static int spdif_read_packet(void *p, uint8_t *buf, int buf_size);
> >> +static int spdif_write_packet(void *p, uint8_t *buf, int buf_size);
> >> +static int64_t spdif_seek(void *p, int64_t offset, int whence);
> >
> > Reorder your functions to avoid forward declarations.
> I am sorry, I do not understand this sentence...
> Is it good in this?

No, you did not change anything related to this.  Move these three functions
in the .c file so that you do not need forward declarations.

> --- /dev/null
> +++ b/libmpcodecs/ad_spdif.c
> @@ -0,0 +1,299 @@
> +
> +#include <string.h>
> +#include "config.h"
> +#include "mp_msg.h"
> +#include "ad_internal.h"
> +#include "libavformat/avformat.h"
> +#include "libavcodec/avcodec.h"

nit: empty line between system and local headers please

> +    pb = avio_alloc_context(spdif_ctx->pb_buffer, OUTBUF_SIZE, 1, spdif_ctx,
> +            read_packet, write_packet, seek);

Indent like this:

   pb = avio_alloc_context(spdif_ctx->pb_buffer, OUTBUF_SIZE, 1, spdif_ctx,
                           read_packet, write_packet, seek);

> +    if (AVERROR_PATCHWELCOME == lavf_ctx->oformat->write_header(lavf_ctx)) {
> +        mp_msg(MSGT_DECAUDIO,MSGL_INFO,
> +        "This codec is not supported by spdifenc.\n");

same

> +    } else {
> +        if (sh->avctx->sample_rate < 24000) {
> +            mp_msg(MSGT_DECAUDIO,MSGL_INFO,
> +            "This stream sample_rate[%d Hz] may be broken. "
> +            "Force reset 48000Hz.\n",
> +            sh->avctx->sample_rate);

ditto

> +static int decode_audio(sh_audio_t *sh, unsigned char *buf,
> +        int minlen, int maxlen)

again

more below

Maybe wait for more review before updating your patch.

Diego


More information about the MPlayer-dev-eng mailing list