1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00

free demux/ds/sh

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1644 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-08-22 23:54:57 +00:00
parent 48fdd5dd82
commit 62e247ede6
2 changed files with 36 additions and 2 deletions

View File

@ -21,6 +21,11 @@
#include "codec-cfg.h"
#include "stheader.h"
void free_demuxer_stream(demux_stream_t *ds){
ds_free_packs(ds);
free(ds);
}
demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id){
demux_stream_t* ds=malloc(sizeof(demux_stream_t));
ds->buffer_pos=ds->buffer_size=0;
@ -74,6 +79,13 @@ sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
return demuxer->a_streams[id];
}
void free_sh_audio(sh_audio_t* sh){
if(sh->a_in_buffer) free(sh->a_in_buffer);
if(sh->a_buffer) free(sh->a_buffer);
if(sh->wf) free(sh->wf);
free(sh);
}
sh_video_t* new_sh_video(demuxer_t *demuxer,int id){
if(demuxer->v_streams[id]){
mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id);
@ -85,6 +97,27 @@ sh_video_t* new_sh_video(demuxer_t *demuxer,int id){
return demuxer->v_streams[id];
}
void free_sh_video(sh_video_t* sh){
// if(sh->our_out_buffer) free(sh->our_out_buffer);
// if(sh->bih) free(sh->bih);
free(sh);
}
void free_demuxer(demuxer_t *demuxer){
int i;
// free streams:
for(i=0;i<256;i++){
if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]);
if(demuxer->v_streams[i]) free_sh_video(demuxer->v_streams[i]);
}
//if(sh_audio) free_sh_audio(sh_audio);
//if(sh_video) free_sh_video(sh_video);
// free demuxers:
free_demuxer_stream(demuxer->audio);
free_demuxer_stream(demuxer->video);
free(demuxer);
}
void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp){
// demux_packet_t* dp=new_demux_packet(len);
@ -481,8 +514,6 @@ switch(file_format){
return demuxer;
}
int demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags);
int demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags);
int demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags);

View File

@ -94,6 +94,8 @@ inline static void free_demux_packet(demux_packet_t* dp){
demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id);
demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id);
void free_demuxer_stream(demux_stream_t *ds);
void free_demuxer(demuxer_t *demuxer);
void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp);
void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags);
@ -150,3 +152,4 @@ demuxer_t* demux_open(stream_t *stream,int file_format,int aid,int vid,int sid);
int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);