summaryrefslogtreecommitdiff
path: root/src/libffmpeg/mpeg_parser.h
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2004-07-18 00:50:02 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2004-07-18 00:50:02 +0000
commit53c8bea4d9de3dea4c11e1fbedd24e5ba055a08d (patch)
tree9fc1c83dbfda6aae84f0d4563224127301001597 /src/libffmpeg/mpeg_parser.h
parentcf502f850beaf31c6a0a32649ce53ab1cc998949 (diff)
downloadxine-lib-53c8bea4d9de3dea4c11e1fbedd24e5ba055a08d.tar.gz
xine-lib-53c8bea4d9de3dea4c11e1fbedd24e5ba055a08d.tar.bz2
better mpeg-es parser.
Fix "hurry_up" behavior (keep the metronom happy). Enable DR1 for the mpeg12 decoder. Remove all the mpeg-es parsing from here, use the new parser instead. Handle frame format changes (width, height and aspect ratio) Tested with all my mpeg streams, and with some DVDs with still menus. Enjoy ;) CVS patchset: 6805 CVS date: 2004/07/18 00:50:02
Diffstat (limited to 'src/libffmpeg/mpeg_parser.h')
-rw-r--r--src/libffmpeg/mpeg_parser.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/libffmpeg/mpeg_parser.h b/src/libffmpeg/mpeg_parser.h
new file mode 100644
index 000000000..24bbfcbbb
--- /dev/null
+++ b/src/libffmpeg/mpeg_parser.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2001-2004 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr)
+ * based on libmpeg2 decoder.
+ *
+ * $Id: mpeg_parser.h,v 1.1 2004/07/18 00:50:02 tmattern Exp $
+ */
+ #include <inttypes.h>
+
+#define BUFFER_SIZE (1194 * 1024) /* libmpeg2's buffer size */
+
+/* picture coding type (mpeg2 header) */
+#define I_TYPE 1
+#define P_TYPE 2
+#define B_TYPE 3
+#define D_TYPE 4
+
+typedef struct mpeg_parser_s {
+ uint32_t shift;
+ int is_sequence_needed;
+ uint8_t chunk_buffer[BUFFER_SIZE];
+ uint8_t *chunk_ptr;
+ uint8_t *chunk_start;
+ int buffer_size;
+ uint8_t code;
+ uint8_t picture_coding_type;
+ int rate_code;
+ int aspect_ratio_info;
+ int in_slice;
+
+ /* public properties */
+ int is_mpeg1;
+ int has_sequence;
+ int width;
+ int height;
+ int frame_duration;
+ double frame_aspect_ratio;
+
+} mpeg_parser_t;
+
+/* parser initialization */
+void mpeg_parser_init (mpeg_parser_t *parser);
+
+/* read a frame
+ * return a pointer to the first byte of the next frame
+ * or NULL if more bytes are needed
+ * *flush is set to 1 if the decoder must be flushed (needed for still menus)
+ */
+uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser,
+ uint8_t *current, uint8_t *end,
+ int *flush);
+
+/* reset the parser */
+void mpeg_parser_reset (mpeg_parser_t *parser);