2 * This library is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU Lesser General Public License as published
4 * by the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This library is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 #endif /* HAVE_STDINT_H */
26 #define Y4M_UNKNOWN -1
27 #define Y4M_ILACE_NONE 0 /* non-interlaced, progressive frame */
28 #define Y4M_ILACE_TOP_FIRST 1 /* interlaced, top-field first */
29 #define Y4M_ILACE_BOTTOM_FIRST 2 /* interlaced, bottom-field first */
30 #define Y4M_ILACE_MIXED 3 /* mixed, "refer to frame header" */
32 #include "interlacemodes.h"
34 void ilacemode_to_text(char *string, int ilacemode)
38 case ILACE_MODE_UNDETECTED: cp = ILACE_MODE_UNDETECTED_T; break;
39 case ILACE_MODE_TOP_FIRST: cp = ILACE_MODE_TOP_FIRST_T; break;
40 case ILACE_MODE_BOTTOM_FIRST: cp = ILACE_MODE_BOTTOM_FIRST_T; break;
41 case ILACE_MODE_NOTINTERLACED: cp = ILACE_MODE_NOTINTERLACED_T; break;
42 default: cp = ILACE_UNKNOWN_T; break;
44 strcpy(string, _(cp));
47 int ilacemode_from_text(const char *text, int thedefault)
49 if(!strcasecmp(text, _(ILACE_MODE_UNDETECTED_T))) return ILACE_MODE_UNDETECTED;
50 if(!strcasecmp(text, _(ILACE_MODE_TOP_FIRST_T))) return ILACE_MODE_TOP_FIRST;
51 if(!strcasecmp(text, _(ILACE_MODE_BOTTOM_FIRST_T))) return ILACE_MODE_BOTTOM_FIRST;
52 if(!strcasecmp(text, _(ILACE_MODE_NOTINTERLACED_T))) return ILACE_MODE_NOTINTERLACED;
56 void ilacemode_to_xmltext(char *string, int ilacemode)
59 case ILACE_MODE_UNDETECTED: strcpy(string, ILACE_MODE_UNDETECTED_XMLT); return;
60 case ILACE_MODE_TOP_FIRST: strcpy(string, ILACE_MODE_TOP_FIRST_XMLT); return;
61 case ILACE_MODE_BOTTOM_FIRST: strcpy(string, ILACE_MODE_BOTTOM_FIRST_XMLT); return;
62 case ILACE_MODE_NOTINTERLACED: strcpy(string, ILACE_MODE_NOTINTERLACED_XMLT); return;
64 strcpy(string, ILACE_UNKNOWN_T);
67 int ilacemode_from_xmltext(const char *text, int thedefault)
70 if(!strcasecmp(text, ILACE_MODE_UNDETECTED_XMLT)) return ILACE_MODE_UNDETECTED;
71 if(!strcasecmp(text, ILACE_MODE_TOP_FIRST_XMLT)) return ILACE_MODE_TOP_FIRST;
72 if(!strcasecmp(text, ILACE_MODE_BOTTOM_FIRST_XMLT)) return ILACE_MODE_BOTTOM_FIRST;
73 if(!strcasecmp(text, ILACE_MODE_NOTINTERLACED_XMLT)) return ILACE_MODE_NOTINTERLACED;