Commit 6f7e4d56 authored by Francois Cartegnie's avatar Francois Cartegnie

mux: mp4: use nal defined values

parent a0f65bae
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*****************************************************************************/ *****************************************************************************/
#include "libmp4mux.h" #include "libmp4mux.h"
#include "../demux/mp4/libmp4.h" /* flags */ #include "../demux/mp4/libmp4.h" /* flags */
#include "../packetizer/hevc_nal.h"
#include "../packetizer/h264_nal.h" /* h264_get_spspps */ #include "../packetizer/h264_nal.h" /* h264_get_spspps */
#include "../packetizer/hxxx_nal.h" #include "../packetizer/hxxx_nal.h"
...@@ -610,9 +611,9 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -610,9 +611,9 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
if (p_nal) if (p_nal)
p_nal->i_buffer = p_buffer - p_nal->p_buffer - ((i_buffer)?3:0); p_nal->i_buffer = p_buffer - p_nal->p_buffer - ((i_buffer)?3:0);
switch (*p_buffer & 0x72) { switch ((*p_buffer & 0x7E) >> 1) {
/* VPS */
case 0x40: case HEVC_NAL_VPS:
p_nal = &p_vps[i_vps++]; p_nal = &p_vps[i_vps++];
p_nal->p_buffer = p_buffer; p_nal->p_buffer = p_buffer;
/* Only keep the general profile from the first VPS /* Only keep the general profile from the first VPS
...@@ -623,8 +624,8 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -623,8 +624,8 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
i_num_arrays++; i_num_arrays++;
} }
break; break;
/* SPS */
case 0x42: { case HEVC_NAL_SPS: {
struct nal * p_tmp = realloc(p_sps, sizeof(struct nal) * (i_sps + 1)); struct nal * p_tmp = realloc(p_sps, sizeof(struct nal) * (i_sps + 1));
if (!p_tmp) if (!p_tmp)
break; break;
...@@ -639,8 +640,8 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -639,8 +640,8 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
} }
break; break;
} }
/* PPS */
case 0x44: { case HEVC_NAL_PPS: {
struct nal * p_tmp = realloc(p_pps, sizeof(struct nal) * (i_pps + 1)); struct nal * p_tmp = realloc(p_pps, sizeof(struct nal) * (i_pps + 1));
if (!p_tmp) if (!p_tmp)
break; break;
...@@ -651,9 +652,9 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -651,9 +652,9 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
i_num_arrays++; i_num_arrays++;
break; break;
} }
/* SEI */
case 0x4E: case HEVC_NAL_PREF_SEI:
case 0x50: { case HEVC_NAL_SUFF_SEI: {
struct nal * p_tmp = realloc(p_sei, sizeof(struct nal) * (i_sei + 1)); struct nal * p_tmp = realloc(p_sei, sizeof(struct nal) * (i_sei + 1));
if (!p_tmp) if (!p_tmp)
break; break;
...@@ -689,7 +690,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -689,7 +690,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
if (i_vps) if (i_vps)
{ {
/* Write VPS without forcing array_completeness */ /* Write VPS without forcing array_completeness */
bo_add_8(hvcC, 32); bo_add_8(hvcC, HEVC_NAL_VPS);
bo_add_16be(hvcC, i_vps); bo_add_16be(hvcC, i_vps);
for (size_t i = 0; i < i_vps; i++) { for (size_t i = 0; i < i_vps; i++) {
p_nal = &p_vps[i]; p_nal = &p_vps[i];
...@@ -700,7 +701,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -700,7 +701,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
if (i_sps) { if (i_sps) {
/* Write SPS without forcing array_completeness */ /* Write SPS without forcing array_completeness */
bo_add_8(hvcC, 33); bo_add_8(hvcC, HEVC_NAL_SPS);
bo_add_16be(hvcC, i_sps); bo_add_16be(hvcC, i_sps);
for (size_t i = 0; i < i_sps; i++) { for (size_t i = 0; i < i_sps; i++) {
p_nal = &p_sps[i]; p_nal = &p_sps[i];
...@@ -711,7 +712,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -711,7 +712,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
if (i_pps) { if (i_pps) {
/* Write PPS without forcing array_completeness */ /* Write PPS without forcing array_completeness */
bo_add_8(hvcC, 34); bo_add_8(hvcC, HEVC_NAL_PPS);
bo_add_16be(hvcC, i_pps); bo_add_16be(hvcC, i_pps);
for (size_t i = 0; i < i_pps; i++) { for (size_t i = 0; i < i_pps; i++) {
p_nal = &p_pps[i]; p_nal = &p_pps[i];
...@@ -722,7 +723,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt) ...@@ -722,7 +723,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
if (i_sei) { if (i_sei) {
/* Write SEI without forcing array_completeness */ /* Write SEI without forcing array_completeness */
bo_add_8(hvcC, 39); bo_add_8(hvcC, HEVC_NAL_PREF_SEI);
bo_add_16be(hvcC, i_sei); bo_add_16be(hvcC, i_sei);
for (size_t i = 0; i < i_sei; i++) { for (size_t i = 0; i < i_sei; i++) {
p_nal = &p_sei[i]; p_nal = &p_sei[i];
......
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