[FFmpeg-soc] Extend TSMuxer to H264 muxing
Michael Niedermayer
michaelni at gmx.at
Tue Apr 15 15:51:50 CEST 2008
On Tue, Apr 15, 2008 at 09:33:34PM +0800, zhentan feng wrote:
> Hi
>
> 2008/4/14, Baptiste Coudurier <baptiste.coudurier at smartjog.com>:
> >
> > On Mon, Apr 14, 2008 at 02:40:54PM +0800, zhentan feng wrote:
> > > [...]
> > >
> > > > > + if(st->codec->codec_id == CODEC_ID_H264){
> >
> > > > > + H264Context * h_st = st->codec->priv_data;
> > > >
> > > > This is invalid, there is a reason why its called priv_data, and that
> > is
> > > > that it is private to the codec.
> > >
> > > I think it is the key point to write descriptors into PMT for AVC
> > stream.
> > > Can't I get the h264 codec information when init TS out stream?
> > > Do you mean the *priv_data* only could be used by libavcodec functions,
> > we
> > > can't read some information from it by other extern functions?
> > > If so, I am a little confused how could I get information when init the
> > > descriptor?
> > >
> >
> >
> > No you cannot, only libavcodec h264 decoder is allowed to use priv_data,
> > TS muxer has to parse PPS/PPS and gather needed infos.
>
>
> Here is the new patch names "h264_desc_aud_patch4-15.diff" attached below.
>
> 1,Add a new struct MpegTSH264Desc in MpegTSWriteStream to collect
> information of AVC stream descriptors.
> 2,Parser the SPS and VUI to write descriptor into PMT.
> 3,Check the AUD nal units. if pkt don't have ,then insert AUD nal units into
> the AVPacket data.
>
> Thanks for your any advice and best wishes.
[...]
> +void pre_decode_vui(MpegTSH264Desc * h_dsc, GetBitContext *gb)
> +{
> + int aspect_ratio_info_present_flag;
> + unsigned int aspect_ratio_idc;
> + int nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag;
> + aspect_ratio_info_present_flag= get_bits1(gb);
>
> + if(aspect_ratio_info_present_flag){
> + aspect_ratio_idc= get_bits(gb, 8);
> + if(aspect_ratio_idc == EXTENDED_SAR){
> + get_bits(gb, 16);
> + get_bits(gb, 16);
> + }else if(sizeof(pixel_aspect)/sizeof(*pixel_aspect) <= aspect_ratio_idc){
> + return -1;
> + }
> + }
> +
> + if(get_bits1(gb)){ /* overscan_info_present_flag */
> + get_bits1(gb); /* overscan_appropriate_flag */
> + }
> +
> + if(get_bits1(gb)){ /* video_signal_type_present_flag */
> + get_bits(gb, 3); /* video_format */
> + get_bits1(gb); /* video_full_range_flag */
> + if(get_bits1(gb)){ /* colour_description_present_flag */
> + get_bits(gb, 8); /* colour_primaries */
> + get_bits(gb, 8); /* transfer_characteristics */
> + get_bits(gb, 8); /* matrix_coefficients */
> + }
> + }
duplicate of decode_vui_parameters()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080415/65649639/attachment.pgp>
More information about the FFmpeg-soc
mailing list