formats.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2007 Bobby Bingham
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libavfilter/formats.c"
  21. #undef printf
  22. int main(void)
  23. {
  24. const int64_t *cl;
  25. char buf[512];
  26. int i;
  27. const char *teststrings[] ={
  28. "blah",
  29. "1",
  30. "2",
  31. "-1",
  32. "60",
  33. "65",
  34. "1c",
  35. "2c",
  36. "-1c",
  37. "60c",
  38. "65c",
  39. "2C",
  40. "60C",
  41. "65C",
  42. "5.1",
  43. "stereo",
  44. "1+1+1+1",
  45. "1c+1c+1c+1c",
  46. "2c+1c",
  47. "0x3",
  48. };
  49. for (cl = avfilter_all_channel_layouts; *cl != -1; cl++) {
  50. av_get_channel_layout_string(buf, sizeof(buf), -1, *cl);
  51. printf("%s\n", buf);
  52. }
  53. for ( i = 0; i<FF_ARRAY_ELEMS(teststrings); i++) {
  54. int64_t layout = -1;
  55. int count = -1;
  56. int ret;
  57. ret = ff_parse_channel_layout(&layout, &count, teststrings[i], NULL);
  58. printf ("%d = ff_parse_channel_layout(%016"PRIX64", %2d, %s);\n", ret ? -1 : 0, layout, count, teststrings[i]);
  59. }
  60. return 0;
  61. }