Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mapengfei53 committed Jan 4, 2023
1 parent 24c2a55 commit c4fa4b3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion trunk/src/kernel/srs_kernel_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
XX(ERROR_HTTP_WITH_BODY , 3097, "HttpWithBody", "Failed for HTTP body") \
XX(ERROR_HEVC_DISABLED , 3098, "HevcDisabled", "HEVC is disabled") \
XX(ERROR_HEVC_DECODE_ERROR , 3099, "HevcDecode", "HEVC decode av stream failed") \
XX(ERROR_MP4_HEVC_CHANGE , 3100, "Mp4HevcChange", "MP4 does not support video HEVC change")
XX(ERROR_MP4_HVCC_CHANGE , 3100, "Mp4HvcCChange", "MP4 does not support video HvcC change")
/**************************************************/
/* HTTP/StreamConverter protocol error. */
#define SRS_ERRNO_MAP_HTTP(XX) \
Expand Down
40 changes: 20 additions & 20 deletions trunk/src/kernel/srs_kernel_mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3060,13 +3060,13 @@ void SrsMp4VisualSampleEntry::set_avcC(SrsMp4AvccBox* v)
boxes.push_back(v);
}

SrsMp4HevcBox* SrsMp4VisualSampleEntry::hevC()
SrsMp4HvcCBox* SrsMp4VisualSampleEntry::hvcC()
{
SrsMp4Box* box = get(SrsMp4BoxTypeHVCC);
return dynamic_cast<SrsMp4HevcBox*>(box);
return dynamic_cast<SrsMp4HvcCBox*>(box);
}

void SrsMp4VisualSampleEntry::set_hevC(SrsMp4HevcBox* v)
void SrsMp4VisualSampleEntry::set_hvcC(SrsMp4HvcCBox* v)
{
remove(SrsMp4BoxTypeHVCC);
boxes.push_back(v);
Expand Down Expand Up @@ -3191,36 +3191,36 @@ stringstream& SrsMp4AvccBox::dumps_detail(stringstream& ss, SrsMp4DumpContext dc
return ss;
}

SrsMp4HevcBox::SrsMp4HevcBox()
SrsMp4HvcCBox::SrsMp4HvcCBox()
{
type = SrsMp4BoxTypeHVCC;
}

SrsMp4HevcBox::~SrsMp4HevcBox()
SrsMp4HvcCBox::~SrsMp4HvcCBox()
{
}

int SrsMp4HevcBox::nb_header()
int SrsMp4HvcCBox::nb_header()
{
return SrsMp4Box::nb_header() + (int)hev_config.size();
return SrsMp4Box::nb_header() + (int)hevc_config.size();
}

srs_error_t SrsMp4HevcBox::encode_header(SrsBuffer* buf)
srs_error_t SrsMp4HvcCBox::encode_header(SrsBuffer* buf)
{
srs_error_t err = srs_success;

if ((err = SrsMp4Box::encode_header(buf)) != srs_success) {
return srs_error_wrap(err, "encode header");
}

if (!hev_config.empty()) {
buf->write_bytes(&hev_config[0], (int)hev_config.size());
if (!hevc_config.empty()) {
buf->write_bytes(&hevc_config[0], (int)hevc_config.size());
}

return err;
}

srs_error_t SrsMp4HevcBox::decode_header(SrsBuffer* buf)
srs_error_t SrsMp4HvcCBox::decode_header(SrsBuffer* buf)
{
srs_error_t err = srs_success;

Expand All @@ -3230,20 +3230,20 @@ srs_error_t SrsMp4HevcBox::decode_header(SrsBuffer* buf)

int nb_config = left_space(buf);
if (nb_config) {
hev_config.resize(nb_config);
buf->read_bytes(&hev_config[0], nb_config);
hevc_config.resize(nb_config);
buf->read_bytes(&hevc_config[0], nb_config);
}

return err;
}

stringstream& SrsMp4HevcBox::dumps_detail(stringstream& ss, SrsMp4DumpContext dc)
stringstream& SrsMp4HvcCBox::dumps_detail(stringstream& ss, SrsMp4DumpContext dc)
{
SrsMp4Box::dumps_detail(ss, dc);

ss << ", HEVC Config: " << (int)hev_config.size() << "B" << endl;
ss << ", HEVC Config: " << (int)hevc_config.size() << "B" << endl;
srs_mp4_padding(ss, dc.indent());
srs_mp4_print_bytes(ss, (const char*)&hev_config[0], (int)hev_config.size(), dc.indent());
srs_mp4_print_bytes(ss, (const char*)&hevc_config[0], (int)hevc_config.size(), dc.indent());
return ss;
}

Expand Down Expand Up @@ -5954,10 +5954,10 @@ srs_error_t SrsMp4Encoder::flush()
hev1->height = height;
hev1->data_reference_index = 1;

SrsMp4HevcBox* hevC = new SrsMp4HevcBox();
hev1->set_hevC(hevC);
SrsMp4HvcCBox* hvcC = new SrsMp4HvcCBox();
hev1->set_hvcC(hvcC);

hevC->hev_config = phvcc;
hvcC->hevc_config = phvcc;
} else {
SrsMp4VisualSampleEntry* avc1 = new SrsMp4VisualSampleEntry(SrsMp4BoxTypeAVC1);
stsd->append(avc1);
Expand Down Expand Up @@ -6134,7 +6134,7 @@ srs_error_t SrsMp4Encoder::copy_sequence_header(SrsFormat* format, bool vsh, uin
return err;
}

return srs_error_new(ERROR_MP4_HEVC_CHANGE, "doesn't support hevc change");
return srs_error_new(ERROR_MP4_HVCC_CHANGE, "doesn't support hvcC change");
} else {
if (format->vcodec->id == SrsVideoCodecIdAVC && !pavcc.empty()) {
if (nb_sample == (uint32_t)pavcc.size() && srs_bytes_equals(sample, &pavcc[0], (int)pavcc.size())) {
Expand Down
18 changes: 9 additions & 9 deletions trunk/src/kernel/srs_kernel_mp4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SrsMp4SampleDescriptionBox;
class SrsMp4AvccBox;
class SrsMp4DecoderSpecificInfo;
class SrsMp4VisualSampleEntry;
class SrsMp4HevcBox;
class SrsMp4HvcCBox;
class SrsMp4AudioSampleEntry;
class SrsMp4EsdsBox;
class SrsMp4ChunkOffsetBox;
Expand Down Expand Up @@ -1272,9 +1272,9 @@ class SrsMp4VisualSampleEntry : public SrsMp4SampleEntry
virtual SrsMp4AvccBox* avcC();
virtual void set_avcC(SrsMp4AvccBox* v);
public:
// For hev1, get the hevc box.
virtual SrsMp4HevcBox* hevC();
virtual void set_hevC(SrsMp4HevcBox* v);
// For hev1, get the hvcC box.
virtual SrsMp4HvcCBox* hvcC();
virtual void set_hvcC(SrsMp4HvcCBox* v);
protected:
virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer* buf);
Expand All @@ -1300,15 +1300,15 @@ class SrsMp4AvccBox : public SrsMp4Box
virtual std::stringstream& dumps_detail(std::stringstream& ss, SrsMp4DumpContext dc);
};

// 8.4.1 HEVC Video Stream Definition (hevC)
// 8.4.1 HEVC Video Stream Definition (hvcC)
// ISO-14496-15-AVC-file-format-2017.pdf, page 73
class SrsMp4HevcBox : public SrsMp4Box
class SrsMp4HvcCBox : public SrsMp4Box
{
public:
std::vector<char> hev_config;
std::vector<char> hevc_config;
public:
SrsMp4HevcBox();
virtual ~SrsMp4HevcBox();
SrsMp4HvcCBox();
virtual ~SrsMp4HvcCBox();
protected:
virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer* buf);
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/utest/srs_utest_mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)
SrsBuffer b(buf, sizeof(buf));

if (true) {
SrsMp4HevcBox box;
SrsMp4HvcCBox box;
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
HELPER_EXPECT_SUCCESS(box.encode(&b));

Expand All @@ -1410,7 +1410,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)

if (true) {
b.skip(-1 * b.pos());
SrsMp4HevcBox box;
SrsMp4HvcCBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
}
}
Expand Down

0 comments on commit c4fa4b3

Please sign in to comment.