Make sure variables are initialized.
From: Erik Hovland <erik@hovland.org>
---
programs/mythtranscode/mpeg2fix.cpp | 15 ++++++++++-----
programs/mythtranscode/mpeg2fix.h | 20 +++++++++++++-------
programs/mythtranscode/replex/multiplex.c | 2 +-
3 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/programs/mythtranscode/mpeg2fix.cpp b/programs/mythtranscode/mpeg2fix.cpp
index 28605b5..a506135 100644
a
|
b
|
MPEG2fixup::MPEG2fixup(const char *inf, const char *outf, |
214 | 214 | |
215 | 215 | infile = inf; |
216 | 216 | rx.outfile = outf; |
217 | | rx.done = 0; |
| 217 | rx.done = false; |
218 | 218 | format = fmt; |
219 | 219 | no_repeat = norp; |
220 | 220 | fix_PTS = fixPTS; |
… |
… |
int fill_buffers(void *r, int finish) |
448 | 448 | } |
449 | 449 | |
450 | 450 | MPEG2replex::MPEG2replex() |
| 451 | : done(false), otype(-1) |
| 452 | , ext_count(0), mplex(NULL) |
451 | 453 | { |
452 | 454 | memset(&vrbuf, 0, sizeof(ringbuffer)); |
453 | 455 | memset(&index_vrbuf, 0, sizeof(ringbuffer)); |
454 | | memset(&extrbuf, 0, sizeof(ringbuffer) * N_AUDIO); |
455 | | memset(&index_extrbuf, 0, sizeof(ringbuffer) * N_AUDIO); |
456 | | ext_count = 0; |
| 456 | memset(extrbuf, 0, sizeof(ringbuffer) * N_AUDIO); |
| 457 | memset(index_extrbuf, 0, sizeof(ringbuffer) * N_AUDIO); |
| 458 | memset(exttype, 0, sizeof(int) * N_AUDIO); |
| 459 | memset(exttypcnt, 0, sizeof(int) * N_AUDIO); |
| 460 | memset(extframe, 0, sizeof(audio_frame_t) * N_AUDIO); |
| 461 | memset(&seq_head, 0, sizeof(seq_head)); |
457 | 462 | } |
458 | 463 | |
459 | 464 | MPEG2replex::~MPEG2replex() |
… |
… |
int MPEG2fixup::Start() |
2378 | 2383 | break; |
2379 | 2384 | } |
2380 | 2385 | |
2381 | | rx.done = 1; |
| 2386 | rx.done = true; |
2382 | 2387 | pthread_mutex_lock( &rx.mutex ); |
2383 | 2388 | pthread_cond_signal(&rx.cond); |
2384 | 2389 | pthread_mutex_unlock( &rx.mutex ); |
diff --git a/programs/mythtranscode/mpeg2fix.h b/programs/mythtranscode/mpeg2fix.h
index 8fadcf8..f976334 100644
a
|
b
|
class MPEG2frame |
42 | 42 | { |
43 | 43 | public: |
44 | 44 | MPEG2frame(int size) |
| 45 | : isSequence(false), isGop(false) |
| 46 | , framePos(NULL), gopPos(NULL) |
45 | 47 | { |
46 | | pkt.data = (uint8_t *)malloc(size); |
47 | | pkt_memsize = size; |
| 48 | av_new_packet(&pkt, size); |
| 49 | pkt.priv = NULL; |
| 50 | memset(pkt.data, 0, sizeof(uint8_t) * pkt.size); |
| 51 | memset(&mpeg2_seq, 0, sizeof(mpeg2_seq)); |
| 52 | memset(&mpeg2_gop, 0, sizeof(mpeg2_gop)); |
| 53 | memset(&mpeg2_pic, 0, sizeof(mpeg2_pic)); |
48 | 54 | } |
| 55 | |
49 | 56 | ~MPEG2frame() |
50 | 57 | { |
51 | | free(pkt.data); |
| 58 | av_destruct_packet(&pkt); |
52 | 59 | } |
53 | 60 | void ensure_size(int size) |
54 | 61 | { |
55 | | if (pkt_memsize < size) |
| 62 | if (pkt.size < size) |
56 | 63 | { |
57 | 64 | pkt.data = (uint8_t *)realloc(pkt.data, size); |
58 | | pkt_memsize = size; |
| 65 | pkt.size = size; |
59 | 66 | } |
60 | 67 | } |
61 | 68 | void set_pkt(AVPacket *newpkt) |
… |
… |
class MPEG2frame |
68 | 75 | } |
69 | 76 | |
70 | 77 | AVPacket pkt; |
71 | | int pkt_memsize; |
72 | 78 | bool isSequence; |
73 | 79 | bool isGop; |
74 | 80 | uint8_t *framePos; |
… |
… |
class MPEG2replex |
108 | 114 | ~MPEG2replex(); |
109 | 115 | void Start(); |
110 | 116 | int WaitBuffers(); |
111 | | int done; |
| 117 | bool done; |
112 | 118 | QString outfile; |
113 | 119 | int otype; |
114 | 120 | ringbuffer vrbuf; |
diff --git a/programs/mythtranscode/replex/multiplex.c b/programs/mythtranscode/replex/multiplex.c
index c341e7f..48ebb3a 100644
a
|
b
|
static int which_ext(extdata_t *ext, int *aok, int n) |
33 | 33 | int i; |
34 | 34 | int started = 0; |
35 | 35 | int pos = -1; |
36 | | uint64_t tmppts; |
| 36 | uint64_t tmppts = 0; |
37 | 37 | for(i=0; i < n; i++) |
38 | 38 | if(aok[i]){ |
39 | 39 | if(! started){ |