ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Grigory Batalov <bga@altlinux.ru>
To: ALT Devel discussion list <devel@altlinux.ru>
Subject: Re: [devel] Re: ffmpeg-20050406
Date: Thu, 14 Apr 2005 15:11:43 +0400
Message-ID: <20050414151143.3c7d72da.bga@altlinux.ru> (raw)
In-Reply-To: <20050413103517.GC10592@lrn.ru>

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

On Wed, 13 Apr 2005 14:35:17 +0400
Grigory Batalov <bga@altlinux.ru> wrote:

> > > Я вижу, свежий ffmpeg (0.4.9-alt1cvs20050406) уже добрался
> > > до Сизифа, давайте смотреть, не сломалось ли чего =).
> > > >   xvidcap-1.1.3-alt0.2
> > 
> > "Не пригодилось".  Бишь не собрался:
> > 
> > if i586-alt-linux-gcc -DHAVE_CONFIG_H -I. -I. -I..    -I/usr/X11R6/include -DVERSION=\"1.1.3\"     -pipe -Wall -O2 -march=i586 -mcpu=i686 -MT xvidcap-xtoffmpeg.o -MD -MP -MF ".deps/xvidcap-xtoffmpeg.Tpo" \
> >   -c -o xvidcap-xtoffmpeg.o `test -f 'xtoffmpeg.c' || echo './'`xtoffmpeg.c; \
> > then mv ".deps/xvidcap-xtoffmpeg.Tpo" ".deps/xvidcap-xtoffmpeg.Po"; \
> > else rm -f ".deps/xvidcap-xtoffmpeg.Tpo"; exit 1; \
> > fi
> ...
> > make[2]: *** [xvidcap-xtoffmpeg.o] Error 1
> > make[2]: Leaving directory `/usr/src/RPM/BUILD/xvidcap-1.1.3/src'
> > 
> > Попробовать, что ли, 1.1.4pre2 собрать...
> 
>   Тоже не собирается... Поковыряю немного, может, разберусь.

  1.1.4pre2 не собирается из-за своих собственных тараканов =).
  А к ffmpeg-0.4.9 эта версия уже готова. Для 1.1.3, рассчитанной
  на 0.4.8, можно применить прилагаемый патчик.

  Правда, я так и не понял, работает ли теперь xvidcap =).
  Кто им уже пользовался, проверьте?

[-- Attachment #2: xvidcap-1.1.3-alt-ffmpeg.patch --]
[-- Type: text/plain, Size: 3057 bytes --]

diff -ruN xvidcap-1.1.3.orig/src/xtoffmpeg.c xvidcap-1.1.3/src/xtoffmpeg.c
--- xvidcap-1.1.3.orig/src/xtoffmpeg.c	2004-02-15 22:00:54 +0300
+++ xvidcap-1.1.3/src/xtoffmpeg.c	2005-04-14 13:56:57 +0400
@@ -186,24 +186,33 @@
         
         frame_bytes = enc->frame_size * 2 * enc->channels;
         
         while (fifo_read (&ost->fifo, audio_buf, frame_bytes,
         &ost->fifo.rptr) == 0) {
-            ret = avcodec_encode_audio (enc, audio_out, audio_out_size,
-            (short *)audio_buf);
 
-//            audio_pts = (double)au_out_st->st->pts.val * output_file->pts_num / output_file->pts_den;
-//            video_pts = (double)out_st->pts.val * output_file->pts_num / output_file->pts_den;
+	    AVPacket pkt;
+    
+            // initialize audio output packet
+            av_init_packet(&pkt);
+            
+            pkt.size = avcodec_encode_audio (enc, audio_out, audio_out_size, (short *)audio_buf);
+            pkt.stream_index= ost->st->index;
+            if (enc->coded_frame) { 
+		    pkt.pts = enc->coded_frame->pts;
+	    }
+            pkt.flags |= PKT_FLAG_KEY;
+            pkt.data = audio_out;
 
-//            if ( audio_pts < video_pts && pthread_mutex_trylock (&mp) == 0 ) {
             if (  pthread_mutex_trylock (&mp) == 0 ) {
                 /* write the compressed frame in the media file */
-                if (av_write_frame (s, ost->st->index, audio_out, ret) != 0) {
+                if (av_write_frame (s, &pkt) != 0) {
                     fprintf (stderr, "Error while writing audio frame\n");
                     exit (1);
                 }
+                
                 if ( pthread_mutex_unlock (&mp) > 0 ) {
                     fprintf (stderr, "Couldn't unlock mutex lock for writing audio frame\n");
                 }
+
             } /* else {
              fprintf (stderr, "Can't lock mutex for writing audio frame\n");
              } */
@@ -239,6 +247,7 @@
 }
 
 
+
 void cleanup_thread_when_stopped () {
     int retval = 0;
     
@@ -371,6 +380,27 @@
 #endif // HAVE_FFMPEG_AUDIO
 
 
+static void do_video_out (AVFormatContext *s, AVStream *ost, unsigned char *buf, int size) {
+    AVCodecContext *enc; 
+    AVPacket pkt;
+    
+    enc = &(ost->codec);
+
+    // initialize video output packet
+    av_init_packet(&pkt);
+    pkt.size = size;
+    if (enc->coded_frame) pkt.pts = enc->coded_frame->pts;
+    if (enc->coded_frame && enc->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY;
+    pkt.stream_index= ost->index;
+    pkt.data= buf;
+
+    if (av_write_frame (s, &pkt) != 0) {
+        fprintf (stderr, "Error while writing audio frame\n");
+        exit (1);
+    }
+} 
+
+
 #ifdef DEBUG
 /*
  * dump info about XImage - for debugging purposes
@@ -1117,7 +1147,7 @@
     }
 #endif // HAVE_FFMPEG_AUDIO
     /* write frame to file */
-    av_write_frame (output_file, out_st->index, outbuf, out_size);
+    do_video_out (output_file, out_st, outbuf, out_size);
 #ifdef HAVE_FFMPEG_AUDIO
     /* release the mutex */
     if (job->flags & FLG_AUDIO_WANTED) {

      reply	other threads:[~2005-04-14 11:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13  7:51 [devel] ffmpeg-20050406 Grigory Batalov
2005-04-13  9:28 ` Sergey V Turchin
2005-04-13  9:33   ` Grigory Batalov
2005-04-13 13:33     ` Sergey V Turchin
2005-04-13 13:49       ` Grigory Batalov
2005-04-13 14:35       ` [devel] ffmpeg-20050406 Michael Shigorin
2005-04-13 14:40         ` Sergey V Turchin
2005-04-13 15:11           ` Michael Shigorin
2005-04-13 15:56             ` Sergey V Turchin
2005-04-13 15:11           ` Ivan Fedorov
2005-04-13 15:12             ` Ivan Fedorov
2005-04-13 10:04 ` Michael Shigorin
2005-04-13 10:35   ` Grigory Batalov
2005-04-14 11:11     ` Grigory Batalov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050414151143.3c7d72da.bga@altlinux.ru \
    --to=bga@altlinux.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git