demux_asf: fix after commit 5165e19

This demuxer reallocated packets on its own, instead of using the
demux.c functions, which clashed with a recent change.
This commit is contained in:
wm4 2013-05-29 14:54:44 +02:00
parent a21cfddaab
commit fa75ae96e1
2 changed files with 4 additions and 7 deletions

View File

@ -742,8 +742,7 @@ void ds_free_packs(demux_stream_t *ds)
} }
if (ds->asf_packet) { if (ds->asf_packet) {
// free unfinished .asf fragments: // free unfinished .asf fragments:
free(ds->asf_packet->buffer); free_demux_packet(ds->asf_packet);
free(ds->asf_packet);
ds->asf_packet = NULL; ds->asf_packet = NULL;
} }
ds->first = ds->last = NULL; ds->first = ds->last = NULL;

View File

@ -100,11 +100,9 @@ static void init_priv (struct asf_priv* asf){
static void demux_asf_append_to_packet(demux_packet_t* dp,unsigned char *data,int len,int offs) static void demux_asf_append_to_packet(demux_packet_t* dp,unsigned char *data,int len,int offs)
{ {
if(dp->len!=offs && offs!=-1) mp_msg(MSGT_DEMUX,MSGL_V,"warning! fragment.len=%d BUT next fragment offset=%d \n",dp->len,offs); if(dp->len!=offs && offs!=-1) mp_msg(MSGT_DEMUX,MSGL_V,"warning! fragment.len=%d BUT next fragment offset=%d \n",dp->len,offs);
dp->buffer=realloc(dp->buffer,dp->len+len+MP_INPUT_BUFFER_PADDING_SIZE); size_t old_len = dp->len;
memcpy(dp->buffer+dp->len,data,len); resize_demux_packet(dp, dp->len + len);
memset(dp->buffer+dp->len+len, 0, MP_INPUT_BUFFER_PADDING_SIZE); memcpy(dp->buffer + old_len, data, len);
mp_dbg(MSGT_DEMUX,MSGL_DBG4,"data appended! %d+%d\n",dp->len,len);
dp->len+=len;
} }
static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,int id,int seq,uint64_t time,unsigned short dur,int offs,int keyframe){ static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,int id,int seq,uint64_t time,unsigned short dur,int offs,int keyframe){