summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/mpegplay/slice.cpp
blob: 1a64378f091a892911af533d66ba2e2f49df2677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
  reads/parse slice infos
  Copyright (C) 1999  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */


#include "slice.h"




Slice::Slice() {
  mpegExtension=new MpegExtension();
}


Slice::~Slice() {
  delete mpegExtension;

}

unsigned int Slice::getVertPos() {
  return vert_pos;
}



void Slice::setQuantScale(unsigned int quant_scale) {
  this->quant_scale=quant_scale;
}

/*
 *--------------------------------------------------------------
 *
 * ParseSlice --
 *
 *      Parses off slice header.
 *
 * Results:
 *      Values found in slice header put into video stream structure.
 *
 * Side effects:
 *      Bit stream irreversibly parsed.
 *
 *--------------------------------------------------------------
 */
int Slice::parseSlice(MpegVideoStream* mpegVideoStream) {
  
  /* Flush slice start code. */
  mpegVideoStream->flushBits(24);

  /* Parse off slice vertical position. */
  /* its the "slice number" */
  vert_pos=mpegVideoStream->getBits(8);

  /* Parse off quantization scale. */
  quant_scale=mpegVideoStream->getBits(5);

  /* Parse off extra bit slice info. */
  mpegExtension->processExtra_bit_info(mpegVideoStream);

  return true;
}