Revision e4a26958 libavcodec/h264_mp4toannexb_bsf.c
libavcodec/h264_mp4toannexb_bsf.c | ||
---|---|---|
75 | 75 |
if (!ctx->extradata_parsed) { |
76 | 76 |
uint16_t unit_size; |
77 | 77 |
uint64_t total_size = 0; |
78 |
uint8_t *out = NULL, unit_nb, sps_done = 0; |
|
78 |
uint8_t *out = NULL, unit_nb, sps_done = 0, sps_seen = 0, pps_seen = 0;
|
|
79 | 79 |
const uint8_t *extradata = avctx->extradata+4; |
80 | 80 |
static const uint8_t nalu_header[4] = {0, 0, 0, 1}; |
81 | 81 |
|
... | ... | |
89 | 89 |
if (!unit_nb) { |
90 | 90 |
unit_nb = *extradata++; /* number of pps unit(s) */ |
91 | 91 |
sps_done++; |
92 |
|
|
93 |
if (unit_nb) |
|
94 |
pps_seen = 1; |
|
95 |
} |
|
96 |
else |
|
97 |
{ |
|
98 |
sps_seen = 1; |
|
92 | 99 |
} |
100 |
|
|
93 | 101 |
while (unit_nb--) { |
94 | 102 |
void *tmp; |
95 | 103 |
|
... | ... | |
114 | 122 |
unit_nb = *extradata++; /* number of pps unit(s) */ |
115 | 123 |
} |
116 | 124 |
|
117 |
memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); |
|
125 |
if(out) |
|
126 |
memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); |
|
127 |
|
|
128 |
if (!sps_seen) |
|
129 |
av_log(avctx, AV_LOG_WARNING, "Warning: SPS NALU missing or invalid. The resulting stream may not play.\n"); |
|
130 |
if (!pps_seen) |
|
131 |
av_log(avctx, AV_LOG_WARNING, "Warning: PPS NALU missing or invalid. The resulting stream may not play.\n"); |
|
132 |
|
|
118 | 133 |
av_free(avctx->extradata); |
119 | 134 |
avctx->extradata = out; |
120 | 135 |
avctx->extradata_size = total_size; |
Also available in: Unified diff