📄 mpga_prepacketize.diff
字号:
Index: modules/demux/mpeg/mpga.c
===================================================================
--- modules/demux/mpeg/mpga.c (revision 9350)
+++ modules/demux/mpeg/mpga.c (working copy)
@@ -113,6 +113,7 @@
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
vlc_bool_t b_forced = VLC_FALSE;
+ block_t *p_block_in, *p_block_out;
uint32_t header;
uint8_t *p_peek;
@@ -264,6 +265,39 @@
}
}
+ /* Call packetizer once and then fully init the demuxer. */
+ if( ( p_block_in = stream_Block( p_demux->s, MPGA_PACKET_SIZE ) ) != NULL )
+ {
+ p_block_in->i_pts = p_block_in->i_dts = p_sys->b_start ? 1 : 0;
+ p_sys->b_start = VLC_FALSE;
+
+ while( (p_block_out = p_sys->p_packetizer->pf_packetize(
+ p_sys->p_packetizer, &p_block_in )) )
+ {
+ while( p_block_out )
+ {
+ block_t *p_next = p_block_out->p_next;
+ p_sys->i_pts = p_block_out->i_pts;
+ block_Release( p_block_out );
+ p_block_out = p_next;
+ }
+ }
+
+ p_sys->p_packetizer->fmt_out.b_packetized = VLC_TRUE;
+ p_sys->p_es = es_out_Add( p_demux->out,
+ &p_sys->p_packetizer->fmt_out);
+
+ p_sys->i_bitrate_avg = p_sys->p_packetizer->fmt_out.i_bitrate;
+
+ if( p_sys->i_xing_bytes && p_sys->i_xing_frames &&
+ p_sys->i_xing_frame_samples )
+ {
+ p_sys->i_bitrate_avg = p_sys->i_xing_bytes * I64C(8) *
+ p_sys->p_packetizer->fmt_out.audio.i_rate /
+ p_sys->i_xing_frames / p_sys->i_xing_frame_samples;
+ }
+ }
+
return VLC_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -