[MPlayer-cvslog] r37606 - in branches/1.2: . libmpcodecs/ad_spdif.c
rtogni
subversion at mplayerhq.hu
Sun Jan 24 19:32:43 CET 2016
Author: rtogni
Date: Sun Jan 24 19:32:43 2016
New Revision: 37606
Log:
Merge r37605 from trunk
Fix segfault with spdif
Modified:
branches/1.2/ (props changed)
branches/1.2/libmpcodecs/ad_spdif.c
Modified: branches/1.2/libmpcodecs/ad_spdif.c
==============================================================================
--- branches/1.2/libmpcodecs/ad_spdif.c Sun Jan 24 19:30:16 2016 (r37605)
+++ branches/1.2/libmpcodecs/ad_spdif.c Sun Jan 24 19:32:43 2016 (r37606)
@@ -45,6 +45,7 @@ struct spdifContext {
int out_buffer_size;
uint8_t *out_buffer;
uint8_t pb_buffer[OUTBUF_SIZE];
+ int header_written;
};
static int read_packet(void *p, uint8_t *buf, int buf_size)
@@ -78,7 +79,7 @@ static int preinit(sh_audio_t *sh)
static int init(sh_audio_t *sh)
{
- int i, x, in_size, srate, bps, *dtshd_rate;
+ int i, x, in_size, srate, bps, *dtshd_rate, res;
unsigned char *start;
double pts;
static const struct {
@@ -129,11 +130,13 @@ static int init(sh_audio_t *sh)
break;
}
}
- if (AVERROR_PATCHWELCOME == lavf_ctx->oformat->write_header(lavf_ctx)) {
- mp_msg(MSGT_DECAUDIO,MSGL_INFO,
+ if ((res = avformat_write_header(lavf_ctx, NULL)) < 0) {
+ if (res == AVERROR_PATCHWELCOME)
+ mp_msg(MSGT_DECAUDIO,MSGL_INFO,
"This codec is not supported by spdifenc.\n");
goto fail;
}
+ spdif_ctx->header_written = 1;
// get sample_rate & bitrate from parser
x = ds_get_packet_pts(sh->ds, &start, &pts);
@@ -292,8 +295,8 @@ static void uninit(sh_audio_t *sh)
AVFormatContext *lavf_ctx = spdif_ctx->lavf_ctx;
if (lavf_ctx) {
- if (lavf_ctx->oformat)
- lavf_ctx->oformat->write_trailer(lavf_ctx);
+ if (spdif_ctx->header_written)
+ av_write_trailer(lavf_ctx);
av_freep(&lavf_ctx->pb);
if (lavf_ctx->streams) {
av_freep(&lavf_ctx->streams[0]->codec);
More information about the MPlayer-cvslog
mailing list