diff oggdec.h @ 5810:d090202af37d libavformat

oggdec: Move ogg_find_stream and ogg_gptopts to oggdec.h (skeleton will need them)
author conrad
date Thu, 11 Mar 2010 07:17:33 +0000
parents 9145ca829bce
children 5e9709333748
line wrap: on
line diff
--- a/oggdec.h	Thu Mar 11 07:17:29 2010 +0000
+++ b/oggdec.h	Thu Mar 11 07:17:33 2010 +0000
@@ -115,4 +115,34 @@
 
 int vorbis_comment(AVFormatContext *ms, uint8_t *buf, int size);
 
+static inline int
+ogg_find_stream (struct ogg * ogg, int serial)
+{
+    int i;
+
+    for (i = 0; i < ogg->nstreams; i++)
+        if (ogg->streams[i].serial == serial)
+            return i;
+
+    return -1;
+}
+
+static inline uint64_t
+ogg_gptopts (AVFormatContext * s, int i, uint64_t gp, int64_t *dts)
+{
+    struct ogg *ogg = s->priv_data;
+    struct ogg_stream *os = ogg->streams + i;
+    uint64_t pts = AV_NOPTS_VALUE;
+
+    if(os->codec->gptopts){
+        pts = os->codec->gptopts(s, i, gp, dts);
+    } else {
+        pts = gp;
+        if (dts)
+            *dts = pts;
+    }
+
+    return pts;
+}
+
 #endif /* AVFORMAT_OGGDEC_H */