Commit 8f850d6e authored by James Zern's avatar James Zern Committed by Gerrit Code Review

Merge changes I67b2b0d7,I24c024d1,I3703d739,Ia6f669a9

* changes:
  nestegg: packet_track: fix uint64->uint32 warning
  nestegg: fix track_scale double->uint64 warning
  nestegg: fix track_number uint64->uint32 warnings
  nestegg: add ne_get_uint32 convenience function
parents 0873dc3a 086dc809
......@@ -14,3 +14,7 @@ Local Modifications:
- 0002-ne_read_simple-uninitialized_variable.diff
fixes:
nestegg.c|975 col 6| warning: ‘r’ may be used uninitialized in this function [-Wuninitialized]
- add ne_get_uint32 convenience function
- fix track_number uint64->uint32 warnings
- fix track_scale double->uint64 warning
- nestegg_packet_track: fix uint64->uint32 warning
......@@ -729,6 +729,20 @@ ne_get_uint(struct ebml_type type, uint64_t * value)
return 0;
}
static int
ne_get_uint32(struct ebml_type type, unsigned int * value)
{
uint64_t v;
if (ne_get_uint(type, &v))
return -1;
assert((unsigned int)v == v);
*value = (unsigned int)v;
return 0;
}
static int
ne_get_float(struct ebml_type type, double * value)
{
......@@ -1232,7 +1246,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
struct cluster * cluster;
struct frame * f, * last;
struct track_entry * entry;
double track_scale;
const int track_scale = 1;
uint64_t track_number, length, frame_sizes[256], cluster_tc, flags, frames, tc_scale, total;
unsigned int i, lacing, track;
size_t consumed = 0;
......@@ -1246,7 +1260,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
if (r != 1)
return r;
if (track_number == 0)
if (track_number == 0 || (unsigned int)track_number != track_number)
return -1;
consumed += length;
......@@ -1319,15 +1333,13 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
if (total > block_size)
return -1;
if (ne_map_track_number_to_index(ctx, track_number, &track) != 0)
if (ne_map_track_number_to_index(ctx, (unsigned int)track_number, &track) != 0)
return -1;
entry = ne_find_track_entry(ctx, track);
if (!entry)
return -1;
track_scale = 1.0;
tc_scale = ne_get_timecode_scale(ctx);
assert(ctx->segment.cluster.tail->id == ID_CLUSTER);
......@@ -1451,13 +1463,13 @@ static struct cue_track_positions *
ne_find_cue_position_for_track(nestegg * ctx, struct ebml_list_node * node, unsigned int track)
{
struct cue_track_positions * pos = NULL;
uint64_t track_number;
unsigned int track_number;
unsigned int t;
while (node) {
assert(node->id == ID_CUE_TRACK_POSITIONS);
pos = node->data;
if (ne_get_uint(pos->track, &track_number) != 0)
if (ne_get_uint32(pos->track, &track_number) != 0)
return NULL;
if (ne_map_track_number_to_index(ctx, track_number, &t) != 0)
......@@ -1844,7 +1856,7 @@ nestegg_get_cue_point(nestegg * ctx, unsigned int cluster_num, int64_t max_offse
if (ne_get_uint(pos->track, &track_number) != 0)
return -1;
if (ne_map_track_number_to_index(ctx, track_number, &track_index) != 0)
if (ne_map_track_number_to_index(ctx, (unsigned int)track_number, &track_index) != 0)
return -1;
if (track_index == track) {
......@@ -2076,7 +2088,7 @@ nestegg_track_video_params(nestegg * ctx, unsigned int track,
nestegg_video_params * params)
{
struct track_entry * entry;
uint64_t value;
unsigned int value;
memset(params, 0, sizeof(*params));
......@@ -2088,41 +2100,41 @@ nestegg_track_video_params(nestegg * ctx, unsigned int track,
return -1;
value = 0;
ne_get_uint(entry->video.stereo_mode, &value);
ne_get_uint32(entry->video.stereo_mode, &value);
if (value <= NESTEGG_VIDEO_STEREO_TOP_BOTTOM ||
value == NESTEGG_VIDEO_STEREO_RIGHT_LEFT)
params->stereo_mode = value;
if (ne_get_uint(entry->video.pixel_width, &value) != 0)
if (ne_get_uint32(entry->video.pixel_width, &value) != 0)
return -1;
params->width = value;
if (ne_get_uint(entry->video.pixel_height, &value) != 0)
if (ne_get_uint32(entry->video.pixel_height, &value) != 0)
return -1;
params->height = value;
value = 0;
ne_get_uint(entry->video.pixel_crop_bottom, &value);
ne_get_uint32(entry->video.pixel_crop_bottom, &value);
params->crop_bottom = value;
value = 0;
ne_get_uint(entry->video.pixel_crop_top, &value);
ne_get_uint32(entry->video.pixel_crop_top, &value);
params->crop_top = value;
value = 0;
ne_get_uint(entry->video.pixel_crop_left, &value);
ne_get_uint32(entry->video.pixel_crop_left, &value);
params->crop_left = value;
value = 0;
ne_get_uint(entry->video.pixel_crop_right, &value);
ne_get_uint32(entry->video.pixel_crop_right, &value);
params->crop_right = value;
value = params->width;
ne_get_uint(entry->video.display_width, &value);
ne_get_uint32(entry->video.display_width, &value);
params->display_width = value;
value = params->height;
ne_get_uint(entry->video.display_height, &value);
ne_get_uint32(entry->video.display_height, &value);
params->display_height = value;
return 0;
......@@ -2133,7 +2145,7 @@ nestegg_track_audio_params(nestegg * ctx, unsigned int track,
nestegg_audio_params * params)
{
struct track_entry * entry;
uint64_t value;
unsigned int value;
memset(params, 0, sizeof(*params));
......@@ -2148,19 +2160,19 @@ nestegg_track_audio_params(nestegg * ctx, unsigned int track,
ne_get_float(entry->audio.sampling_frequency, &params->rate);
value = 1;
ne_get_uint(entry->audio.channels, &value);
ne_get_uint32(entry->audio.channels, &value);
params->channels = value;
value = 16;
ne_get_uint(entry->audio.bit_depth, &value);
ne_get_uint32(entry->audio.bit_depth, &value);
params->depth = value;
value = 0;
ne_get_uint(entry->codec_delay, &value);
ne_get_uint32(entry->codec_delay, &value);
params->codec_delay = value;
value = 0;
ne_get_uint(entry->seek_preroll, &value);
ne_get_uint32(entry->seek_preroll, &value);
params->seek_preroll = value;
return 0;
......@@ -2224,7 +2236,7 @@ nestegg_free_packet(nestegg_packet * pkt)
int
nestegg_packet_track(nestegg_packet * pkt, unsigned int * track)
{
*track = pkt->track;
*track = (unsigned int)pkt->track;
return 0;
}
......
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