Skip to content

Commit

Permalink
restrict variable scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawrence D'Oliveiro committed Apr 5, 2012
1 parent 1de75b2 commit bb24d16
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/mpeg2desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ int main(int argc,char **argv)
{
unsigned int hdr;
unsigned char buf[200];
bool mpeg2 = true;
bool fetchhdr = true;
while (true)
{
Expand Down Expand Up @@ -548,6 +547,7 @@ int main(int argc,char **argv)
{
uint32_t scr,scrhi,scrext;
int64_t fulltime;
bool mpeg2 = true;
forceread(buf, 8, true);
if ((buf[0] & 0xC0) == 0x40)
{
Expand Down Expand Up @@ -751,23 +751,22 @@ int main(int argc,char **argv)
printf("; length=%d", extra + readlen);
if (has_extension)
{
int eptr=3;
int eptr = 3;
bool has_std = false, has_pts, has_dts;
int hdr=0, std=0, std_scale=0;
if ((buf[0] & 0xC0) == 0x80)
const bool mpeg2 = (buf[0] & 0xC0) == 0x80;
if (mpeg2)
{
mpeg2 = true;
hdr = buf[2] + 3;
eptr = 3;
has_pts = (buf[1] & 128) != 0;
has_dts = (buf[1] & 64) != 0;
}
else
{
mpeg2 = false;
while (buf[hdr] == 0xff && hdr < sizeof(buf))
hdr++;
if((buf[hdr] & 0xC0) == 0x40)
if ((buf[hdr] & 0xC0) == 0x40)
{
has_std = true;
std_scale = (buf[hdr] & 32) ? 1024 : 128;
Expand All @@ -782,7 +781,7 @@ int main(int argc,char **argv)
if (has_pts)
{
int64_t pts;
pts = readpts(buf+eptr);
pts = readpts(buf + eptr);
eptr += 5;
printf
(
Expand All @@ -794,7 +793,7 @@ int main(int argc,char **argv)
if (has_dts)
{
int64_t dts;
dts = readpts(buf+eptr);
dts = readpts(buf + eptr);
eptr += 5;
printf
(
Expand Down

0 comments on commit bb24d16

Please sign in to comment.