[vlc-commits] commit: pes.c: make sure H264 stream has aud (Ilkka Ollakka )
git at videolan.org
git at videolan.org
Fri Jul 9 15:28:07 CEST 2010
vlc/vlc-1.1 | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Jul 7 15:52:32 2010 +0300| [97a42c15e8480762f8e6819ffbd43b600a12ce8e] | committer: Ilkka Ollakka
pes.c: make sure H264 stream has aud
TS-stream needs aud-nals, but didn't find any confirmation yet if ps needs those too,
so I assume it does. Maybe it would be better just to check first nal and set boolean for
adding aud.
(cherry picked from commit d5cec4585d66dd4c67c496ed29a163436774b793)
Signed-off-by: Ilkka Ollakka <ileoo at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=97a42c15e8480762f8e6819ffbd43b600a12ce8e
---
modules/mux/mpeg/pes.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/modules/mux/mpeg/pes.c b/modules/mux/mpeg/pes.c
index 79f4300..223dd71 100644
--- a/modules/mux/mpeg/pes.c
+++ b/modules/mux/mpeg/pes.c
@@ -353,6 +353,33 @@ int EStoPES ( sout_instance_t *p_sout, block_t **pp_pes, block_t *p_es,
memcpy( p_es->p_buffer, p_fmt->p_extra, p_fmt->i_extra );
}
+ if( p_fmt->i_codec == VLC_CODEC_H264 )
+ {
+ int offset=2;
+ while(offset < p_es->i_buffer )
+ {
+ if( p_es->p_buffer[offset-2] == 0 &&
+ p_es->p_buffer[offset-1] == 0 &&
+ p_es->p_buffer[offset] == 1 )
+ break;
+ offset++;
+ }
+ offset++;
+ if( offset <= p_es->i_buffer-4 &&
+ ((p_es->p_buffer[offset] & 0x1f) != 9) ) /* Not AUD */
+ {
+ /* Make similar AUD as libavformat does */
+ p_es = block_Realloc( p_es, 6, p_es->i_buffer );
+ p_es->p_buffer[0] = 0x00;
+ p_es->p_buffer[1] = 0x00;
+ p_es->p_buffer[2] = 0x00;
+ p_es->p_buffer[3] = 0x01;
+ p_es->p_buffer[4] = 0x09;
+ p_es->p_buffer[5] = 0xe0;
+ }
+
+ }
+
i_pts = p_es->i_pts <= 0 ? 0 : p_es->i_pts * 9 / 100; // 90000 units clock
i_dts = p_es->i_dts <= 0 ? 0 : p_es->i_dts * 9 / 100; // 90000 units clock
More information about the vlc-commits
mailing list