1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-12 01:46:16 +00:00

demuxer fixed

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2814 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-11-11 02:04:41 +00:00
parent 17f7dae687
commit 7906e70c05

View File

@ -43,85 +43,40 @@ int tv_param_input = 0; /* used in v4l and bttv */
int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh) int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh)
{ {
int seq = tvh->seq++; int seq = tvh->seq++;
demux_stream_t *ds_video = NULL; demux_packet_t* dp;
demux_packet_t *dp_video = NULL; int len;
demux_stream_t *ds_audio = NULL;
demux_packet_t *dp_audio = NULL;
int len_video, len_audio;
printf("demux_tv_fill_buffer(sequence:%d) called!\n", seq); printf("demux_tv_fill_buffer(sequence:%d) called!\n", seq);
demux->filepos = -1; // demux->filepos = -1;
// seq++; // seq++;
// tvh->seq++; // tvh->seq++;
/* ================== ADD VIDEO PACKET =================== */ /* ================== ADD VIDEO PACKET =================== */
len_video = tvh->functions->get_video_framesize(tvh->priv); len = tvh->functions->get_video_framesize(tvh->priv);
ds_video = demux->video;
if (!ds_video->asf_packet) dp=new_demux_packet(len);
{ tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
/* create new packet */ dp->pts=seq/25.0; //(float)pts/90000.0f;
dp_video = new_demux_packet(len_video); //dp->pos=pos;
// printf("new dp_video->buffer: %p (%d bytes)\n", dp_video, len_video); //dp->flags=flags;
tvh->functions->grab_video_frame(tvh->priv, dp_video->buffer, len_video); // append packet to DS stream:
dp_video->pos = demux->filepos; ds_add_packet(demux->video,dp);
ds_video->asf_packet = dp_video;
ds_video->asf_seq = seq;
}
else if (ds_video->asf_packet)
{
if (ds_video->asf_seq != seq)
{
/* close segment, finalize packet */
ds_add_packet(ds_video, ds_video->asf_packet);
ds_video->asf_packet = NULL;
}
else
{
/* append data to segment */
dp_video = ds_video->asf_packet;
dp_video->buffer = realloc(dp_video->buffer, dp_video->len+len_video);
// printf("dp_video->buffer: %p (%d bytes)\n", dp_video, dp_video->len+len_video);
tvh->functions->grab_video_frame(tvh->priv, dp_video->buffer+dp_video->len, len_video);
mp_dbg(MSGT_DEMUX,MSGL_DBG4, "video data appended %d+%d\n", dp_video->len, len_video);
dp_video->len += len_video;
}
}
/* ================== ADD AUDIO PACKET =================== */ /* ================== ADD AUDIO PACKET =================== */
if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) != TVI_CONTROL_TRUE) if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) != TVI_CONTROL_TRUE)
return 1; /* no audio, only video */ return 1; /* no audio, only video */
len_audio = tvh->functions->get_audio_framesize(tvh->priv); len = tvh->functions->get_audio_framesize(tvh->priv);
ds_audio = demux->audio;
dp=new_demux_packet(len);
if (!ds_audio->asf_packet) tvh->functions->grab_audio_frame(tvh->priv, dp->buffer, len);
{ //dp->pts=pts; //(float)pts/90000.0f;
dp_audio = new_demux_packet(len_audio); //dp->pos=pos;
tvh->functions->grab_audio_frame(tvh->priv, dp_audio->buffer, len_audio); //dp->flags=flags;
dp_audio->pos = demux->filepos; // append packet to DS stream:
ds_audio->asf_packet = dp_audio; ds_add_packet(demux->audio,dp);
ds_audio->asf_seq = seq;
}
else if (ds_audio->asf_packet)
{
if (ds_audio->asf_seq != seq)
{
ds_add_packet(ds_audio, ds_audio->asf_packet);
ds_audio->asf_packet = NULL;
}
else
{
dp_audio = ds_audio->asf_packet;
dp_audio->buffer = realloc(dp_audio->buffer, dp_audio->len+len_audio);
tvh->functions->grab_audio_frame(tvh->priv, dp_audio->buffer+dp_audio->len, len_audio);
mp_dbg(MSGT_DEMUX,MSGL_DBG4, "audio data appended %d+%d\n", dp_audio->len, len_audio);
dp_audio->len += len_audio;
}
}
return 1; return 1;
} }
@ -141,7 +96,7 @@ int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
sh_video = new_sh_video(demuxer, 0); sh_video = new_sh_video(demuxer, 0);
/* hack to use YUV 4:2:0 format ;) */ /* hack to use YUV 4:2:0 format ;) */
sh_video->format = IMGFMT_YV12; sh_video->format = IMGFMT_UYVY;
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &sh_video->format); funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &sh_video->format);
/* get IMGFMT_ */ /* get IMGFMT_ */