home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / LINUX / gopchop-1.1.7.tar.tar / gopchop-1.1.7.tar / gopchop-1.1.7 / src / mpeg2consts.c < prev    next >
C/C++ Source or Header  |  2005-04-30  |  5KB  |  141 lines

  1. /*
  2. #
  3. # MPEG2 constant string values
  4. #
  5. # $Id: mpeg2consts.c,v 1.9 2005/04/30 20:10:01 keescook Exp $
  6. #
  7. # Copyright (C) 2001-2003 Kees Cook
  8. # kees@outflux.net, http://outflux.net/
  9. # This program is free software; you can redistribute it and/or
  10. # modify it under the terms of the GNU General Public License
  11. # as published by the Free Software Foundation; either version 2
  12. # of the License, or (at your option) any later version.
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. # GNU General Public License for more details.
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20. # http://www.gnu.org/copyleft/gpl.html
  21. #
  22. */
  23.  
  24. #include <stdio.h>
  25. #include "mpeg2structs.h"
  26. #include "mpeg2consts.h"
  27.  
  28. const char *aspect_str[] = {
  29.     "forbidden",                // 0000
  30.     "1:1",                      // 0001
  31.     "4:3",                      // 0010
  32.     "16:9",                     // 0011
  33.     "2.21:1",                   // 0100
  34.     "reserved",                 // 0101
  35.     "reserved",                 // 0110
  36.     "reserved",                 // 0111
  37.     "reserved",                 // 1000
  38.     "reserved",                 // 1001
  39.     "reserved",                 // 1010
  40.     "reserved",                 // 1011
  41.     "reserved",                 // 1100
  42.     "reserved",                 // 1101
  43.     "reserved",                 // 1110
  44.     "reserved",                 // 1111
  45. };
  46.  
  47. const char *frame_str[] = {
  48.     "forbidden",                // 0000
  49.     "23.9",                     // 0001
  50.     "24",                       // 0010
  51.     "25",                       // 0011
  52.     "29.9",                     // 0100
  53.     "30",                       // 0101
  54.     "50",                       // 0110
  55.     "59.9",                     // 0111
  56.     "60",                       // 1000
  57.     "reserved",                 // 1001
  58.     "reserved",                 // 1010
  59.     "reserved",                 // 1011
  60.     "reserved",                 // 1100
  61.     "reserved",                 // 1101
  62.     "reserved",                 // 1110
  63.     "reserved",                 // 1111
  64. };
  65.  
  66. const struct rate_fractions_t rate_frac[] = {
  67.     { 1, 1 },        // forbidden
  68.     { 24000, 1001 }, // 23.97
  69.     { 24, 1 },       // 24
  70.     { 25, 1 },       // 25
  71.     { 30000, 1001 }, // 29.97
  72.     { 30, 1 },       // 30
  73.     { 50, 1 },       // 50
  74.     { 60000, 1001 }, // 59.97
  75.     { 60, 1 },       // 60
  76.     { 1, 1 },        // reserved
  77.     { 1, 1 },        // reserved
  78.     { 1, 1 },        // reserved
  79.     { 1, 1 },        // reserved
  80.     { 1, 1 },        // reserved
  81.     { 1, 1 },        // reserved
  82.     { 1, 1 },        // reserved
  83. };
  84.  
  85. const char *pic_str[] = {
  86.     "forbidden",                // 000
  87.     "I-Frame",                  // 001
  88.     "P-Frame",                  // 010
  89.     "B-Frame",                  // 011
  90.     "invalid",                  // 100
  91.     "reserved",                 // 101
  92.     "reserved",                 // 110
  93.     "reserved",                 // 111
  94. };
  95.  
  96. const uint8_t seq_err_buf[4]     = { 0x0, 0x0, 0x1, PES_TYPE_sequence_error };
  97. const uint8_t seq_end_buf[4]     = { 0x0, 0x0, 0x1, PES_TYPE_sequence_end };
  98. const uint8_t eos_buf[4]         = { 0x0, 0x0, 0x1, PES_TYPE_program_end };
  99. const uint8_t slice_start_buf[4] = { 0x0, 0x0, 0x1, 0xAF };
  100.  
  101. const uint8_t stuffing_byte[1] =            { 0xFF };
  102. const uint8_t sequence_start_code[4] =      { 0x0, 0x0, 0x1,
  103.                                               PES_TYPE_sequence_header };
  104. const uint8_t picture_start_code[4] =       { 0x0, 0x0, 0x1,
  105.                                               PES_TYPE_picture_start };
  106. const uint8_t group_start_code[4] =         { 0x0, 0x0, 0x1,
  107.                                               PES_TYPE_group_start };
  108. const uint8_t MPEG_program_end_code[4] =    { 0x0, 0x0, 0x1,
  109.                                               PES_TYPE_program_end };
  110. const uint8_t pack_start_code[4] =          { 0x0, 0x0, 0x1,
  111.                                               PES_TYPE_pack_start };
  112. const uint8_t system_header_start_code[4] = { 0x0, 0x0, 0x1,
  113.                                               PES_TYPE_system_header };
  114. const uint8_t private_stream2_buf[4]      = { 0x0, 0x0, 0x1,
  115.                                               PES_TYPE_private_stream_2 };
  116. const uint8_t packet_start_code_prefix[3] = { 0x0, 0x0, 0x1 };
  117.  
  118.  
  119. char *speed_str(unsigned int speed)
  120. {
  121.     static char answer[64];
  122.  
  123.     if (speed > 1000000) {
  124.         sprintf(answer, "%0.2fMbs", (float) speed / 1000000.0);
  125.     }
  126.     else if (speed > 1000) {
  127.         sprintf(answer, "%0.2fKbs", (float) speed / 1000.0);
  128.     }
  129.     else
  130.         sprintf(answer, "%dbs", speed);
  131.  
  132.     return answer;
  133. }
  134.  
  135.  
  136.  
  137. /* vi:set ai ts=4 sw=4 expandtab: */
  138.