Commit 9cd11550 authored by lucabe's avatar lucabe

If the video stream is H.264 with MP4 syntax, store the NAL lenght size in

the RTP muxer context (it will be used later for splitting frames in NALs)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23625 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 60e5cc31
...@@ -131,6 +131,13 @@ static int rtp_write_header(AVFormatContext *s1) ...@@ -131,6 +131,13 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_payload_size = n * TS_PACKET_SIZE; s->max_payload_size = n * TS_PACKET_SIZE;
s->buf_ptr = s->buf; s->buf_ptr = s->buf;
break; break;
case CODEC_ID_H264:
/* check for H.264 MP4 syntax */
if (st->codec->extradata_size > 0 && st->codec->extradata &&
st->codec->extradata[0] == 1) {
s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
}
break;
case CODEC_ID_AMR_NB: case CODEC_ID_AMR_NB:
case CODEC_ID_AMR_WB: case CODEC_ID_AMR_WB:
if (!s->max_frames_per_packet) if (!s->max_frames_per_packet)
......
...@@ -50,6 +50,12 @@ struct RTPMuxContext { ...@@ -50,6 +50,12 @@ struct RTPMuxContext {
uint8_t *buf_ptr; uint8_t *buf_ptr;
int max_frames_per_packet; int max_frames_per_packet;
/**
* Number of bytes used for H.264 NAL length, if the MP4 syntax is used
* (1, 2 or 4)
*/
int nal_length_size;
}; };
typedef struct RTPMuxContext RTPMuxContext; typedef struct RTPMuxContext RTPMuxContext;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment