Skip to content

Commit

Permalink
For #820, fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 26, 2017
1 parent b4b5fb7 commit 362b578
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
30 changes: 14 additions & 16 deletions trunk/src/kernel/srs_kernel_mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int srs_mp4_string_read(SrsBuffer* buf, string& v, int left)
char* start = buf->data() + buf->pos();
size_t len = strnlen(start, left);

if (len == left) {
if ((int)len == left) {
ret = ERROR_MP4_BOX_STRING;
srs_error("MP4 string corrupt, left=%d. ret=%d", left, ret);
return ret;
Expand Down Expand Up @@ -709,7 +709,7 @@ void SrsMp4MovieBox::set_mvex(SrsMp4MovieExtendsBox* v)

SrsMp4TrackBox* SrsMp4MovieBox::video()
{
for (int i = 0; i < boxes.size(); i++) {
for (int i = 0; i < (int)boxes.size(); i++) {
SrsMp4Box* box = boxes.at(i);
if (box->type == SrsMp4BoxTypeTRAK) {
SrsMp4TrackBox* trak = dynamic_cast<SrsMp4TrackBox*>(box);
Expand All @@ -723,7 +723,7 @@ SrsMp4TrackBox* SrsMp4MovieBox::video()

SrsMp4TrackBox* SrsMp4MovieBox::audio()
{
for (int i = 0; i < boxes.size(); i++) {
for (int i = 0; i < (int)boxes.size(); i++) {
SrsMp4Box* box = boxes.at(i);
if (box->type == SrsMp4BoxTypeTRAK) {
SrsMp4TrackBox* trak = dynamic_cast<SrsMp4TrackBox*>(box);
Expand All @@ -744,7 +744,7 @@ int SrsMp4MovieBox::nb_vide_tracks()
{
int nb_tracks = 0;

for (int i = 0; i < boxes.size(); i++) {
for (int i = 0; i < (int)boxes.size(); i++) {
SrsMp4Box* box = boxes.at(i);
if (box->type == SrsMp4BoxTypeTRAK) {
SrsMp4TrackBox* trak = dynamic_cast<SrsMp4TrackBox*>(box);
Expand All @@ -761,7 +761,7 @@ int SrsMp4MovieBox::nb_soun_tracks()
{
int nb_tracks = 0;

for (int i = 0; i < boxes.size(); i++) {
for (int i = 0; i < (int)boxes.size(); i++) {
SrsMp4Box* box = boxes.at(i);
if (box->type == SrsMp4BoxTypeTRAK) {
SrsMp4TrackBox* trak = dynamic_cast<SrsMp4TrackBox*>(box);
Expand Down Expand Up @@ -1319,7 +1319,7 @@ int SrsMp4EditListBox::decode_header(SrsBuffer* buf)
if (entry_count > 0) {
entries = new SrsMp4ElstEntry[entry_count];
}
for (int i = 0; i < entry_count; i++) {
for (int i = 0; i < (int)entry_count; i++) {
SrsMp4ElstEntry& entry = entries[i];

if (version == 1) {
Expand Down Expand Up @@ -1412,7 +1412,7 @@ SrsMp4MediaHeaderBox::~SrsMp4MediaHeaderBox()

char SrsMp4MediaHeaderBox::language0()
{
return (char)((language >> 10) & 0x1f + 0x60);
return (char)(((language >> 10) & 0x1f) + 0x60);
}

void SrsMp4MediaHeaderBox::set_language0(char v)
Expand All @@ -1422,7 +1422,7 @@ void SrsMp4MediaHeaderBox::set_language0(char v)

char SrsMp4MediaHeaderBox::language1()
{
return (char)((language >> 5) & 0x1f + 0x60);
return (char)(((language >> 5) & 0x1f) + 0x60);
}

void SrsMp4MediaHeaderBox::set_language1(char v)
Expand All @@ -1432,7 +1432,7 @@ void SrsMp4MediaHeaderBox::set_language1(char v)

char SrsMp4MediaHeaderBox::language2()
{
return (char)(language & 0x1f + 0x60);
return (char)((language & 0x1f) + 0x60);
}

void SrsMp4MediaHeaderBox::set_language2(char v)
Expand Down Expand Up @@ -3552,7 +3552,6 @@ int SrsMp4SampleManager::load(SrsMp4MovieBox* moov)
int32_t maxp = 0;
int32_t maxn = 0;
if (true) {
uint32_t tbn = 0;
SrsMp4Sample* pvideo = NULL;
map<uint64_t, SrsMp4Sample*>::iterator it;
for (it = tses.begin(); it != tses.end(); ++it) {
Expand All @@ -3562,7 +3561,6 @@ int SrsMp4SampleManager::load(SrsMp4MovieBox* moov)
if (sample->type == SrsFrameTypeVideo) {
pvideo = sample;
} else if (pvideo) {
tbn = sample->tbn;
int32_t diff = sample->dts_ms() - pvideo->dts_ms();
if (diff > 0) {
maxp = srs_max(maxp, diff);
Expand Down Expand Up @@ -3775,23 +3773,23 @@ int SrsMp4SampleManager::write_track(SrsFrameType track,
stsz->sample_size = 0;
stsz->sample_count = (uint32_t)stsz_entries.size();
stsz->entry_sizes = new uint32_t[stsz->sample_count];
for (int i = 0; i < stsz->sample_count; i++) {
for (int i = 0; i < (int)stsz->sample_count; i++) {
stsz->entry_sizes[i] = stsz_entries.at(i);
}
}

if (stco && !stco_entries.empty()) {
stco->entry_count = (uint32_t)stco_entries.size();
stco->entries = new uint32_t[stco->entry_count];
for (int i = 0; i < stco->entry_count; i++) {
for (int i = 0; i < (int)stco->entry_count; i++) {
stco->entries[i] = stco_entries.at(i);
}
}

if (stss && !stss_entries.empty()) {
stss->entry_count = (uint32_t)stss_entries.size();
stss->sample_numbers = new uint32_t[stss->entry_count];
for (int i = 0; i < stss->entry_count; i++) {
for (int i = 0; i < (int)stss->entry_count; i++) {
stss->sample_numbers[i] = stss_entries.at(i);
}
}
Expand Down Expand Up @@ -4097,7 +4095,7 @@ int SrsMp4Decoder::parse_ftyp(SrsMp4FileTypeBox* ftyp)
SrsMp4BoxBrandISOM, SrsMp4BoxBrandISO2, SrsMp4BoxBrandAVC1, SrsMp4BoxBrandMP41,
SrsMp4BoxBrandISO5
};
for (int i = 0; i < sizeof(legal_brands)/sizeof(SrsMp4BoxBrand); i++) {
for (int i = 0; i < (int)sizeof(legal_brands)/sizeof(SrsMp4BoxBrand); i++) {
if (ftyp->major_brand == legal_brands[i]) {
legal_brand = true;
break;
Expand Down Expand Up @@ -4239,7 +4237,7 @@ int SrsMp4Decoder::do_load_next_box(SrsMp4Box** ppbox, uint32_t required_box_typ
SrsMp4Box* box = NULL;
while (true) {
uint64_t required = box? box->sz():4;
while (stream->length() < required) {
while (stream->length() < (int)required) {
ssize_t nread;
if ((ret = rsio->read(buf, SRS_MP4_BUF_SIZE, &nread)) != ERROR_SUCCESS) {
srs_error("MP4 load failed, nread=%d, required=%d. ret=%d", nread, required, ret);
Expand Down
8 changes: 4 additions & 4 deletions trunk/src/kernel/srs_kernel_mp4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,10 +1704,10 @@ class SrsMp4Encoder
SrsAudioChannels channels;
private:
// For AAC, the asc in esds box.
int nb_asc;
uint32_t nb_asc;
uint8_t* pasc;
// The number of audio samples.
int nb_audios;
uint32_t nb_audios;
// The duration of audio stream.
uint64_t aduration;
public:
Expand All @@ -1716,10 +1716,10 @@ class SrsMp4Encoder
SrsVideoCodecId vcodec;
private:
// For H.264/AVC, the avcc contains the sps/pps.
int nb_avcc;
uint32_t nb_avcc;
uint8_t* pavcc;
// The number of video samples.
int nb_videos;
uint32_t nb_videos;
// The duration of video stream.
uint64_t vduration;
// The size width/height of video.
Expand Down
1 change: 1 addition & 0 deletions trunk/src/service/srs_service_utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <srs_core.hpp>

#include <arpa/inet.h>
#include <string>
#include <vector>

Expand Down

0 comments on commit 362b578

Please sign in to comment.